NetblockTool
NetblockTool copied to clipboard
No results
Running the script now appears to not produce any results.
Yeah, the API changed. Here's a patch (0001-Update-queries-now-the-REST-API-has-taken-over-at-AR.patch):
Subject: [PATCH] Update queries now the REST API has taken over at ARIN
---
NetblockTool.py | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
mode change 100644 => 100755 NetblockTool.py
diff --git a/NetblockTool.py b/NetblockTool.py
old mode 100644
new mode 100755
index 21d53f8..b2b5e55
--- a/NetblockTool.py
+++ b/NetblockTool.py
@@ -991,25 +991,16 @@ def get_arin_objects(target_name):
"""
return_list = []
blacklist = ['.html']
- data = 'flushCache=true&queryinput='+process_url_encode(target_name)+'&whoisSubmitButton=+'
- headers = {'Host' : 'whois.arin.net',
- 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0',
- 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'Accept-Language': 'en-US,en;q=0.5',
- 'Accept-Encoding': 'gzip, deflate',
- 'Referer' : 'https://whois.arin.net/ui/query.do',
- 'Content-Type' : 'application/x-www-form-urlencoded',
- 'Content-Length': str(len(data)),
- 'Connection' : 'close'}
- req = requests.post('https://whois.arin.net/ui/query.do', data=data, headers=headers)
- response = str(req.text.encode('utf-8'))
- urls = re.findall(r'[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)', response)
- for url in urls:
- if 'rest' in url:
- for ext in blacklist:
- if url.endswith(ext):
- url = url.replace(ext, '')
- return_list.append('http://whois.arin.net'+url)
+ for obj_type in ['pocs','nets','asns','orgs','customers']:
+ req = requests.get('https://whois.arin.net/rest/{1};q={0}'.format(target_name, obj_type))
+ response = str(req.text.encode('utf-8'))
+ urls = re.findall(r'[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)', response)
+ for url in urls:
+ if 'rest' in url:
+ for ext in blacklist:
+ if url.endswith(ext):
+ url = url.replace(ext, '')
+ return_list.append('http://whois.arin.net'+url)
return sorted(return_list)
--
2.43.7
I think it is more related to an issue with urllib3, at least on MacOs it doesnt jive with the Python3 version.
/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020