commit
964a0f5243
|
@ -6,6 +6,7 @@ dist
|
||||||
env/*.*
|
env/*.*
|
||||||
# VM debug file
|
# VM debug file
|
||||||
start_vm.cmd
|
start_vm.cmd
|
||||||
|
start_vm.sh
|
||||||
# Debug file
|
# Debug file
|
||||||
src/debug.py
|
src/debug.py
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,14 @@
|
||||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python 调试程序: 包含参数的当前文件",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"args": "${command:pickArgs}"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Python 调试 main",
|
"name": "Python 调试 main",
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
|
@ -23,7 +31,8 @@
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${file}",
|
"program": "${file}",
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal",
|
||||||
|
"sudo": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "make debug",
|
"command": "make debug",
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
dist/PEinjector.7z: src/main.py src/log.py src/action.py src/hook.pyw src/makelnk.py src/regwrite.py src/config.py src/loader.py src/utils.py root/VentoyAutoRun.bat
|
||||||
|
mkdir tmp/pkg/PEinjector/env -p
|
||||||
|
mkdir tmp/pkg/PEinjector/src -p
|
||||||
|
mkdir tmp/pkg/PEinjector/tool -p
|
||||||
|
cp ./root/* ./tmp/pkg -rfp
|
||||||
|
cp ./env ./tmp/pkg/PEinjector/env -rfp
|
||||||
|
cp ./src ./tmp/pkg/PEinjector/src -rfp
|
||||||
|
cp ./tool ./tmp/pkg/PEinjector/tool -rfp
|
||||||
|
rm -rf dist
|
||||||
|
mkdir disk -p
|
||||||
|
7z a -t7z dist/PEinjector.7z ./tmp/pkg/PEinjector -r -m0=BCJ -m1=LZMA:d=21 -ms -mmt
|
||||||
|
7z a -t7z dist/PEinjector.7z ./tmp/pkg/VentoyAutoRun.bat -m0=BCJ -m1=LZMA:d=21 -ms -mmt
|
||||||
|
rm -rf tmp
|
||||||
|
|
||||||
|
tmp/py/python.zip:
|
||||||
|
mkdir tmp/py -p
|
||||||
|
cd tmp/py
|
||||||
|
wget https://registry.npmmirror.com/-/binary/python/3.12.1/python-3.12.1-embed-amd64.zip -O tmp/py/python.zip
|
||||||
|
|
||||||
|
env/python.exe: tmp/py/python.zip
|
||||||
|
7z x -y -aos -o env/ tmp/py/python.zip
|
||||||
|
|
||||||
|
install: dist/PEinjector.7z installer\install.py
|
||||||
|
python3 installer\install.py
|
||||||
|
|
||||||
|
build: dist/PEinjector.7z
|
||||||
|
|
||||||
|
prepare: env/python.exe
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf tmp
|
||||||
|
rm -rf dist
|
||||||
|
mkdir dist -p
|
||||||
|
|
||||||
|
debug: dist/PEinjector.7z
|
||||||
|
sudo python3 installer/install.py
|
||||||
|
chmod +x ./start_vm.sh
|
||||||
|
./start_vm.sh
|
||||||
|
|
||||||
|
start:
|
||||||
|
chmod +x ./start_vm.sh
|
||||||
|
./start_vm.sh
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ dist\PEinjector.7z: src\main.py src\log.py src\action.py src\hook.pyw src\makeln
|
||||||
tmp\py\python.zip:
|
tmp\py\python.zip:
|
||||||
mkdir tmp\py
|
mkdir tmp\py
|
||||||
cd tmp\py
|
cd tmp\py
|
||||||
curl https://www.python.org/ftp/python/3.12.1/python-3.12.1-embed-amd64.zip -o tmp\py\python.zip
|
wget https://registry.npmmirror.com/-/binary/python/3.12.1/python-3.12.1-embed-amd64.zip -O tmp\py/python.zip
|
||||||
env\python.exe: tmp\py\python.zip
|
env\python.exe: tmp\py\python.zip
|
||||||
7z x -y -aos -oenv\ tmp\py\python.zip
|
7z x -y -aos -oenv\ tmppy/python.zip
|
||||||
install: dist\PEinjector.7z installer/install.py
|
install: dist\PEinjector.7z installer/install.py
|
||||||
python installer\install.py
|
python installer\install.py
|
||||||
build: dist\PEinjector.7z
|
build: dist\PEinjector.7z
|
|
@ -1,6 +1,6 @@
|
||||||
#####################################
|
#####################################
|
||||||
## PEinjector/installer ##
|
## PEinjector/installer ##
|
||||||
#####################################
|
####################################
|
||||||
|
|
||||||
# This moudle is a part of PEinjector.
|
# This moudle is a part of PEinjector.
|
||||||
# Please comply with the LICENSE.
|
# Please comply with the LICENSE.
|
||||||
|
@ -9,6 +9,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
import platform
|
import platform
|
||||||
|
import getpass
|
||||||
|
|
||||||
############ Config ############
|
############ Config ############
|
||||||
KEYWORD = "winpe"
|
KEYWORD = "winpe"
|
||||||
|
@ -16,12 +17,16 @@ PYTHON = "python"
|
||||||
DISK = "{disk}"
|
DISK = "{disk}"
|
||||||
################################
|
################################
|
||||||
|
|
||||||
|
is_linux:bool = False
|
||||||
|
|
||||||
def find_disk():
|
def find_disk():
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
|
if getpass.getuser() != 'root':
|
||||||
|
raise OSError("Permission denied")
|
||||||
|
is_linux = True
|
||||||
mount_point = "/mnt/prinjector_mount_point"
|
mount_point = "/mnt/prinjector_mount_point"
|
||||||
print(
|
# print(
|
||||||
"Warning: Linux support is developing.Please umount {mount_point}")
|
# "Warning: Linux support is developing.Please umount {mount_point}")
|
||||||
if not os.path.exists(mount_point):
|
if not os.path.exists(mount_point):
|
||||||
os.mkdir(mount_point)
|
os.mkdir(mount_point)
|
||||||
elif len(os.listdir(mount_point)):
|
elif len(os.listdir(mount_point)):
|
||||||
|
@ -30,10 +35,9 @@ def find_disk():
|
||||||
i: int = 97
|
i: int = 97
|
||||||
while os.path.exists(f"/dev/sd{chr(i)}"):
|
while os.path.exists(f"/dev/sd{chr(i)}"):
|
||||||
j: int = 1
|
j: int = 1
|
||||||
this_disk = f"/dev/sd{chr(i)}{str(j)}"
|
while os.path.exists(f"/dev/sd{chr(i)}{str(j)}"):
|
||||||
while os.path.exists(this_disk):
|
|
||||||
os.system(
|
os.system(
|
||||||
f"mount /dev/sd{chr(i)}{str(j)} {mount_point} --mkdir")
|
f"mount /dev/sd{chr(i)}{str(j)} {mount_point}")
|
||||||
if os.path.exists(mount_point+"/ventoy/ventoy.json"):
|
if os.path.exists(mount_point+"/ventoy/ventoy.json"):
|
||||||
return mount_point
|
return mount_point
|
||||||
j += 1
|
j += 1
|
||||||
|
@ -151,5 +155,7 @@ for i in os.listdir("package"):
|
||||||
shutil.rmtree(DISK+"/PEinjector/package/"+i)
|
shutil.rmtree(DISK+"/PEinjector/package/"+i)
|
||||||
shutil.copytree("package/"+i, DISK+"/PEinjector/package/"+i)
|
shutil.copytree("package/"+i, DISK+"/PEinjector/package/"+i)
|
||||||
|
|
||||||
|
if is_linux:
|
||||||
|
os.system(f"umount {mount_point}")
|
||||||
|
|
||||||
print("All done.")
|
print("All done.")
|
||||||
|
|
Loading…
Reference in New Issue