-
Notifications
You must be signed in to change notification settings - Fork 0
/
x_bogus_x.py
147 lines (127 loc) · 5.1 KB
/
x_bogus_x.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
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
import hashlib
import time
#form: https://github.com/theheqiang/spider_reverse/
def decode(string):
_0x50ff23 = {
48: 0, 49: 1, 50: 2, 51: 3, 52: 4, 53: 5,
54: 6, 55: 7, 56: 8, 57: 9, 97: 10, 98: 11,
99: 12, 100: 13, 101: 14, 102: 15
}
arr = []
for i in range(0, 32, 2):
arr.append(_0x50ff23[ord(string[i])] << 4 | _0x50ff23[ord(string[i + 1])])
return arr
def md5_arry(arry):
m = hashlib.md5()
m.update(bytearray(arry))
return m.hexdigest()
def md5_string(s):
m = hashlib.md5()
m.update(s.encode())
return m.hexdigest()
def encodeWithKey(key, data):
result = [None] * 256
temp = 0
output = ""
for i in range(256):
result[i] = i
for i in range(256):
temp = (temp + result[i] + key[i % len(key)]) % 256
temp1 = result[i]
result[i] = result[temp]
result[temp] = temp1
temp2 = 0
temp = 0
for i in range(len(data)):
temp2 = (temp2 + 1) % 256
temp = (temp + result[temp2]) % 256
temp1 = result[temp2]
result[temp2] = result[temp]
result[temp] = temp1
output += chr(ord(data[i]) ^ result[(result[temp2] + result[temp]) % 256])
return output
def b64_encode(string, key_table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="):
last_list = list()
for i in range(0, len(string), 3):
try:
num_1 = ord(string[i])
num_2 = ord(string[i + 1])
num_3 = ord(string[i + 2])
arr_1 = num_1 >> 2
arr_2 = ((3 & num_1) << 4 | (num_2 >> 4))
arr_3 = ((15 & num_2) << 2) | (num_3 >> 6)
arr_4 = 63 & num_3
except IndexError:
arr_1 = num_1 >> 2
arr_2 = ((3 & num_1) << 4) | 0
arr_3 = 64
arr_4 = 64
last_list.append(arr_1)
last_list.append(arr_2)
last_list.append(arr_3)
last_list.append(arr_4)
return "".join([key_table[value] for value in last_list])
def cal_num_list(_num_list):
new_num_list = []
for x in [3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 4, 6, 8, 10, 12, 14, 16, 18, 20]:
new_num_list.append(_num_list[x - 1])
return new_num_list
def _0x22a2b6(_0x59d7ab, _0x151cde, _0x1e0c94, _0x54aa83, _0x76d8ab, _0x550bdb, _0xb90041, _0x44b16d, _0x28659f,
_0x252c2c, _0x365218, _0x48af11, _0x25e3db, _0x34084f, _0x4f0729, _0x46a34c, _0x1f67f1, _0x5cd529,
_0x53097b):
_0xa0a6ac = [0] * 19
_0xa0a6ac[-0x1 * -0x2192 + 0x11b * 0x5 + -0x2719 * 0x1] = _0x59d7ab
_0xa0a6ac[0x4a * 0x3 + -0x6d * 0xb + -0x1e9 * -0x2] = _0x365218
_0xa0a6ac[-0x59f * -0x3 + -0x46c * -0x4 + -0x228b] = _0x151cde
_0xa0a6ac[0x11a1 + 0xf3d * -0x1 + 0x3 * -0xcb] = _0x48af11
_0xa0a6ac[-0x1 * -0xa37 + 0x13 * 0x173 + -0x25bc] = _0x1e0c94
_0xa0a6ac[-0x4 * -0x59f + -0x669 * 0x4 + 0x32d] = _0x25e3db
_0xa0a6ac[-0x1b42 + 0x10 * -0x24 + 0x1d88] = _0x54aa83
_0xa0a6ac[0x2245 + 0x335 * 0x6 + -0x357c] = _0x34084f
_0xa0a6ac[0x3fb + 0x18e1 + -0x1cd4] = _0x76d8ab
_0xa0a6ac[0x3 * 0x7a + 0x1 * 0x53f + 0x154 * -0x5] = _0x4f0729
_0xa0a6ac[0x25a * -0x9 + 0x11f6 + 0xa6 * 0x5] = _0x550bdb
_0xa0a6ac[-0x1b * -0x147 + -0x21e9 * -0x1 + 0x445b * -0x1] = _0x46a34c
_0xa0a6ac[-0x2f * 0xaf + 0x22f0 + -0x2c3] = _0xb90041
_0xa0a6ac[0x2f * 0x16 + 0x17 * 0x19 + -0x63c] = _0x1f67f1
_0xa0a6ac[-0x46a * 0x1 + 0xb * -0x97 + 0xaf5] = _0x44b16d
_0xa0a6ac[0x47 * 0x4f + -0x8cb * -0x4 + -0x3906] = _0x5cd529
_0xa0a6ac[-0x7 * 0x40e + 0xb8b + 0x10e7] = _0x28659f
_0xa0a6ac[0x6f9 + 0x196b + 0x5 * -0x677] = _0x53097b
_0xa0a6ac[-0xa78 + 0x1b89 + 0xe5 * -0x13] = _0x252c2c
return ''.join([chr(x) for x in _0xa0a6ac])
def _0x263a8b(_0x2a0483):
return "\u0002" + "ÿ" + _0x2a0483
def get_x_bogus(params, data, user_agent):
s0 = md5_string(data)
s1 = md5_string(params)
s0_1 = md5_arry(decode(s0))
s1_1 = md5_arry(decode(s1))
d = encodeWithKey([0, 1, 12], user_agent)
ua_str = b64_encode(d)
ua_str_md5 = md5_string(ua_str)
timestamp = int(time.time())
canvas = 536919696
salt_list = [timestamp, canvas, 64, 0, 1, 12, decode(s1_1)[-2], decode(s1_1)[-1], decode(s0_1)[-2],
decode(s0_1)[-1], decode(ua_str_md5)[-2], decode(ua_str_md5)[-1]]
for x in [24, 16, 8, 0]:
salt_list.append(salt_list[0] >> x & 255)
for x in [24, 16, 8, 0]:
salt_list.append(salt_list[1] >> x & 255)
_tem = 64
for x in salt_list[3:]:
_tem = _tem ^ x
salt_list.append(_tem)
salt_list.append(255)
num_list = cal_num_list(salt_list)
short_str_2 = encodeWithKey([255], _0x22a2b6(*num_list))
short_str_3 = _0x263a8b(short_str_2)
x_b = b64_encode(short_str_3, "Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe")
return x_b
if __name__ == '__main__':
# DFSzswVYQDaDIacCtchfme9WX7rh
print(get_x_bogus(
"msToken=",
'{"keyword_list":["口红"],"start_date":"20220529","end_date":"20220629","app_name":"aweme"}',
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
))