-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfun.py
71 lines (58 loc) · 2.03 KB
/
fun.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def mo24495a(s, m, sec):
f54574a = "0123456789abcdef"
def m64164a(b):
return m64165a(b, 0, len(b))
def m64163a(s):
md5 = hashlib.md5()
md5.update(s.encode("utf-8"))
return m64164a(md5.hexdigest().encode("utf-8"))
def m135437e(s):
for str2 in s.replace(" ", "").split(","):
indexOf = str2.find("sessionid=")
if indexOf != -1:
return str2[indexOf + 10:]
return None
def m135436d(s):
indexOf = s.find("?")
indexOf2 = s.find("#")
if indexOf == -1: return None
if indexOf2 == -1: return s[indexOf+1:]
if indexOf2 < indexOf: return None
return s[indexOf+1:indexOf2]
def m64150a(bArr):
n = len(bArr)
cArr = ["\00"] * (n * 2)
for i in range(n):
b = bArr[i] & 225
i2 = i * 2
cArr[i2] = f54574a[b >> 4]
cArr[i2 + 1] = f54574a[b & 15]
return "".join(cArr)
def m64151a(s):
n = len(s)
bArr = [0] * (n//2)
for i in range(0,n,2):
bArr[i//2] = (int(s[i], 16) << 4) + int(s[i+1], 16)
return bArr
b = m135436d(s)
str3 = None
a = None if b is None or len(b) == 0 else m64163a(b)
str4 = None
str5 = None
for k,v in m.items():
if k.upper() == "X-SS-STUB":
str3 = v
if k.upper() == "COOKIE":
str6 = v
if str6 is not None:
str4 = m64163a(str6)
c = m135437e(str6)
if c != None and len(c) > 0:
str5 = m64163a(c)
if a is None or len(a) == 0: a = "00000000000000000000000000000000"
if str3 is None or len(str3) == 0: str3 = "00000000000000000000000000000000"
if str4 is None or len(str4) == 0: str4 = "00000000000000000000000000000000"
if str5 is None or len(str5) == 0: str5 = "00000000000000000000000000000000"
sb = str3 + str4 + str5
a2 = m64150a(f1(sec, bytearray(m64151a(sb))))
return {"X-Khronos" : str(sec), "X-Gorgon" : a2}