bug7sec

IP_STR EXTRACKTOR (shodan.io)

Jan 31st, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. Name    : IP_STR EXTRACKTOR (shodan.io)
  5. Author  : Shor7cut
  6. Link    : http://facebook.com/bug7sec
  7. */
  8.  
  9. function save($name,$data){
  10.         $myfile = fopen($name, "a+") or die("Unable to open file!");
  11.         fwrite($myfile, $data);
  12.         fclose($myfile);
  13.         if($myfile){
  14.                 return true;
  15.         }else{
  16.                 return false;
  17.         }
  18. }
  19.  
  20. if(isset($argv[1]) && isset($argv[2])){
  21.     $x = 1;
  22.     $json = file_get_contents($argv[1]);
  23.     $re = "/\"ip_str\": \"(.*?)\"}/";
  24.     preg_match_all($re, $json, $matches);
  25.     foreach ($matches[0] as $key => $value) {
  26.         $filter =  str_replace('"ip_str": "' , "", $value);
  27.         $filter = str_replace('"}', "", $filter);
  28.         $data = $filter."\r\n";
  29.         save($argv[2],$data);
  30.         $x++;
  31.         echo "$x ";
  32.     }
  33.     echo "\r\n total : ".$x." Target";
  34. }else{
  35.     echo "php ".$argv[0]." [file] [output]\r\n";
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment