x2Fusion

PHP ASN to Ranges

Oct 19th, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Get CIDRs from Robtex, per ASN
  4.  */
  5.  
  6. // Change /as#.html, use https://asn.cymru.com/ with IP annouced by ASN
  7. $data = file_get_contents('https://www.robtex.com/as/as62.html');
  8.  
  9. preg_match_all('/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}\/[0-9]{2}/', $data, $matches);
  10.  
  11. foreach($matches[0] as $match)
  12. {
  13.     echo $match . PHP_EOL;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment