Commit 8269e494 authored by wangmingming's avatar wangmingming

请求造纸

parent 251e271d
......@@ -14,13 +14,12 @@ from pymongo import MongoClient
from loguru import logger
def md5(text):
m = hashlib.md5()
m.update(text.encode())
return m.hexdigest()
# 连接MongoDB数据库
client = MongoClient('mongodb://lcc-spider:JIUsfhiad&^@18.144.59.80:27017/?authSource=admin&directConnection=true')
db = client.env
......@@ -28,7 +27,7 @@ db = client.env
if platform.uname().system != 'Darwin':
# , 'success': {'$gte': 30}
# , 'env.navigatorparams.useragent': {'$regex': 'iPhone'}}
result = db.env_shape.find({'env.funcs' :{'$ne': None}})
result = db.env_shape.find({'env.funcs': {'$ne': None}})
data = {str(x['_id']): x['env'] for x in result}
print(result)
with open('env.json', 'w', encoding='utf-8') as f:
......@@ -53,11 +52,11 @@ headers = {
}
# tlss = [ 'chrome_103', 'chrome_104', 'chrome_105', 'chrome_106',
# 'firefox_102', 'firefox_104'
# Opera --> opera_89, opera_90
# 'safari_15_3', 'safari_15_6_1', 'safari_16_0',
# 'safari_ios_15_5', 'safari_ios_15_6', 'safari_ios_16_0',
# 'safari_ios_15_6'
# ]
# Opera --> opera_89, opera_90
# 'safari_15_3', 'safari_15_6_1', 'safari_16_0',
# 'safari_ios_15_5', 'safari_ios_15_6', 'safari_ios_16_0',
# 'safari_ios_15_6'
# ]
success = 0
total = 0
......@@ -78,8 +77,11 @@ while True:
try:
# selectId = '55a8fe24a752595e774341d6'
proxy = f'http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:{int(random.randint(10000, 11149))}'
proxy = random.choice(['http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:9000', proxy])
proxy = requests.post('http://ymx-lcc.unififi.com/proxy/get-proxy', json={'name':"B6", 'type':'shopping'}).json()['url']
proxy = random.choice(
['http://unfflcc:76cc14-47b8dd-1f8ace-827836-0c740e@usa.rotating.proxyrack.net:9000', proxy])
proxy = \
requests.post('http://ymx-lcc.unififi.com/proxy/get-proxy', json={'name': "B6", 'type': 'shopping'}).json()[
'url']
# proxy = f'http://ynfflcc2023.hotmail.com:gdcfh9@69.30.227.194:{random.randint(20001, 20250)}'
# proxy = f'http://user-uni003-region-us-sessid-${random.randint(1000,5000)}-sesstime-5-keep-true:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600'
......@@ -98,11 +100,10 @@ while True:
'https': 'http://127.0.0.1:7890',
}
selectId = random.choice(list(envs))
# selectId = 'a74b38e7115cf4d1b1f6976c'
if usedTime > 5:
if usedTime > 5:
c = session.get('https://www.jetblue.com/js/src/jb-74873.js', insecure_skip_verify=True).text
m5 = md5(c)
if m5 != lastHash:
......@@ -117,33 +118,36 @@ while True:
code = open('src.js', 'r', encoding='utf-8').read()
with open('src_run1.js', 'w', encoding='utf-8') as f:
f.write(code + '\n\n' + c
# +
# ';;;\n\n' + '''
# if (randomEvent){
# window.mouse_move(startx,starty,endx,endy)
#
# }
#
# var xhr = new XMLHttpRequest();
# xhr.open('POST', "https://jbrest.jetblue.com/lfs-rwb/outboundLFS", false);
# xhr.send(`{\"tripType\":\"oneWay\",\"from\":\"ZLA\",\"to\":\"NAS\",\"depart\":\"2023-04-11\",\"cabin\":\"economy\",\"refundable\":false,\"dates\":{\"before\":\"3\",\"after\":\"3\"},\"pax\":{\"ADT\":1,\"CHD\":0,\"INF\":0,\"UNN\":0},\"redempoint\":false,\"pointsBreakup\":{\"option\":\"\",\"value\":0},\"isMultiCity\":false}`)
# xhr.setRequestHeader('user-agent', ENV.navigatorparams.useragent)
# print(JSON.stringify(xhr.headers))
# _process.exit(0)
# '''
# +
# ';;;\n\n' + '''
# if (randomEvent){
# window.mouse_move(startx,starty,endx,endy)
#
# }
#
# var xhr = new XMLHttpRequest();
# xhr.open('POST', "https://jbrest.jetblue.com/lfs-rwb/outboundLFS", false);
# xhr.send(`{\"tripType\":\"oneWay\",\"from\":\"ZLA\",\"to\":\"NAS\",\"depart\":\"2023-04-11\",\"cabin\":\"economy\",\"refundable\":false,\"dates\":{\"before\":\"3\",\"after\":\"3\"},\"pax\":{\"ADT\":1,\"CHD\":0,\"INF\":0,\"UNN\":0},\"redempoint\":false,\"pointsBreakup\":{\"option\":\"\",\"value\":0},\"isMultiCity\":false}`)
# xhr.setRequestHeader('user-agent', ENV.navigatorparams.useragent)
# print(JSON.stringify(xhr.headers))
# _process.exit(0)
# '''
)
code1 = open('js_dom_run.js','r').read()
code1 = open('js_dom_run.js', 'r').read()
with open('js_dom_run1.js', 'w', encoding='utf-8') as f:
f.write(code1 + '\n\n' + c)
t1 = time.time()
token = list(db.token_shape.aggregate( [ {'$match': {'update_time':{'$gte': int(time.time() * 1000) - 60*60*12}}}, { '$sample': { 'size': 1 } } ] ))[0]['_id']
token = list(db.token_shape.aggregate(
[{'$match': {'update_time': {'$gte': int(time.time() * 1000) - 60 * 60 * 12}}},
{'$sample': {'size': 1}}]))[0]['_id']
# token = '11'
# r = requests.get('http://127.0.0.1:5000/getinfo').json()['message']
# r = requests.get('http://127.0.0.1:3001').json()
p = subprocess.Popen(['node', 'js_dom_run1.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_chrome_105.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_company_chrome.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run1.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
p = subprocess.Popen(['node', 'js_dom_run1.js', selectId, '11'], stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_chrome_105.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_company_chrome.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run1.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
output, err = p.communicate(timeout=10)
tmp = ''
......@@ -160,7 +164,8 @@ while True:
headers.update(r)
# headers = r
logger.info(f"success:{success} total:{total} {(time.time() - t1) *1000:.3f}ms {len(headers['X-1ItxWO9i-a'.lower()])} {selectId} {headers['user-agent']}")
logger.info(
f"success:{success} total:{total} {(time.time() - t1) * 1000:.3f}ms {len(headers['X-1ItxWO9i-a'.lower()])} {selectId} {headers['user-agent']}")
logger.info(f"success:{success} proxy: {proxy} token: {token}")
url = "https://jbrest.jetblue.com/lfs-rwb/outboundLFS"
......
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