├── batch.py
├── list.txt
├── manual-tools
├── decode.html
├── encode.html
└── template.html
├── readme.md
└── tool.py
/batch.py:
--------------------------------------------------------------------------------
1 | import sys, os, base64
2 | from urllib.parse import unquote
3 | from urllib.parse import quote
4 |
5 | usage = '''\nUsage: this.py [obf|deobf]\nHave a file called list.txt in your working directory,\nwhich lists your HTML files, separated by new lines.\n\nNOTE: Files deobfuscated with this tool MUST have been obfuscated with it as well.'''
6 |
7 | if len(sys.argv)!=2:
8 | print(usage)
9 | sys.exit(0)
10 |
11 | opr=sys.argv[1]
12 | lisfile = "list.txt"
13 | if not os.path.isfile(lisfile):
14 | print ('''\nCould not find list.txt!''')
15 | sys.exit(0)
16 |
17 | htlis = open(lisfile, mode="r", encoding="utf-8").read().splitlines()
18 | if htlis == []:
19 | print ('''\nList.txt is empty!''')
20 | sys.exit(0)
21 |
22 | begst = '''
23 |
28 |
29 | '''
30 |
31 | def dEncode(data):
32 | data = quote(data)
33 | data = data.encode("utf-8")
34 | data = base64.b64encode(data)
35 | data = data.decode("utf-8")
36 | return data
37 |
38 | def dDecode(data):
39 | data = data.encode("utf-8")
40 | data = base64.b64decode(data)
41 | data = data.decode("utf-8")
42 | data = unquote(data)
43 | return data
44 |
45 | if opr == "obf":
46 | for file in htlis:
47 | if not os.path.isfile(file):
48 | print('''Could not find %s!''' % file)
49 | continue
50 | data = open(file, mode="r", encoding="utf-8").read()
51 | open(file, mode="w", encoding="utf-8").write(begst + dEncode(data) + endst)
52 | print("Succesfully Obfuscated %s" % file)
53 |
54 | elif opr == "deobf":
55 | for file in htlis:
56 | if not os.path.isfile(file):
57 | print('''Could not find %s!''' % file)
58 | continue
59 | data = open(file, mode="r", encoding="utf-8").read()
60 | open(file, mode="w", encoding="utf-8").write(dDecode(data[88:-102]))
61 | print("Succesfully Deobfuscated %s" % file)
62 |
63 | else:
64 | print(usage)
65 | sys.exit(0)
66 |
--------------------------------------------------------------------------------
/list.txt:
--------------------------------------------------------------------------------
1 | example.html
2 | directory/example2.html
--------------------------------------------------------------------------------
/manual-tools/decode.html:
--------------------------------------------------------------------------------
1 |
2 | Decode
3 |
9 |
20 |
21 |
22 |
23 |
Output text here...
24 |
25 |
26 |
--------------------------------------------------------------------------------
/manual-tools/encode.html:
--------------------------------------------------------------------------------
1 |
2 | Encode
3 |
9 |
20 |
21 |
22 |
23 |
Output text here...
24 |
25 |
26 |
--------------------------------------------------------------------------------
/manual-tools/template.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # HTML Obfuscator
2 |
3 | Simple python tool to help you obfuscate/deobfuscate your HTML code quickly.
4 |
5 | Manual tools also included.
6 |
7 |
8 |
9 | One-at-a-time Usage:
10 | ```tool.py [obf|deobf] [filename.html]```
11 |
12 | Batch Usage:
13 | ```batch.py [obf|deobf]```
14 | For batch usage, one should have a list of html files in list.txt, separated by new lines.
15 |
16 |
17 |
18 | Also note that files deobfuscated with this tool MUST have been obfuscated with it as well.
--------------------------------------------------------------------------------
/tool.py:
--------------------------------------------------------------------------------
1 | import sys, os, base64
2 | from urllib.parse import unquote
3 | from urllib.parse import quote
4 |
5 | usage = '''\nUsage: this.py [obf|deobf] [filename.html]\n\nNOTE: Files deobfuscated with this tool MUST have been obfuscated with it as well.'''
6 |
7 | if len(sys.argv)!=3:
8 | print(usage)
9 | sys.exit(0)
10 | opr=sys.argv[1]
11 | file=sys.argv[2]
12 | if not os.path.isfile(file):
13 | print('''\nFile not found!''')
14 | sys.exit(0)
15 |
16 | begst = '''
17 |
22 |
23 | '''
24 |
25 | def dEncode(data):
26 | data = quote(data)
27 | data = data.encode("utf-8")
28 | data = base64.b64encode(data)
29 | data = data.decode("utf-8")
30 | return data
31 |
32 | def dDecode(data):
33 | data = data.encode("utf-8")
34 | data = base64.b64decode(data)
35 | data = data.decode("utf-8")
36 | data = unquote(data)
37 | return data
38 |
39 | if opr == "obf":
40 | data = open(file, mode="r", encoding="utf-8").read()
41 | open(file, mode="w", encoding="utf-8").write(begst + dEncode(data) + endst)
42 | print("\nSuccesfully Obfuscated %s" % file)
43 | elif opr == "deobf":
44 | data = open(file, mode="r", encoding="utf-8").read()
45 | open(file, mode="w", encoding="utf-8").write(dDecode(data[88:-102]))
46 | print("\nSuccesfully Deobfuscated %s" % file)
47 | else:
48 | print(usage)
49 | sys.exit(0)
50 |
--------------------------------------------------------------------------------