Created
May 14, 2016 05:03
-
-
Save cubarco/d1f8be0a58790e8cdda716553a3b6493 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
from gevent import monkey | |
monkey.patch_all() | |
import requests | |
import sys | |
from gevent.pool import Pool | |
from itertools import imap | |
count = {'': 0} | |
def do_get(url): | |
try: | |
resp = requests.get(url) | |
except: | |
do_get(url) | |
return | |
count[''] += 1 | |
sys.stdout.write('%d \r' % count['']) | |
if resp.status_code != 404: | |
print url | |
print resp.text | |
if __name__ == '__main__': | |
base_url = 'http://106.75.10.230:9798/css/whctf%07d.css' | |
pool = Pool(1000) | |
for _ in pool.imap(do_get, imap(lambda x: base_url % x, xrange(10 ** 7))): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment