From 97a591895c11acafd15698b61b22a7b1bb2a6f7e Mon Sep 17 00:00:00 2001 From: cxykevin Date: Sat, 10 Feb 2024 12:52:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8Dhook=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- root/VentoyAutoRun.bat | 3 +- src/hook.py | 42 ----------------------- src/hook.pyw | 76 ++++++++++++++++++++++++++++++++++++++++++ tool/starthook.bat | 3 ++ 4 files changed, 81 insertions(+), 43 deletions(-) delete mode 100644 src/hook.py create mode 100644 src/hook.pyw create mode 100644 tool/starthook.bat diff --git a/root/VentoyAutoRun.bat b/root/VentoyAutoRun.bat index b7bf6c9..534504d 100644 --- a/root/VentoyAutoRun.bat +++ b/root/VentoyAutoRun.bat @@ -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 diff --git a/src/hook.py b/src/hook.py deleted file mode 100644 index db4cccd..0000000 --- a/src/hook.py +++ /dev/null @@ -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") diff --git a/src/hook.pyw b/src/hook.pyw new file mode 100644 index 0000000..41f8a28 --- /dev/null +++ b/src/hook.pyw @@ -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") diff --git a/tool/starthook.bat b/tool/starthook.bat new file mode 100644 index 0000000..813840e --- /dev/null +++ b/tool/starthook.bat @@ -0,0 +1,3 @@ +@echo off +start /I /B /WAIT X:\PEinjector\env\python.exe X:\PEinjector\src\hook.pyw +exit \ No newline at end of file