-
Notifications
You must be signed in to change notification settings - Fork 2
/
free_stacheltier.py
57 lines (49 loc) · 1.59 KB
/
free_stacheltier.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
52
53
54
55
56
57
import struct
from Crypto.Cipher import DES
def key_to_bytes(key):
tk_sub=key.split('-',3)
tk_bytes='{:04x}{:04x}{:04x}{:04x}'.format(int(tk_sub[0]),int(tk_sub[1]),int(tk_sub[2]),int(tk_sub[3]))
ba = bytearray.fromhex(tk_bytes)
ba[0],ba[1] = ba[1],ba[0]
ba[2],ba[3] = ba[3],ba[2]
ba[4],ba[5] = ba[5],ba[4]
ba[6],ba[7] = ba[7],ba[6]
return ba
def bytes_to_key(bytes):
ba = bytearray(bytes)
ba[0],ba[1] = ba[1],ba[0]
ba[2],ba[3] = ba[3],ba[2]
ba[4],ba[5] = ba[5],ba[4]
ba[6],ba[7] = ba[7],ba[6]
i1 = struct.unpack('>H', ba[0:2])
i2 = struct.unpack('>H', ba[2:4])
i3 = struct.unpack('>H', ba[4:6])
i4 = struct.unpack('>H', ba[6:8])
tk_sub='{}-{}-{}-{}'.format(i1[0],i2[0],i3[0],i4[0])
return tk_sub
tk='#'
print("welcome to free_stacheltier.py")
print("enter your igel terminal key below.")
print("just press enter to exit")
print("")
while tk != '':
tk = str(input('terminal key:'))
if tk == '':
break
b = key_to_bytes(tk)
key3 = b'\x34\x49\xd6\xa9\xc7\x55\x67\x28'
key2 = b'\x56\x59\x12\x95\x89\xaa\x76\x33'
key1 = b'\x72\x02\x53\xb6\x77\x79\xad\x96'
iv3 = b'\xF4\x41\x71\x68\x37\x73\xB1\x02'
iv2 = b'\xC1\x92\x88\x48\x49\x05\x11\x19'
iv1 = b'\x3B\x52\x7F\x6E\x97\xF8\xAA\x16'
d1 = DES.new(key1,DES.MODE_CBC,iv1)
d2 = DES.new(key2,DES.MODE_CBC,iv2)
d3 = DES.new(key3,DES.MODE_CBC,iv3)
t1 = d1.encrypt(b[0:8])
t2 = d2.decrypt(t1[0:8])
t3 = d3.encrypt(t2[0:8])
print("Congratulations!")
print("your reset key:")
print((bytes_to_key(bytearray(t3))))
print("")