Jump to content

derwert

Members
  • Posts

    101
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

derwert's Achievements

Newbie

Newbie (1/5)

3

Reputation

  1. Here is a detailed explanation of why it doesn't work, it is referred to as variable scope http://www.php.net/manual/en/language.variables.scope.php If you have any questions post back here.
  2. Like you said the best way would be to parse the access list. You could also just check the users current mode i.e. see if they have +h +o etc but you'll want to keep in mind in that case that a user can be given temporary access by another op which if the user were to leave the room and come back in they would no longer have the access. So it really boils down to what criteria you want to go by. Edit: You'll also want to keep in mind that you'll want to ensure the user is authenticated to the IRC services before allowing them any access.
  3. While this is possible in PHP it is better suited for javascript. See the link below for a very basic example: Basic Javascript Calculator
  4. Here is a quick and dirty regular expression if you insist on not using the XML output $pattern = '~'; $pattern .= 'Nmap scan report for (.*?)\n'; $pattern .= 'Host(?:.*?)\n'; $pattern .= '(?:MAC Address\: ([0-9A-F]{2}\:[0-9A-F]{2}\:[0-9A-F]{2}\:[0-9A-F]{2}\:[0-9A-F]{2}\:[0-9A-F]{2}) (?:.*?)\\n)?'; $pattern .= '~m'; This is assuming your output is standard output from nmap which has a \n after each line of output. So if the sample input was: Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-10 20:53 BST Nmap scan report for 192.168.0.1 Host is up (0.0055s latency). MAC Address: 00:00:00:00:00:01 (Unknown) Nmap scan report for 192.168.0.2 Host is up (0.00019s latency). MAC Address: 00:00:00:00:00:02 (DFI) Nmap scan report for 192.168.0.4 Host is up (0.0043s latency). MAC Address: 00:00:00:00:00:03 (Unknown) Nmap scan report for 192.168.0.8 Host is up. Nmap scan report for 192.168.0.10 Host is up (0.0043s latency). MAC Address: 00:00:00:00:00:10 (Unknown) Nmap done: 256 IP addresses (4 hosts up) scanned in 5.37 seconds The output would be: Array ( [0] => Array ( ~ Edited out ~ ) [1] => Array ( [0] => 192.168.0.1 [1] => 192.168.0.2 [2] => 192.168.0.4 [3] => 192.168.0.8 [4] => 192.168.0.10 ) [2] => Array ( [0] => 00:00:00:00:00:01 [1] => 00:00:00:00:00:02 [2] => 00:00:00:00:00:03 [3] => [4] => 00:00:00:00:00:10 ) )
  5. DarkerAngel, your regular expression does not work correctly, re-read the requirements in the post and look at the results of your regex. Jason, you quoted my post but it doesn't seem like you read it. I'll quote it below for your convenience.
  6. While I do recommend you get more familiar with regular expressions and practice it, it can be very useful. I had a light bulb go off while I was browsing other posts that reminded that nmap outputs to various formats. See this link for the documentation of nmap output http://nmap.org/book/man-output.html nmap supports outputting to XML which given your requirements would be the most straight forward way to handle this. On a off note, if it helps you understand regular expressions better if you want me to explain in more detail what the original code I posted does then let me know and I will.
  7. You're missing the curl_setopt to set the type of HTTP authentication, see my first reply with the sample curl_setopts. Also see the PHP Manual for curl_setopt http://www.php.net/m...curl-setopt.php Though it may just be trying to redirect you to the web servers error page. You can capture the packets and view the raw data to see what is happening.
  8. I'm not familar with coldfusion or cRest, but googling, if this is the cRest you were referring to http://crest.codegist.org/ Then see the below link regarding setting the username and password: http://crest.codegist.org/authentication/basic.html
  9. According to Adobes documentation here: http://livedocs.adob...ags_g-h_09.html So if you were to use curl in PHP to make the HTTP request you would use the below options to set the username and password: curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($curl, CURLOPT_USERPWD, 'username:password'); There are many HTTP classes out there if you don't want to use curl or you could use sockets and craft your own HTTP request. Any class/lib that supports RFC2617 should be able to do what you want.
  10. You'll also find a warning in the PHP Manual http://no2.php.net/m...uctures.for.php regarding the performance issue with using count in a for loop
  11. Change the pattern to: $pattern = "~[\-]{1,2}(.*?)[\x20]+([\S]+)~"; Check out: http://us.php.net/ma...cre.pattern.php www.regular-expressions.info
  12. There are many ways you could do this, one being regular expressions. See my example below: <?php $string = "-A INPUT -s 192.168.0.1 -p TCP -j DROP"; print_r (parse_args($string)); function parse_args($raw_args){ $pattern = "~\-(.*?)[\x20]+([\S]+)~"; $args = array(); if(preg_match_all($pattern, $raw_args, $matches) === FALSE){ return FALSE; }else{ $args = array_combine($matches[1], $matches[2]); return $args; } } ?> The results would be: Array ( [A] => INPUT [s] => 192.168.0.1 [p] => TCP [j] => DROP )
  13. If anyone else tries to access the above link like me, here is the updated link "Leaving PHPFreaks" The ";topicseen" in the URL stopped the redirect from working for me
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.