forked from Naville/WTFJH
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplate.py
executable file
·40 lines (39 loc) · 1.14 KB
/
Template.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
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import string
import random
from os import listdir
ValidType=["SDK","API","Utils","ThirdPartyTools","Misc"]
xmString = ""
outPath = "./Hooks/"
if (len(sys.argv) < 2):
print "Template.py ModuleType ModuleName"
print "Valid ModuleType:"
for name in ValidType:
print name
sys.exit(-1)
if (sys.argv[1] not in ValidType):
print "Wrong argument #1"
print "Valid Arguments:"
for x in ValidType:
print x
sys.exit(-1)
else:
outPath = outPath + sys.argv[1]+"/" + sys.argv[2] + ".xm"
xmString += "#import \"../Global.h\"\n"
xmString += "%group " + sys.argv[2] + "\n"
xmString += " // Insert Your Hooks Here\n"
xmString += "%end\n"
xmString += "extern void init_"+sys.argv[2]+"_hook() {\n"
xmString += " %init("+sys.argv[2]+");\n"
xmString += "}\n"
if (os.path.isfile(outPath) == False):
os.system("echo \" \"> " + outPath)
fileHandle = open(outPath, "w")
fileHandle.write(xmString)
fileHandle.close()
print "Generated At" + outPath
else:
print "File already exists at " + outPath + "!\nFor safety reasons, generating has been cancelled.\nPlease manually remove that file."