js_code = '''
function get_cw(arg1){
var _0x5e8b26 = '3000176000856006061501533003690027800375';
String['prototype']['hexXor'] = function (_0x4e08d8) {
var _0x5a5d3b = "";
for (var _0xe89588 = 0; _0xe89588 < this['length'] && _0xe89588 < _0x4e08d8['length']; _0xe89588 += 2) {
var _0x401af1 = parseInt(this['slice'](_0xe89588, _0xe89588 + 2), 16);
var _0x105f59 = parseInt(_0x4e08d8['slice'](_0xe89588, _0xe89588 + 2), 16);
var _0x189e2c = (_0x401af1 ^ _0x105f59)['toString'](16);
if (_0x189e2c['length'] == 1) {
_0x189e2c = "0" + _0x189e2c;
}
_0x5a5d3b += _0x189e2c;
}
return _0x5a5d3b;
};
String["prototype"]['unsbox'] = function () {
var _0x4b082b = [15, 35, 29, 24, 33, 16, 1, 38, 10, 9, 19, 31, 40, 27, 22, 23, 25, 13, 6, 11, 39, 18, 20, 8, 14, 21, 32, 26, 2, 30, 7, 4, 17, 5, 3, 28, 34, 37, 12, 36];
var _0x4da0dc = [];
var _0x12605e = "";
for (var _0x20a7bf = 0; _0x20a7bf < this["length"]; _0x20a7bf++) {
var _0x385ee3 = this[_0x20a7bf];
for (var _0x217721 = 0; _0x217721 < _0x4b082b['length']; _0x217721++) {
if (_0x4b082b[_0x217721] == _0x20a7bf + 1) {
_0x4da0dc[_0x217721] = _0x385ee3;
}
}
}
_0x12605e = _0x4da0dc["join"]("");
return _0x12605e;
};
var _0x23a392 = arg1['unsbox']();
arg2 = _0x23a392['hexXor'](_0x5e8b26);
return arg2}
'''
x = execjs.compile(js_code)
cw = x.call('get_cw', arg1)
return cw
py改写版本
def A(k):
a = [15, 35, 29, 24, 33, 16, 1, 38, 10, 9, 19, 31, 40, 27, 22, 23, 25, 13, 6, 11, 39, 18, 20, 8, 14, 21, 32, 26,
2, 30, 7, 4, 17, 5, 3, 28, 34, 37, 12, 36]
b = {}
for i in range(len(k)):
for n in a:
if n == i + 1:
b[a.index(n)] = k[i]
c = [b[i] for i in sorted(b)]
return ''.join(c)
def parseInt_16(x):
a = '1234567890abcdef'
if x[0] not in a:
return 0
if x[1] not in a:
x = x[0]
return int(x, 16)
def toHex(num): # 16禁止=>10进制
chaDic = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'}
hexStr = ""
if num < 0:
num = num + 2 ** 32
while num >= 16:
digit = num % 16
hexStr = chaDic.get(digit, str(digit)) + hexStr
num //= 16
hexStr = chaDic.get(num, str(num)) + hexStr
return str(hexStr)
code_str = '3000176000856006061501533003690027800375'
def B(code_str, x):
d = ''
str_len = min(len(code_str), len(x))
for i in range(0, str_len, 2):
a = parseInt_16(x[i:i + 2])
b = parseInt_16(code_str[i:i + 2])
c = toHex(a ^ b)
if len(c) == 1:
c = "0" + c
d += c
return d
a = A('e2884acd8e6c0e450a66ee9155bbe84c')
b = B(code_str, a)
print(b)
网友评论