重命名hook并添加logo

This commit is contained in:
cxykevin 2024-02-10 12:52:37 +08:00
parent 79752cfa02
commit 97a591895c
4 changed files with 81 additions and 43 deletions

View File

@ -7,4 +7,5 @@
@REM
echo "PEinjector Start"
cd X:\PEinjector\src
X:\PEinjector\env\python X:\PEinjector\src\main.py
start /I /B /WAIT X:\PEinjector\env\python X:\PEinjector\src\main.py
start /I X:\PEinjector\tool\starthook.bat

View File

@ -1,42 +0,0 @@
#####################################
## PEinjector/hook ##
#####################################
# This moudle will wait PE loaded all
# things.
# load moudles
import sys
import os
import time
import pickle
try:
sys.path.append("X:\\PEinjector\\src")
sys.path.append("X:\\PEinjector\\tool")
os.chdir("X:\\PEinjector\\src")
except:
sys.path.append(".")
sys.path.append("..\\tool")
log = __import__("log")
config = __import__("config")
action = __import__("action")
utils = __import__("utils")
log.init()
log.info("hook start")
if len(sys.argv) != 2:
log.break_err("args error")
sys.exit(1)
# wait
time.sleep(10)
# load action list
log.info("load action \"onload\"")
with open(config.TEMP_DIR.replace("{TEMP}", os.environ["TEMP"])+"/"+sys.argv[1], "rb") as file:
lists = pickle.load(file)
alog = action.do_action(lists)
with open(config.ACTIONLOGPATH.replace("{DISK}", utils.find_disk()), "w") as file:
file.write(alog)
log.info("done")

76
src/hook.pyw Normal file
View File

@ -0,0 +1,76 @@
#####################################
## PEinjector/hook ##
#####################################
# This moudle will wait PE loaded all
# things.
# load moudles
import sys
import os
import time
import pickle
sys.path.append("X:\\PEinjector\\src")
sys.path.append("X:\\PEinjector\\tool")
try:
os.chdir("X:\\PEinjector\\src")
except:
sys.path.append(".")
sys.path.append("..\\tool")
sys.path.append("src")
sys.path.append("tool")
log = __import__("log")
config = __import__("config")
action = __import__("action")
utils = __import__("utils")
# logo
logo = """\033[1m\033[34m
___ _____ __ __
/ _ \\/ __(_)__ /_/__ ____/ /____ ____
/ ___/ _// / _ \\/ / -_) __/ __/ _ \\/ __/
/_/ /___/_/_//_/ /\\__/\\__/\\__/\\___/_/
|___/
_________________________________________
\033[0m\033[?25l"""
print(logo)
log.init()
log.info("hook start")
sys.stdout.write("\033[3A \033[37m")
for j in range(5):
for i in range(41):
sys.stdout.write(" "+"_"*(i+1)+"\n\033[1A")
time.sleep(0.02)
sys.stdout.write("\n\033[1A \033[34m")
for i in range(41):
sys.stdout.write(" "+"_"*(i+1)+"\n\033[1A")
time.sleep(0.02)
sys.stdout.write("\n\033[1A \033[37m")
sys.stdout.write("\033[0m\033[?25h\n\n\n")
sysdrive = "X:"
if not os.path.exists(sysdrive+"\\"):
sysdrive = "C:"
username = "Default"
for i in os.listdir(f"{sysdrive}\\Users"):
if i not in ("Default", "Default User", "Public", "All Users") and not os.path.isfile(f"{sysdrive}\\Users\\{i}"):
username = i
# wait
while 1:
time.sleep(1)
if os.path.exists(f"{sysdrive}\\Users\\{username}\\Desktop"):
break
# load action list
log.info("load action \"onload\"")
with open(config.TEMP_DIR.replace("{TEMP}", os.environ["TEMP"])+"/"+"PEinjector.tmp", "rb") as file:
lists = pickle.load(file)
alog = action.do_action(lists)
with open(config.ACTIONLOGPATH.replace("{DISK}", utils.find_disk()), "w") as file:
file.write(alog)
log.info("done")

3
tool/starthook.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
start /I /B /WAIT X:\PEinjector\env\python.exe X:\PEinjector\src\hook.pyw
exit