Commit d3b17b8b authored by wang's avatar wang

收集更多信息

parent a58b8493
import platform import platform
import random import random
import re
import subprocess import subprocess
import time import time
...@@ -23,7 +24,6 @@ def md5(text): ...@@ -23,7 +24,6 @@ def md5(text):
# 连接MongoDB数据库 # 连接MongoDB数据库
client = MongoClient('mongodb://lcc-spider:JIUsfhiad&^@18.144.59.80:27017/?authSource=admin&directConnection=true') client = MongoClient('mongodb://lcc-spider:JIUsfhiad&^@18.144.59.80:27017/?authSource=admin&directConnection=true')
db = client.env db = client.env
# 查询所有文档 # 查询所有文档
# 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} # data = {str(x['_id']): x['env'] for x in result}
...@@ -85,6 +85,11 @@ for i in range(100): ...@@ -85,6 +85,11 @@ for i in range(100):
lastHash = m5 lastHash = m5
usedTime = 0 usedTime = 0
logger.debug('js变化') logger.debug('js变化')
token = re.findall('nt"\),\["(.+?)",', c)[0]
db.token_shape.insert_one({
'_id': token,
'update_time': int(time.time() * 1000)
})
code = open('src.js', 'r', encoding='utf-8').read() code = open('src.js', 'r', encoding='utf-8').read()
code1 = open('js_dom_run.js', 'r', encoding='utf-8').read() code1 = open('js_dom_run.js', 'r', encoding='utf-8').read()
with open('src_run1.js', 'w', encoding='utf-8') as f: with open('src_run1.js', 'w', encoding='utf-8') as f:
...@@ -97,7 +102,9 @@ for i in range(100): ...@@ -97,7 +102,9 @@ for i in range(100):
# p = subprocess.Popen(['node', 'js_dom_run.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, # p = subprocess.Popen(['node', 'js_dom_run.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_chrome_105.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, # p = subprocess.Popen(['node', 'src_run_chrome_105.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_company_chrome.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, # p = subprocess.Popen(['node', 'src_run_company_chrome.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
p = subprocess.Popen(['node', 'src_run1.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, token = list(db.token_shape.aggregate( [ { '$sample': { 'size': 1 } } ] ))[0]['_id']
p = subprocess.Popen(['node', 'src_run1.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
output, err = p.communicate(timeout=10) output, err = p.communicate(timeout=10)
tmp = '' tmp = ''
......
No preview for this file type
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