Skip to content

Instantly share code, notes, and snippets.

@cubarco
Created May 14, 2016 05:03
Show Gist options
  • Save cubarco/d1f8be0a58790e8cdda716553a3b6493 to your computer and use it in GitHub Desktop.
Save cubarco/d1f8be0a58790e8cdda716553a3b6493 to your computer and use it in GitHub Desktop.
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
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