Commit e4f58eaf authored by wang's avatar wang

1

parent a6d1fdca
import hashlib
import json
import platform
import random
import subprocess
import tempfile
import time
from pathlib import Path
import tempfile
import requests
import tls_client
from loguru import logger
......@@ -21,6 +20,10 @@ if platform.platform().startswith('mac'):
Path(log_dir).mkdir(exist_ok=True, parents=True)
Path(work_dir).mkdir(exist_ok=True, parents=True)
def md5(text):
m = hashlib.md5()
m.update(text.encode())
return m.hexdigest()
class Reese84ByPass(object):
_session = tls_client.Session('chrome_112')
......@@ -36,9 +39,10 @@ class Reese84ByPass(object):
Path(log_dir).joinpath(thread_name).mkdir(exist_ok=True, parents=True)
self.log = logger.bind(module_name=thread_name)
self.log.info(f'proxy:{proxy} target:{target}')
self._cache_md5 = ''
def start(self):
self._init()
# self._init()
self._repare_js()
self.__auth_token()
# self._test()
......@@ -69,14 +73,20 @@ class Reese84ByPass(object):
def _repare_js(self):
t1 = time.time()
r1 = self._session.get('https://beta.makeabooking.flyscoot.com/Two-discharted-Not-ere-int-when-is-are-Poss-A-Sa')
r1 = self._session.get(
'https://beta.makeabooking.flyscoot.com/Two-discharted-Not-ere-int-when-is-are-Poss-A-Sa')
self.log.log('REQU', f'JSURL: code:{r1.status_code} cost:{(time.time() - t1):.3f}s')
a, filename = tempfile.mkstemp()
cache_md5 = md5(r1.text)
if self._cache_md5 != cache_md5:
self._cache_md5 = cache_md5
self.log.log('VMJS', f'JS变化')
envCode = open(work_dir + 'src/run.js', 'r').read()
with open(work_dir + 'src/vm_env.js', 'w') as f:
f.write(envCode + r1.text)
t2 = time.time()
p = subprocess.Popen(['node', f'{work_dir}src/vm_env.js' ,filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
p = subprocess.Popen(['node', f'{work_dir}src/vm_env.js', filename], stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, err = p.communicate(timeout=10)
if p.returncode == 0:
......@@ -84,7 +94,7 @@ class Reese84ByPass(object):
else:
raise Exception("执行 JS 超时")
self.log.log('VMJS', f'执行JS: cost:{(time.time() - t2):.3f}s')
data = json.loads(open(filename,'r').read())
data = json.loads(open(filename, 'r').read())
# print(len(data['solution']['interrogation']['p']))
t3 = time.time()
......@@ -245,4 +255,5 @@ class Reese84ByPass(object):
if __name__ == '__main__':
# r = Reese84ByPass('https://www.flyscoot.com/', 'http://user-uni002-region-de:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600')
r = Reese84ByPass('https://www.flyscoot.com/', 'http://127.0.0.1:8890')
while True:
print(r.start())
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment