forked from Naitik1208/JF-ROUTER
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyguesser.py
More file actions
175 lines (67 loc) · 3.85 KB
/
keyguesser.py
File metadata and controls
175 lines (67 loc) · 3.85 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env python
# This is only for educational purposes. No one is responsible for any type of damage.
__author__ = "itsyourap"
__url__ = "https://github.com/JFC-Group/JF-Customisation"
"""
This script tries to guess and identify the encryption key used to encrypt
the JioFiber config file downloaded from the router's admin page
Works for newer firmwares like R2.49 for JCOW414
Modify this script variables accordingly before using this script
Remember to run this script from the same directory where your downloaded
encrypted config file is stored
Usage: keyguesser.py
"""
from itertools import permutations
import subprocess
#############################################################################################################
# Modify these variables accordingly before using this script #
#############################################################################################################
inFileName = "RSXXXXXXXXXXX_JCOW414.enc" # Full name of the encrypted config backup file #
outFileName = "RSXXXXXXXXXXX_JCOW414.txt" # Name of output file if the decryption is successful #
routerSerial = "RSXXXXXXXXXXX" # Your Router's Serial Number #
routerSsid = "XXXXX" # Default Router SSID without the 'JioFiber-' prefix #
#############################################################################################################
#############################################################################################################
# All of the above information might be found written on the back of the router box. #
# The router SSID does NOT mean the current SSID of your router #
# The router SSID is the DEFAULT SSID of your router, e.g., "JioFiber-Alpha" #
# You have to just take the "Alpha" part in the above routerSsid variable #
#############################################################################################################
def tryToDecrypt(hexKey):
p = subprocess.Popen(["openssl", "aes-128-cbc", "-d", "-pass", "pass:{}".format(hexKey),
"-in", inFileName, "-out", outFileName], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output, error = p.communicate()
output = output.decode()
returnCode = p.returncode
if (returnCode == 0):
print("Success : {}".format(hexKey))
exit()
else:
print("Failed!")
print()
def tryKey(key):
p = subprocess.Popen(["openssl", 'enc', "-aes-128-cbc", "-k", key,
"-P", "-nosalt"], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output, error = p.communicate()
output = output.decode()
startIndex = output.find("key=") + len("key=")
endIndex = output.find("\n", startIndex)
hexKey = output[startIndex:endIndex]
print("Trying Key : {}".format(key))
tryToDecrypt(hexKey)
keyStrings = ["1n0NaZQnC9oxcfwf", "us4AQiJAgbj0Fmxq", "NTqK8Ps5iFke8zrp", "bfqerloC15y79WQZ",
"9gNzEbuDjtyT9Pyc", "uuphsZuO92AZW5GJ", "qdySWmmvYKdBcO53", "Q7ODauKsxUAUtbR7",
"Kohgiem4joochei3", "6f1D27JyLm70GUUu", "zuFbKywMhJjVEhk3", "6uMrt5ricsD1ABDh",
"iPjZ8bYm6s3uGYVf", "QGwaPHx2K1rNDTmL", "fJ7OeRF2TvqKdR30"]
def useCombination(keyIndex):
x = [routerSerial, keyStrings[keyIndex], routerSsid]
perms = []
for i in range(1, len(x)+1):
for c in permutations(x, i):
perms.append("".join(c))
for i in range(0, len(perms)):
raw = perms[i]
tryKey(raw)
if (__name__ == "__main__"):
for i in range(0, len(keyStrings)):
useCombination(i)