Created
December 4, 2015 14:52
-
-
Save ysangkok/95cb98089bfd93466f2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMPNAM=$(mktemp) | |
rm $TMPNAM | |
mkfifo $TMPNAM | |
curl http://data.iana.org/TLD/tlds-alpha-by-domain.txt | sed -e 1d | parallel -j 24 host '{}' 8.8.8.8 | grep "has address" > $TMPNAM & | |
echo -en " | |
import requests | |
with open('$TMPNAM') as f: | |
for tld, has, address, addr in map(lambda x: x.strip().split(' '), f.readlines()): | |
if addr.startswith('127'): continue | |
try: | |
print(tld, addr, requests.get('http://{}'.format(addr), timeout=1)) | |
except Exception as e: | |
if e.__class__.__name__ != 'ConnectionError': print(repr(e.__class__.__name__)) | |
" | python3 - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment