mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-06-27 02:15:07 +08:00
Compare commits
No commits in common. "9b406d6697974cbce87d13fc439b27137edac45c" and "bb995be6f635b17b9dd6376c1facf74bfcafde8b" have entirely different histories.
9b406d6697
...
bb995be6f6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
jd_10dou.js
12
jd_10dou.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15
jd_daycj.js
15
jd_daycj.js
File diff suppressed because one or more lines are too long
11
jd_dayf.js
11
jd_dayf.js
File diff suppressed because one or more lines are too long
14
jd_dayf2.js
14
jd_dayf2.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
17
jd_red618.js
17
jd_red618.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
jd_tjfb.js
18
jd_tjfb.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
96
jd_wsck.py
96
jd_wsck.py
@ -42,29 +42,8 @@ def randomuserAgent():
|
||||
|
||||
|
||||
def get_proxy_api(proxy_url, max_retries=5, timeout=60, retry_delay=1):
|
||||
session = requests.Session()
|
||||
for retry in range(max_retries):
|
||||
if '@' in proxy_url:
|
||||
# 解析认证信息
|
||||
auth_part, url_part = proxy_url.split('@')
|
||||
protocol = auth_part.split('://')[0]
|
||||
auth_part = auth_part.split('://')[1]
|
||||
host = url_part
|
||||
|
||||
# 处理只有 token 的情况
|
||||
if ':' in auth_part:
|
||||
username, password = auth_part.split(':')
|
||||
session.auth = (username, password)
|
||||
else:
|
||||
# 只有 token 的情况,需要 base64 编码
|
||||
token = auth_part
|
||||
token_b64 = base64.b64encode(token.encode()).decode()
|
||||
session.headers.update({'Authorization': f'Basic {token_b64}'})
|
||||
|
||||
res = session.get(f"{protocol}://{host}", verify=False, timeout=timeout)
|
||||
else:
|
||||
res = session.get(proxy_url, verify=False, timeout=timeout)
|
||||
|
||||
res = get(url=proxy_url)
|
||||
printf(f"本次获取到的代理:{res.text}")
|
||||
proxy_ip_port = res.text.strip()
|
||||
proxy_address = f"http://{proxy_ip_port}"
|
||||
@ -263,7 +242,7 @@ def get_sign_diy(pin):
|
||||
|
||||
def getcookie_wskey(key):
|
||||
proxys = proxy_url
|
||||
if os.environ.get("DY_PROXY") is not None:
|
||||
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||
proxys = get_proxy_api(proxy_url)
|
||||
|
||||
body = "body=%7B%22to%22%3A%22https%3A//plogin.m.jd.com/jd-mlogin/static/html/appjmp_blank.html%22%7D"
|
||||
@ -291,7 +270,7 @@ def getcookie_wskey(key):
|
||||
printf(f"【错误】{unquote(pin)}在获取token时:\n{error}")
|
||||
return pin, "False"
|
||||
randomuserAgent()
|
||||
if os.environ.get("DY_PROXY") is not None:
|
||||
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||
proxys = get_proxy_api(proxy_url)
|
||||
continue
|
||||
|
||||
@ -301,7 +280,7 @@ def getcookie_wskey(key):
|
||||
printf(f"【警告】{unquote(pin)}在获取token时失败,等待5秒后重试")
|
||||
time.sleep(5)
|
||||
randomuserAgent()
|
||||
if os.environ.get("DY_PROXY") is not None:
|
||||
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||
proxys = get_proxy_api(proxy_url)
|
||||
|
||||
if token=="xxx":
|
||||
@ -328,7 +307,7 @@ def getcookie_wskey(key):
|
||||
printf(f"【错误】{unquote(pin)}在获取cookie时:\n{error}")
|
||||
return "Error"
|
||||
randomuserAgent()
|
||||
if os.environ.get("DY_PROXY") is not None:
|
||||
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||
proxys = get_proxy_api(proxy_url)
|
||||
continue
|
||||
|
||||
@ -445,40 +424,34 @@ def getRemark(pt_pin,token):
|
||||
|
||||
return strreturn
|
||||
|
||||
def get_latest_file(files):
|
||||
latest_file = None
|
||||
latest_mtime = 0
|
||||
for file in files:
|
||||
try:
|
||||
stats = os.stat(file)
|
||||
mtime = stats.st_mtime
|
||||
if mtime > latest_mtime:
|
||||
latest_mtime = mtime
|
||||
latest_file = file
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
return latest_file
|
||||
|
||||
def main():
|
||||
printf("版本: 20230602")
|
||||
printf("说明: 如果用Wxpusher通知需配置WP_APP_TOKEN_ONE和WP_APP_MAIN_UID,其中WP_APP_MAIN_UID是你的Wxpusher UID")
|
||||
printf("隧道型代理池接口:export WSKEY_PROXY_TUNNRL='http://127.0.0.1:123456'")
|
||||
printf("拉取型代理API接口(数据格式:txt;提取数量:每次一个):export DY_PROXY='http://xxx.com/apiUrl'")
|
||||
printf("拉取型代理API接口(数据格式:txt;提取数量:每次一个):export WSKEY_PROXY_URL='http://xxx.com/apiUrl'")
|
||||
printf("没有代理可以自行注册,比如携趣,巨量,每日免费1000IP,完全够用")
|
||||
printf("====================================")
|
||||
config=""
|
||||
envtype=""
|
||||
global proxy_url
|
||||
proxy_url=os.environ.get("DY_PROXY") or os.environ.get("WSKEY_PROXY_TUNNRL") or None
|
||||
proxy_url=os.environ.get("WSKEY_PROXY_URL") or os.environ.get("WSKEY_PROXY_TUNNRL") or None
|
||||
iswxpusher=False
|
||||
counttime=0
|
||||
|
||||
if os.path.exists("/ql/config/auth.json"):
|
||||
config="/ql/config/auth.json"
|
||||
envtype="ql"
|
||||
if os.path.exists("/ql/data/db/keyv.sqlite"):
|
||||
config="/ql/data/db/keyv.sqlite"
|
||||
envtype="ql_latest"
|
||||
if os.path.exists("/ql/data/config/auth.json"):
|
||||
config="/ql/data/config/auth.json"
|
||||
envtype="ql"
|
||||
|
||||
if os.path.exists("/jd/config/auth.json"):
|
||||
config="/jd/config/auth.json"
|
||||
envtype="arcadia"
|
||||
|
||||
token_file_list = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json']
|
||||
|
||||
config = get_latest_file(token_file_list)
|
||||
envtype="ql"
|
||||
|
||||
if os.path.exists("/arcadia/config/auth.json"):
|
||||
config="/arcadia/config/auth.json"
|
||||
@ -500,7 +473,7 @@ def main():
|
||||
iswxpusher=False
|
||||
|
||||
if proxy_url is None:
|
||||
printf("没有配置代理,无法使用代理!\n请配置环境变量WSKEY_PROXY_TUNNRL或DY_PROXY\n")
|
||||
printf("没有配置代理,无法使用代理!\n请配置环境变量WSKEY_PROXY_TUNNRL或WSKEY_PROXY_URL\n")
|
||||
printf("====================================")
|
||||
else:
|
||||
printf(f"已配置代理: {proxy_url}\n")
|
||||
@ -511,16 +484,8 @@ def main():
|
||||
summary=""
|
||||
|
||||
if envtype == "ql":
|
||||
if 'keyv' in config:
|
||||
with open(config, "r", encoding="latin1") as file:
|
||||
auth = file.read()
|
||||
matches = re.search(r'"token":"([^"]*)"(?!.*"token":)', auth)
|
||||
token = matches.group(1)
|
||||
else:
|
||||
with open(config, "r") as file:
|
||||
auth = file.read()
|
||||
auth = json.loads(auth)
|
||||
token = auth["token"]
|
||||
with open(config, "r", encoding="utf-8") as f1:
|
||||
token = json.load(f1)['token']
|
||||
url = 'http://127.0.0.1:5600/api/envs'
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
body = {
|
||||
@ -536,7 +501,20 @@ def main():
|
||||
url = 'http://127.0.0.1:5678/openApi/count'
|
||||
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ', 'api-token': f'{token}'}
|
||||
datas = get(url, headers=headers).json()["data"]["accountCount"]
|
||||
|
||||
elif envtype == "ql_latest":
|
||||
with open(config, "r", encoding="latin1") as f1:
|
||||
content = f1.read()
|
||||
matches = re.search(r'token":"([^"]+)"', content)
|
||||
try:
|
||||
token = matches.group(1)
|
||||
except Exception as e:
|
||||
sys.exit(0)
|
||||
url = 'http://127.0.0.1:5600/api/envs'
|
||||
headers = {'Authorization': f'Bearer {token}'}
|
||||
body = {
|
||||
'searchValue': 'JD_WSCK',
|
||||
'Authorization': f'Bearer {token}'
|
||||
}
|
||||
datas = get(url, params=body, headers=headers).json()['data']
|
||||
|
||||
|
||||
@ -546,7 +524,7 @@ def main():
|
||||
printf("\n错误:没有需要转换的JD_WSCK,退出脚本!")
|
||||
return
|
||||
|
||||
if envtype in ('ql',''):
|
||||
if envtype in ('ql','ql_latest'):
|
||||
for data in datas:
|
||||
randomuserAgent()
|
||||
if data['status']!=0:
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user