I need to write a loop to brute force a cookie on a website, and this is what I've got so far.
import urllib
import urllib2
opener = urllib2.build_opener()
i = 0
for i in range(75):
opener.addheaders.append(('cookie',"cookie_name"+str(i)))
REQ = opener.open("http://127.0.0.1:80/my_cookie")
REQ.read()
It's actually changing the cookie, but it doesn't give the expected output. Any suggestions?
I tried a while loop and it's the same. I think that the problem is in sending the cookie as a cookie!
second try
import urllib2
opener = urllib2.build_opener()
i = 75
while i > 0:
opener.addheaders.append(('cookie','alien_id='+str(i)))
print opener.open("http://127.0.0.1:8082/cookiestore").read(2048)+str(i)
i=i-1