-
Notifications
You must be signed in to change notification settings - Fork 1
/
ezlib2proc.py
51 lines (47 loc) · 1.49 KB
/
ezlib2proc.py
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 os
class Runner:
def __init__(self):
self.running = False
if os.path.exists(os.path.realpath('./lib2proc')) and os.path.exists(os.path.realpath('./lib2proc.dylib')):
pass
else:
print("Error! Can't Find the lib2proc binary... Is it in this folder?")
runner = Runner()
pid = input("Enter PID to Target: ")
dll_path = os.path.realpath(input("Enter Path To Library to Inject: "))
mono = int(input("Mono? (0 = No; 1 = Yes): "))
if mono == 1:
mono_ns = input("Namespace: ")
mono_module = input("Class: ")
mono_func = input("Load Method: ")
mono_unload_func = input("Unload Method: ")
else:
mono_ns = ""
mono_module = ""
mono_func = ""
mono_unload_func = ""
query = "./lib2proc {} {}".format(pid, dll_path)
if mono:
query += " --mono " + ".".join([mono_ns, mono_module, mono_func])
x = os.system(query)
if x != 0:
exit()
runner.running = True
print("\nType Unload to Unload Library, Load to Reload the Library (May Crash Game), or Quit to Exit\n")
uquery = "./lib2proc {} {}".format(pid, dll_path)
if mono:
uquery += " --mono " + ".".join([mono_ns, mono_module, mono_unload_func])
while True:
cmd = input(">")
if unload.lower() == "unload":
if runner.running:
os.system(uquery)
runner.running = False
if cmd.lower() == "load":
if runner.running:
os.system(uquery)
runner.running = False
os.system(query)
if cmd.lower() == "quit":
runner.running = False
exit()