Advertisement
Vespertilio

Untitled

Jan 17th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import  requests, re
  2.  
  3. headers = {
  4.     'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.87 Safari/537.36 OPR/41.0.2353.56"
  5. }
  6.  
  7. r = requests.get("http://ipinfo.io/AS19541")
  8. # print(r.text)
  9. match = re.findall('(?:\d{1,3}\.){3}\d{1,3}/\d{1,2}', r.text)
  10.  
  11. if match:
  12.     # netblocks = match.group()
  13.     print(match)
  14.     for netblock in match:
  15.         print("/ip firewall address-list add address=%s list=ea-netblocks" % netblock)
  16. else:
  17.     print("Nothing found.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement