t.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import requests
  2. import re
  3. import base64
  4. from urllib import parse
  5. headers = {
  6. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
  7. ' (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36',
  8. }
  9. def get_script_data():
  10. response = requests.get('https://bulletin.cebpubservice.com/biddingBulletin/2020-09-04/3532001.html', headers=headers)
  11. print(response.text)
  12. arg1 = re.search("arg1='([^']+)'", response.text).group(1)
  13. # _0x4818 = re.search('_0x4818=(\[.*?\])', response.text).group(1)
  14. # # 转json时需要将单引号替换成双引号,要不然会出错json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
  15. # _0x4818 = json.loads(_0x4818.encode('latin-1').decode('unicode_escape').replace("'", '"'))
  16. return arg1
  17. # def rc4():
  18. # # base64解码,记得解码
  19. # _0x401af1 = base64.b64decode("wqhBH8Knw4TDhSDDgMOdwrjCncOWwphhN8KCGcKqw6dHAU5+wrg2JcKaw4IEJcOcwrRJwoZ0wqF9YgAV").decode()
  20. # _0x532ac0 = "jS1Y"
  21. # _0x45079a = [''] * 0x100
  22. # _0x52d57c = 0x0
  23. # _0x3fd789 = ''
  24. # _0x4a2aed = '%c2'
  25. # _0x124d17 = 0
  26. # _0x1b9115 = len(_0x401af1)
  27. # while(_0x124d17 < _0x1b9115):
  28. # _0x4a2aed += '\x25' + hex(ord(_0x401af1[_0x124d17]))[2:]
  29. # _0x124d17 += 1
  30. # _0x401af1 = parse.unquote(_0x4a2aed)
  31. # for _0x2d67ec in range(0, 0x100):
  32. # _0x45079a[_0x2d67ec] = _0x2d67ec
  33. #
  34. # for _0x2d67ec in range(0, 0x100):
  35. # _0x52d57c = (_0x52d57c + _0x45079a[_0x2d67ec] + ord(_0x532ac0[_0x2d67ec % len(_0x532ac0)])) % 0x100
  36. # _0x105f59 = _0x45079a[_0x2d67ec]
  37. # _0x45079a[_0x2d67ec] = _0x45079a[_0x52d57c]
  38. # _0x45079a[_0x52d57c] = _0x105f59
  39. #
  40. # _0x2d67ec = 0x0
  41. # _0x52d57c = 0x0
  42. #
  43. # for _0x4e5ce2 in range(0, len(_0x401af1)):
  44. # _0x2d67ec = (_0x2d67ec + 0x1) % 0x100
  45. # _0x52d57c = (_0x52d57c + _0x45079a[_0x2d67ec]) % 0x100
  46. # _0x105f59 = _0x45079a[_0x2d67ec]
  47. # _0x45079a[_0x2d67ec] = _0x45079a[_0x52d57c]
  48. # _0x45079a[_0x52d57c] = _0x105f59
  49. # _0x3fd789 += chr(ord(_0x401af1[_0x4e5ce2]) ^ _0x45079a[(_0x45079a[_0x2d67ec] + _0x45079a[_0x52d57c]) % 0x100])
  50. #
  51. # return _0x3fd789
  52. def hexXor(_0x4e08d8, _0x23a392):
  53. _0x5a5d3b = ''
  54. _0xe89588 = 0x0
  55. while _0xe89588 < len(_0x23a392) and _0xe89588 < len(_0x4e08d8):
  56. _0x401af1 = int(_0x23a392[_0xe89588: _0xe89588 + 0x2], 16)
  57. _0x105f59 = int(_0x4e08d8[_0xe89588: _0xe89588 + 0x2], 16)
  58. _0x189e2c = hex(_0x401af1 ^ _0x105f59)
  59. print("1:",_0x23a392[_0xe89588: _0xe89588 + 0x2])
  60. print("a",_0x401af1)
  61. print("b",_0x105f59)
  62. print("c",_0x189e2c)
  63. if len(_0x189e2c) == 0x1:
  64. _0x189e2c = '\x30' + _0x189e2c
  65. print("a-b",_0x189e2c,_0x189e2c)
  66. _0x5a5d3b += _0x189e2c[2:]
  67. _0xe89588 += 0x2
  68. return _0x5a5d3b
  69. def unsbox(arg):
  70. _0x4b082b = [0xf, 0x23, 0x1d, 0x18, 0x21, 0x10, 0x1, 0x26, 0xa, 0x9, 0x13, 0x1f, 0x28, 0x1b, 0x16, 0x17, 0x19, 0xd,
  71. 0x6, 0xb, 0x27, 0x12, 0x14, 0x8, 0xe, 0x15, 0x20, 0x1a, 0x2, 0x1e, 0x7, 0x4, 0x11, 0x5, 0x3, 0x1c,
  72. 0x22, 0x25, 0xc, 0x24]
  73. _0x4da0dc = [''] * 40
  74. _0x12605e = ''
  75. for _0x20a7bf in range(0, len(arg)):
  76. _0x385ee3 = arg[_0x20a7bf]
  77. for _0x217721 in range(0, len(_0x4b082b)):
  78. if _0x4b082b[_0x217721] == _0x20a7bf + 0x1:
  79. _0x4da0dc[_0x217721] = _0x385ee3
  80. _0x12605e = ''.join(_0x4da0dc)
  81. return _0x12605e
  82. if __name__ == '__main__':
  83. arg1 = get_script_data()
  84. key = '3000176000856006061501533003690027800375'
  85. print(arg1)
  86. _0x23a392 = unsbox(arg1)
  87. print("==",_0x23a392)
  88. arg2 = 'acw_sc__v2=' + hexXor(key, _0x23a392)
  89. print("=a",arg2)
  90. headers['Cookie'] = "5f5209e5a4e508cf886f0fa82cfe1ad5b1c7249c"
  91. response = requests.get('https://bulletin.cebpubservice.com/biddingBulletin/2020-09-04/3532001.html', headers=headers)
  92. # print(response.text)