mirror of
https://github.com/XiaoGe-LiBai/yangmao.git
synced 2025-12-17 19:14:35 +08:00
删除
This commit is contained in:
249
Keep早起打卡.js
249
Keep早起打卡.js
File diff suppressed because one or more lines are too long
65
dfrc.sh
65
dfrc.sh
@@ -1,65 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#抓包小程序东风日产,域名community.dongfeng-nissan.com.cn。抓authorization的值,把前面Bearer 的去掉再填入括号内。多个账号的authorization用空格隔开,每日任务积分有限,最好定时早点做,ck有效期约两周
|
|
||||||
#By-莫老师
|
|
||||||
#cron: 10 0 * * *
|
|
||||||
#const $ = new Env("东风日产");
|
|
||||||
|
|
||||||
###变量填写区开始,多账号的authorization用空格隔开
|
|
||||||
authorization=(eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3BocC1hcGkubmlzc2FuLWNvbW11bml0eS5zdmMuY2x1c3Rlci5sb2NhbC9hcGkvdjIvdXNlcl9tYW5hZ2UvZ2V0X3Rva2VuIiwiaWF0IjoxNjgyNjUyMDQ2LCJleHAiOjE2ODM5NDgwNDYsIm5iZiI6MTY4MjY1MjA0NiwianRpIjoiNlFkRDRVSmdjb0xXOWU1aCIsInN1YiI6NTI2MjAyNSwicHJ2IjoiNDhlNDUzODMxY2ViYTVlNTdhNDc1ZTY4NjQ5Y2ZkZWU2ZTk3ZDhkMiJ9.GYd1drNPxEFnuCqvyvgwV3P81bRxrOtbBRAgNHfxrg4
|
|
||||||
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3d4YXBpLmRvbmdmZW5nLW5pc3Nhbi5jb20uY24vYXBpL3NtYWxsL3Y0L3Nlc3Npb24vMGIzbWkyMnczQkkweTAzcXlBM3czQU8wa0czbWkyMm8iLCJpYXQiOjE2ODI2NTY2MDAsImV4cCI6MTY4MjY2MDIwMCwibmJmIjoxNjgyNjU2NjAwLCJqdGkiOiJINWNLZUpsSXFmVk1aQzR1Iiwic3ViIjoxMTIxMjMwMywicHJ2IjoiMjZiMDdiMmVjOGQ2MDFmMzczNGM5NTkwY2FlNDgyNzIwMzU5ODcxNCJ9.NM6JQ32czBwtWsti9L7OWt0gz5j0ZySr3ZQWbgNlxrY)
|
|
||||||
#wxpuzher推送参数
|
|
||||||
topicIds=8069
|
|
||||||
apptoken=
|
|
||||||
###变量填写区结束
|
|
||||||
|
|
||||||
|
|
||||||
url=community.dongfeng-nissan.com.cn
|
|
||||||
pl(){
|
|
||||||
comment=$(curl -s "https://v1.hitokoto.cn/?encode=text" -k)
|
|
||||||
length=$(($(echo "$comment" | awk '{print length($0)}')+77))
|
|
||||||
msg=$(echo -e $(curl -s -X POST -H "Host: $url" -H "Content-Length: $length" -H "authorization: Bearer ${authorization[$s]}" -H "content-type: application/json" -d '{"commentable_type":"feeds","commentable_id":'$[$RANDOM%200000+1000000]',"body":"'$comment'","from_type":3}' "https://$url/api/v2/comments" -k) | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}' | sed 's/\"//g')
|
|
||||||
if [ "$msg" = 评论成功 ]; then
|
|
||||||
echo "日产账号$s第$i次评论成功"
|
|
||||||
else
|
|
||||||
pl
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
dz(){
|
|
||||||
msg=$(echo -e $(curl -s -X POST -H "Host: $url" -H "authorization: Bearer ${authorization[$s]}" -H "content-type: application/json" -d "" "https://$url/api/v2/feeds/$[$RANDOM%200000+1000000]/like" -k) | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}' | sed 's/\"//g')
|
|
||||||
if [ "$msg" = 点赞成功 ]; then
|
|
||||||
echo "日产账号$s第$i次点赞成功"
|
|
||||||
dz
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
gz(){
|
|
||||||
msg=$(echo -e $(curl -s -X PUT -H "Host: $url" -H "Content-Length: 16" -H "authorization: Bearer ${authorization[$s]}" -H "content-type: application/json" -d '{"isToast":true}' "https://$url/api/v2/user/followings/$[$RANDOM%200000+1000]" -k) | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}' | sed 's/\"//g')
|
|
||||||
if [ "$msg" = 关注成功 ]; then
|
|
||||||
echo "日产账号$s关注成功"
|
|
||||||
else
|
|
||||||
gz
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
jq(){
|
|
||||||
msg=$(echo -e $(curl -s -X PUT -H "Host: $url" -H "Content-Length: 2" -H "authorization: Bearer ${authorization[$s]}" -H "accept: application/json" -d "{}" "https://$url/api/v2/user/feed-topics/$[$RANDOM%58+1]" -k) | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}' | sed 's/\"//g')
|
|
||||||
if [ "$msg" = 申请成功 ]; then
|
|
||||||
echo "日产账号$s加圈成功"
|
|
||||||
else
|
|
||||||
jq
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
for s in $(seq 0 1 $((${#authorization[@]}-1)))
|
|
||||||
do
|
|
||||||
syrq=$(($(echo "${authorization[$s]}" | awk -F "." '{print $2}' | base64 -d | sed 's/,/\n/g' | grep "exp" | awk -F ":" '{print $2}')-$(date +%s)))
|
|
||||||
if [ "$syrq" -gt 0 ]; then
|
|
||||||
for i in $(seq 1 3)
|
|
||||||
do
|
|
||||||
pl
|
|
||||||
dz
|
|
||||||
done
|
|
||||||
gz
|
|
||||||
jq
|
|
||||||
else
|
|
||||||
echo "日产账号$s的authorization失效请重新抓"
|
|
||||||
curl -s -X POST -H "Host: wxpusher.zjiecode.com" -H "Content-Type: application/json" -d '{"appToken":"'$apptoken'","content":"日产账号'$s'的authorization失效请重新抓","contentType":1,"topicIds":['$topicIds'], "url":"https://wxpusher.zjiecode.com","verifyPay":false}' "https://wxpusher.zjiecode.com/api/send/message" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}'
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
44
fyh.py
44
fyh.py
@@ -1,44 +0,0 @@
|
|||||||
"""
|
|
||||||
脚本名称:复游会(托迈酷客)
|
|
||||||
活动规则:每日签到可获得积分
|
|
||||||
环境变量:ThomasCook_Cookie=Authorization
|
|
||||||
host: apis.folidaymall.com 取出Authorization参数
|
|
||||||
cron 15 10,16 * * *
|
|
||||||
"""
|
|
||||||
|
|
||||||
######################################################################################################################################################
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
load_dotenv()
|
|
||||||
accounts = os.getenv('ThomasCook_Cookie')
|
|
||||||
if accounts is None:
|
|
||||||
print('你没有填入ThomasCook_Cookie,咋运行?')
|
|
||||||
else:
|
|
||||||
accounts_list = os.environ.get('ThomasCook_Cookie').split('@')
|
|
||||||
num_of_accounts = len(accounts_list)
|
|
||||||
print(f"获取到 {num_of_accounts} 个账号")
|
|
||||||
for i, account in enumerate(accounts_list, start=1):
|
|
||||||
values = account.split(',')
|
|
||||||
Authorization = values[0]
|
|
||||||
print(f"\n=======开始执行账号{i}=======")
|
|
||||||
url = "https://apis.folidaymall.com/online/cms-api/sign/userSign"
|
|
||||||
headers = {
|
|
||||||
"host": "apis.folidaymall.com",
|
|
||||||
"Authorization": Authorization,
|
|
||||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003130) NetType/WIFI Language/zh_CN miniProgram/wx1fa4da2889526a37"
|
|
||||||
}
|
|
||||||
r = requests.get(url=url, headers=headers).json()
|
|
||||||
if r["responseCode"] == "0":
|
|
||||||
mobile = r['data']['signInfo']['mobile']
|
|
||||||
if r['data']['signInfo']['signInStatus'] == 0:
|
|
||||||
zong = eval(f"{r['data']['signInfo']['currentIntegral']} + {r['data']['signInfo']['changeIntegeral']}")
|
|
||||||
|
|
||||||
print(
|
|
||||||
f"账号【{mobile}】🎉签到成功\n已连续签到{r['data']['signInfo']['continousSignDays']}天\n当前总积分:{zong}")
|
|
||||||
|
|
||||||
elif r['data']['signInfo']['signInStatus'] == 1:
|
|
||||||
print(
|
|
||||||
f"账号【{mobile}】🎉已签到!明天再来吧\n已连续签到{r['data']['signInfo']['continousSignDays']}天\n当前总积分:{r['data']['signInfo']['currentIntegral']}")
|
|
||||||
else:
|
|
||||||
print(f"❌❌❌❌❌{r}")
|
|
||||||
56
pico.sh
56
pico.sh
@@ -1,56 +0,0 @@
|
|||||||
#cron: 55 8 * * *
|
|
||||||
#const $ = new Env("pico");
|
|
||||||
#在括号中填写cookie中的sessionid值即可,用空格隔开,最高支持10个账号
|
|
||||||
#运行命令bash pico.sh run
|
|
||||||
#检测命令bash pico.sh check
|
|
||||||
#用青龙运行的bash换成task
|
|
||||||
#task XiaoGe-LiBai_yangmao/pico.sh run
|
|
||||||
#task XiaoGe-LiBai_yangmao/pico.sh check
|
|
||||||
sessionid=(9f83646e99d4f91d6d59b5f482543c9c f0b953fdc052ce3fa2e069195f7e6199)
|
|
||||||
url=bbs.picovr.com
|
|
||||||
|
|
||||||
run() {
|
|
||||||
for i in $(seq 0 1 $((${#sessionid[@]}-1)))
|
|
||||||
do
|
|
||||||
{
|
|
||||||
curl -X POST -H "Content-Length:2" -H "Cookie:sessionid=${sessionid[$i]}" -H "Host:$url" -H "User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" -H "Content-Type:application/json" -d "{}" "https://$url/ttarch/api/growth/v1/checkin/create?app_id=264482&web_id=7128273141759542820" -k
|
|
||||||
}&
|
|
||||||
done
|
|
||||||
wait
|
|
||||||
sleep 10s
|
|
||||||
for i in $(seq 0 1 $((${#sessionid[@]}-1)))
|
|
||||||
do
|
|
||||||
{
|
|
||||||
curl -X POST -H "Host:$url" -H "Content-Length:7" -H "Cookie:sessionid=${sessionid[$i]}" -H "Content-Type:application/json; charset=UTF-8" -H "User-Agent:com.picovr.assistantphone/294 (Linux; U; Android 11; zh_CN; Mi 10; Build/RKQ1.200826.002; Cronet/TTNetVersion:3a37693c 2022-02-10 QuicVersion:775bd845 2021-12-24)" -d "body=null" "https://$url/ttarch/api/growth/v1/user/share?app_id=8641" -k
|
|
||||||
sleep 3s
|
|
||||||
}
|
|
||||||
done
|
|
||||||
ids=($(curl -s "https://$url/ttarch/api/content/v1/content/list_by_time?app_id=8641" -k | sed 's/,/\n/g' | sed 's/\[/\n/g' |grep "item_id" | grep "content" | awk -F ":" '{print $3}' | sed 's/"//g'))
|
|
||||||
tzid=0
|
|
||||||
for s in $(seq 0 1 $(((2*${#sessionid[@]})-1)))
|
|
||||||
do
|
|
||||||
comment=$(curl -s "https://v1.hitokoto.cn/?encode=text" -k)
|
|
||||||
length=$(($(echo "$comment${ids[$tzid]}" | awk '{print length($0)}')+53))
|
|
||||||
curl -X POST -H "Host: $url" -H "Content-Length: $length" -H "Cookie: sessionid=${sessionid[$i]}" -H "Content-Type: application/json; charset=UTF-8" -H "User-Agent: com.picovr.assistantphone/294 (Linux; U; Android 11; zh_CN; Mi 10; Build/RKQ1.200826.002; Cronet/TTNetVersion:3a37693c 2022-02-10 QuicVersion:775bd845 2021-12-24)" -d '{"comment":{"content":"'$comment'","item_id":"'${ids[$tzid]}'","item_type":2}}' "https://$url/ttarch/api/interact/v1/comment/create?app_id=8641" -k
|
|
||||||
let tzid++
|
|
||||||
sleep "$[$[RANDOM%30]+30]"s
|
|
||||||
done
|
|
||||||
}
|
|
||||||
check() {
|
|
||||||
for i in $(seq 0 1 $((${#sessionid[@]}-1)))
|
|
||||||
do
|
|
||||||
{
|
|
||||||
curl -o body.json -s -X GET -H "Host:$url" -H "Cookie:sessionid=${sessionid[$i]}" -H "User-Agent:com.picovr.assistantphone/294 (Linux; U; Android 11; zh_CN; Mi 10; Build/RKQ1.200826.002; Cronet/TTNetVersion:3a37693c 2022-02-10 QuicVersion:775bd845 2021-12-24)" "https://$url/ttarch/api/growth/v1/user/get?aid=8641" -k
|
|
||||||
err=$(cat body.json | sed 's/,/\n/g' | sed 's/\[/\n/g' |grep "err_no" | awk -F ":" '{print $2}' | sed 's/"//g' | sed 's/}//g')
|
|
||||||
if [ "$err" = 0 ]; then
|
|
||||||
echo "pico账号$i的积分为$(cat body.json | sed 's/,/\n/g' | sed 's/\[/\n/g' |grep "point" | grep "growth_info" | awk -F ":" '{print $3}' | sed 's/"//g')"
|
|
||||||
else
|
|
||||||
echo "账号$i的ck已失效"
|
|
||||||
#wxpusher推送
|
|
||||||
curl -X POST -H "Host:wxpusher.zjiecode.com" -H "Content-Type:application/json" -d '{"appToken":"填写wxpusher的token不推送就把这一段整个删掉","content":"pico账号'$i'的CK已失效","contentType":1,"topicIds":[wxpusher的主题ID], "url":"https://wxpusher.zjiecode.com","verifyPay":false}' "https://wxpusher.zjiecode.com/api/send/message"
|
|
||||||
fi
|
|
||||||
rm -rf body.json
|
|
||||||
}
|
|
||||||
done
|
|
||||||
}
|
|
||||||
$1
|
|
||||||
50
qdw.py
50
qdw.py
@@ -1,50 +0,0 @@
|
|||||||
"""
|
|
||||||
脚本名称:七点五饮用天然矿泉水_小程序
|
|
||||||
活动规则:每日签到可获得积分 兑换狂犬水
|
|
||||||
环境变量:qdw_sid=sid
|
|
||||||
host: https://h5.youzan.com 取出sid参数
|
|
||||||
cron:31 7,13,16 * * *
|
|
||||||
|
|
||||||
"""
|
|
||||||
###############################################################################
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
accounts = os.getenv('qdw_sid')
|
|
||||||
if accounts is None:
|
|
||||||
print('你没有填入qdw_sid,咋运行?')
|
|
||||||
else:
|
|
||||||
accounts_list = os.environ.get('qdw_sid').split('&')
|
|
||||||
num_of_accounts = len(accounts_list)
|
|
||||||
print(f"获取到 {num_of_accounts} 个账号")
|
|
||||||
for i, account in enumerate(accounts_list, start=1):
|
|
||||||
values = account.split(',')
|
|
||||||
sid = values[0]
|
|
||||||
print(f"\n=======开始执行账号{i}=======")
|
|
||||||
|
|
||||||
url = "https://h5.youzan.com/wscump/checkin/checkinV2.json"
|
|
||||||
headers = {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/9129",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Extra-Data": '{"is_weapp":1,"sid":"' + sid + '","version":"2.173.6","client":"weapp","bizEnv":"wsc","ftime":%d}' % int(
|
|
||||||
time.time() * 1000)
|
|
||||||
}
|
|
||||||
params = {
|
|
||||||
"checkinId": "3997371",
|
|
||||||
}
|
|
||||||
response = requests.get(url, headers=headers, params=params).json()
|
|
||||||
if response['code'] == 1000030071:
|
|
||||||
print('今天已经签到过啦🎉明天再来吧!')
|
|
||||||
elif response['code'] == 0:
|
|
||||||
print(f"签到成功🎉获得{response['data']['list'][0]['infos']['title']}!")
|
|
||||||
else:
|
|
||||||
print(response)
|
|
||||||
|
|
||||||
url="https://h5.youzan.com/wscump/checkin/get_activity_by_yzuid_v2.json"
|
|
||||||
re = requests.get(url, headers=headers,params=params).json()
|
|
||||||
url = 'https://h5.youzan.com/wscuser/membercenter/init-data.json'
|
|
||||||
response = requests.get(url, headers=headers).json()
|
|
||||||
if response['code']==0:
|
|
||||||
print(f"账号【{str(sid)[:18]}】 连续签到【{re['data']['continuesDay']}天】\n当前可用积分:{response['data']['member']['stats']['points']}")
|
|
||||||
47
rc.sh
47
rc.sh
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
#抓包域名oneapph5.dongfeng-nissan.com.cn 填写以下变量 多个账号的数据用空格隔开,任务积分有限,最好定时早点做
|
|
||||||
#By-莫老师
|
|
||||||
#cron: 30 6 * * *
|
|
||||||
#const $ = new Env('日产智联');
|
|
||||||
|
|
||||||
###变量填写区开始
|
|
||||||
sign=(688509541cbb443b67eef36aa0800a817c429f433e24bb4b890c54a83563658d1cd2fc0395c9f68cc12e257e9c9a5dd8860814381ce542850b182cca2266a2c)
|
|
||||||
noncestr=(c6780b3137a740fea00a0ffb3637542)
|
|
||||||
token=(a80320cd606d59d911dcb2d6ab8d040)
|
|
||||||
timestamp=(168197545071)
|
|
||||||
###变量填写区结束
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f "gzid" ]; then
|
|
||||||
echo 1000 >gzid
|
|
||||||
curl -s -O http://illii.vip/qzid
|
|
||||||
fi
|
|
||||||
for s in $(seq 1 2)
|
|
||||||
do
|
|
||||||
curl -s -X GET -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type:2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/dndc-gateway/community/api/v2/feeds/new_list?dt=RMX2202&os=Android&device_brand=realme&os_version=13&limit=20&use_volc=1&page=$[$RANDOM%20000+1]&clientVersion=2.2.7" -k | sed 's/total\":null,\"id\"/,tzid/g' | sed 's/,/\n/g' | grep "tzid" | awk -F ":" '{print $2}' >>tzid
|
|
||||||
done
|
|
||||||
pl=1
|
|
||||||
qzid=$(sed -n '1p' qzid)
|
|
||||||
gzid=$(cat gzid)
|
|
||||||
let gzid++
|
|
||||||
for s in $(seq 0 1 $((${#token[@]}-1)))
|
|
||||||
do
|
|
||||||
echo "日产账号$s签到$(curl -s -X POST -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type: 2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Content-Length: 65" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" -d '{"version":"1210","requestId":"638dc64060e748aaae70fd'$(date +%s)'"}' "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/vmsp-me/ly/busicen/member/reward/pointsreturn/memberPointsRechargetRequestSign" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}')"
|
|
||||||
for i in $(seq 1 3)
|
|
||||||
do
|
|
||||||
tzid=$(sed -n ''$pl'p' tzid)
|
|
||||||
let pl++
|
|
||||||
comment=$(curl -s "https://v1.hitokoto.cn/?encode=text" -k)
|
|
||||||
length=$(($(echo "$comment$tzid" | awk '{print length($0)}')+58))
|
|
||||||
echo "日产账号$s评论$(curl -s -X POST -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type: 2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Content-Length: $length" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" -d '{"commentable_type":"feeds","commentable_id":"'$tzid'","body":"'$comment'"}' "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/dndc-gateway/community/api/v2/comments" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}')"
|
|
||||||
echo "日产账号$s点赞$(curl -s -X POST -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type: 2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Content-Length: 2" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" -d '{}' "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/dndc-gateway/community/api/v2/feeds/$tzid/like" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}')"
|
|
||||||
done
|
|
||||||
echo "日产账号$s关注$(curl -s -X PUT -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type: 2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Content-Length: 2" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" -d '{}' "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/dndc-gateway/community/api/v2/user/followings/$gzid" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}')"
|
|
||||||
echo "日产账号$s加圈$(curl -s -X PUT -H "appVersion: 2.2.7" -H "clientid: nissanapp" -H "Accept: application/json" -H "sign: ${sign[$s]}" -H "range: 1" -H "noncestr: ${noncestr[$s]}" -H "token: ${token[$s]}" -H "From-Type: 2" -H "appSkin: NISSANAPP" -H "appcode: nissan" -H "timestamp: ${timestamp[$s]}" -H "channelCode: N_ariya_as_0016" -H "Content-Type: application/json" -H "Content-Length: 2" -H "Host: oneapph5.dongfeng-nissan.com.cn" -H "Connection: Keep-Alive" -H "User-Agent: okhttp/3.12.0" -d '{}' "https://oneapph5.dongfeng-nissan.com.cn/mb-gw/dndc-gateway/community/api/v2/user/feed-topics/$qzid" -k | sed 's/,/\n/g' | grep "msg" | awk -F ":" '{print $2}')"
|
|
||||||
done
|
|
||||||
echo $gzid >gzid
|
|
||||||
sed -i '1d' qzid
|
|
||||||
rm -rf tzid
|
|
||||||
242
tieba.py
242
tieba.py
@@ -1,242 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
# -*- coding:utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
|
||||||
cron: 6 1 * * *
|
|
||||||
# const $ = new Env('百度贴吧签到')
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
import hashlib
|
|
||||||
import time
|
|
||||||
import copy
|
|
||||||
import logging
|
|
||||||
import random
|
|
||||||
|
|
||||||
import smtplib
|
|
||||||
from email.mime.text import MIMEText
|
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
# API_URL
|
|
||||||
LIKIE_URL = "http://c.tieba.baidu.com/c/f/forum/like"
|
|
||||||
TBS_URL = "http://tieba.baidu.com/dc/common/tbs"
|
|
||||||
SIGN_URL = "http://c.tieba.baidu.com/c/c/forum/sign"
|
|
||||||
|
|
||||||
ENV = os.environ
|
|
||||||
|
|
||||||
HEADERS = {
|
|
||||||
'Host': 'tieba.baidu.com',
|
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
|
|
||||||
}
|
|
||||||
SIGN_DATA = {
|
|
||||||
'_client_type': '2',
|
|
||||||
'_client_version': '9.7.8.0',
|
|
||||||
'_phone_imei': '000000000000000',
|
|
||||||
'model': 'MI+5',
|
|
||||||
"net_type": "1",
|
|
||||||
}
|
|
||||||
|
|
||||||
# VARIABLE NAME
|
|
||||||
COOKIE = "Cookie"
|
|
||||||
BDUSS = "BDUSS"
|
|
||||||
EQUAL = r'='
|
|
||||||
EMPTY_STR = r''
|
|
||||||
TBS = 'tbs'
|
|
||||||
PAGE_NO = 'page_no'
|
|
||||||
ONE = '1'
|
|
||||||
TIMESTAMP = "timestamp"
|
|
||||||
DATA = 'data'
|
|
||||||
FID = 'fid'
|
|
||||||
SIGN_KEY = 'tiebaclient!!!'
|
|
||||||
UTF8 = "utf-8"
|
|
||||||
SIGN = "sign"
|
|
||||||
KW = "kw"
|
|
||||||
|
|
||||||
s = requests.Session()
|
|
||||||
|
|
||||||
|
|
||||||
def get_tbs(bduss):
|
|
||||||
logger.info("获取tbs开始")
|
|
||||||
headers = copy.copy(HEADERS)
|
|
||||||
headers.update({COOKIE: EMPTY_STR.join([BDUSS, EQUAL, bduss])})
|
|
||||||
try:
|
|
||||||
tbs = s.get(url=TBS_URL, headers=headers, timeout=5).json()[TBS]
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("获取tbs出错" + e)
|
|
||||||
logger.info("重新获取tbs开始")
|
|
||||||
tbs = s.get(url=TBS_URL, headers=headers, timeout=5).json()[TBS]
|
|
||||||
logger.info("获取tbs结束")
|
|
||||||
return tbs
|
|
||||||
|
|
||||||
|
|
||||||
def get_favorite(bduss):
|
|
||||||
logger.info("获取关注的贴吧开始")
|
|
||||||
# 客户端关注的贴吧
|
|
||||||
returnData = {}
|
|
||||||
i = 1
|
|
||||||
data = {
|
|
||||||
'BDUSS': bduss,
|
|
||||||
'_client_type': '2',
|
|
||||||
'_client_id': 'wappc_1534235498291_488',
|
|
||||||
'_client_version': '9.7.8.0',
|
|
||||||
'_phone_imei': '000000000000000',
|
|
||||||
'from': '1008621y',
|
|
||||||
'page_no': '1',
|
|
||||||
'page_size': '200',
|
|
||||||
'model': 'MI+5',
|
|
||||||
'net_type': '1',
|
|
||||||
'timestamp': str(int(time.time())),
|
|
||||||
'vcode_tag': '11',
|
|
||||||
}
|
|
||||||
data = encodeData(data)
|
|
||||||
try:
|
|
||||||
res = s.post(url=LIKIE_URL, data=data, timeout=5).json()
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("获取关注的贴吧出错" + e)
|
|
||||||
return []
|
|
||||||
returnData = res
|
|
||||||
if 'forum_list' not in returnData:
|
|
||||||
returnData['forum_list'] = []
|
|
||||||
if res['forum_list'] == []:
|
|
||||||
return {'gconforum': [], 'non-gconforum': []}
|
|
||||||
if 'non-gconforum' not in returnData['forum_list']:
|
|
||||||
returnData['forum_list']['non-gconforum'] = []
|
|
||||||
if 'gconforum' not in returnData['forum_list']:
|
|
||||||
returnData['forum_list']['gconforum'] = []
|
|
||||||
while 'has_more' in res and res['has_more'] == '1':
|
|
||||||
i = i + 1
|
|
||||||
data = {
|
|
||||||
'BDUSS': bduss,
|
|
||||||
'_client_type': '2',
|
|
||||||
'_client_id': 'wappc_1534235498291_488',
|
|
||||||
'_client_version': '9.7.8.0',
|
|
||||||
'_phone_imei': '000000000000000',
|
|
||||||
'from': '1008621y',
|
|
||||||
'page_no': str(i),
|
|
||||||
'page_size': '200',
|
|
||||||
'model': 'MI+5',
|
|
||||||
'net_type': '1',
|
|
||||||
'timestamp': str(int(time.time())),
|
|
||||||
'vcode_tag': '11',
|
|
||||||
}
|
|
||||||
data = encodeData(data)
|
|
||||||
try:
|
|
||||||
res = s.post(url=LIKIE_URL, data=data, timeout=5).json()
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("获取关注的贴吧出错" + e)
|
|
||||||
continue
|
|
||||||
if 'forum_list' not in res:
|
|
||||||
continue
|
|
||||||
if 'non-gconforum' in res['forum_list']:
|
|
||||||
returnData['forum_list']['non-gconforum'].append(res['forum_list']['non-gconforum'])
|
|
||||||
if 'gconforum' in res['forum_list']:
|
|
||||||
returnData['forum_list']['gconforum'].append(res['forum_list']['gconforum'])
|
|
||||||
|
|
||||||
t = []
|
|
||||||
for i in returnData['forum_list']['non-gconforum']:
|
|
||||||
if isinstance(i, list):
|
|
||||||
for j in i:
|
|
||||||
if isinstance(j, list):
|
|
||||||
for k in j:
|
|
||||||
t.append(k)
|
|
||||||
else:
|
|
||||||
t.append(j)
|
|
||||||
else:
|
|
||||||
t.append(i)
|
|
||||||
for i in returnData['forum_list']['gconforum']:
|
|
||||||
if isinstance(i, list):
|
|
||||||
for j in i:
|
|
||||||
if isinstance(j, list):
|
|
||||||
for k in j:
|
|
||||||
t.append(k)
|
|
||||||
else:
|
|
||||||
t.append(j)
|
|
||||||
else:
|
|
||||||
t.append(i)
|
|
||||||
logger.info("获取关注的贴吧结束")
|
|
||||||
return t
|
|
||||||
|
|
||||||
|
|
||||||
def encodeData(data):
|
|
||||||
s = EMPTY_STR
|
|
||||||
keys = data.keys()
|
|
||||||
for i in sorted(keys):
|
|
||||||
s += i + EQUAL + str(data[i])
|
|
||||||
sign = hashlib.md5((s + SIGN_KEY).encode(UTF8)).hexdigest().upper()
|
|
||||||
data.update({SIGN: str(sign)})
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def client_sign(bduss, tbs, fid, kw):
|
|
||||||
# 客户端签到
|
|
||||||
logger.info("开始签到贴吧:" + kw)
|
|
||||||
data = copy.copy(SIGN_DATA)
|
|
||||||
data.update({BDUSS: bduss, FID: fid, KW: kw, TBS: tbs, TIMESTAMP: str(int(time.time()))})
|
|
||||||
data = encodeData(data)
|
|
||||||
res = s.post(url=SIGN_URL, data=data, timeout=5).json()
|
|
||||||
return res
|
|
||||||
|
|
||||||
def send_email(sign_list):
|
|
||||||
if ('HOST' not in ENV or 'FROM' not in ENV or 'TO' not in ENV or 'AUTH' not in ENV):
|
|
||||||
logger.error("未配置邮箱")
|
|
||||||
return
|
|
||||||
HOST = ENV['HOST']
|
|
||||||
FROM = ENV['FROM']
|
|
||||||
TO = ENV['TO'].split('#')
|
|
||||||
AUTH = ENV['AUTH']
|
|
||||||
length = len(sign_list)
|
|
||||||
subject = f"{time.strftime('%Y-%m-%d', time.localtime())} 签到{length}个贴吧"
|
|
||||||
body = """
|
|
||||||
<style>
|
|
||||||
.child {
|
|
||||||
background-color: rgba(173, 216, 230, 0.19);
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.child * {
|
|
||||||
margin: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
"""
|
|
||||||
for i in sign_list:
|
|
||||||
body += f"""
|
|
||||||
<div class="child">
|
|
||||||
<div class="name"> 贴吧名称: { i['name'] }</div>
|
|
||||||
<div class="slogan"> 贴吧简介: { i['slogan'] }</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
"""
|
|
||||||
msg = MIMEText(body, 'html', 'utf-8')
|
|
||||||
msg['subject'] = subject
|
|
||||||
smtp = smtplib.SMTP()
|
|
||||||
smtp.connect(HOST)
|
|
||||||
smtp.login(FROM, AUTH)
|
|
||||||
smtp.sendmail(FROM, TO, msg.as_string())
|
|
||||||
smtp.quit()
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if ('BDUSS' not in ENV):
|
|
||||||
logger.error("未配置BDUSS")
|
|
||||||
return
|
|
||||||
b = ENV['BDUSS'].split('#')
|
|
||||||
for n, i in enumerate(b):
|
|
||||||
logger.info("开始签到第" + str(n) + "个用户" + i)
|
|
||||||
tbs = get_tbs(i)
|
|
||||||
favorites = get_favorite(i)
|
|
||||||
for j in favorites:
|
|
||||||
time.sleep(random.randint(1,5))
|
|
||||||
client_sign(i, tbs, j["id"], j["name"])
|
|
||||||
logger.info("完成第" + str(n) + "个用户签到")
|
|
||||||
send_email(favorites)
|
|
||||||
logger.info("所有用户签到结束")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
"""
|
|
||||||
new Env('携趣IP白名单');
|
|
||||||
0 8 * * * xiequ_white_list.py
|
|
||||||
export XIEQU_UID='xxxxxx'
|
|
||||||
export XIEQU_UKEY='xxxxxxxxxxxxxxxxx'
|
|
||||||
by:xmo
|
|
||||||
"""
|
|
||||||
|
|
||||||
import requests
|
|
||||||
import time
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
print("")
|
|
||||||
|
|
||||||
# uid&ukey从配置读取
|
|
||||||
uid = os.getenv("XIEQU_UID")
|
|
||||||
ukey = os.getenv("XIEQU_UKEY")
|
|
||||||
|
|
||||||
# uid = ""
|
|
||||||
if not uid:
|
|
||||||
print(">>>无uid退出,请先export XIEQU_UID=你自己的uid")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# ukey = ""
|
|
||||||
if not ukey:
|
|
||||||
print(">>>无ukey退出,请先export XIEQU_UKEY=你自己的ukey")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# 加载通知
|
|
||||||
def load_send():
|
|
||||||
global send
|
|
||||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
sys.path.append(cur_path)
|
|
||||||
if os.path.exists(cur_path + "/sendNotify.py"):
|
|
||||||
try:
|
|
||||||
from sendNotify import send
|
|
||||||
except:
|
|
||||||
send=False
|
|
||||||
print(">>>加载通知服务失败~")
|
|
||||||
else:
|
|
||||||
send=False
|
|
||||||
print(">>>加载通知服务失败~")
|
|
||||||
load_send()
|
|
||||||
|
|
||||||
msg = ">>>开始执行……"
|
|
||||||
|
|
||||||
# 置空IP地址
|
|
||||||
ip = ""
|
|
||||||
|
|
||||||
# 尝试使用3322.org网站获取公网IP
|
|
||||||
try:
|
|
||||||
url = "http://members.3322.org/dyndns/getip/"
|
|
||||||
response = requests.get(url)
|
|
||||||
ip = response.text.strip()
|
|
||||||
print(f">>>使用3322.org获取公网IP成功:{ip}")
|
|
||||||
msg = msg + "\n" + f">>>使用3322.org获取公网IP成功:{ip}"
|
|
||||||
except requests.RequestException as e:
|
|
||||||
print(">>>使用3322.org获取公网IP失败,尝试其他方式...")
|
|
||||||
msg = msg + "\n" + ">>>使用3322.org获取公网IP失败,尝试其他方式..."
|
|
||||||
|
|
||||||
#ip = ""
|
|
||||||
|
|
||||||
# 尝试使用synology.com网站获取公网IP
|
|
||||||
if not ip:
|
|
||||||
url = "https://checkip.synology.com/"
|
|
||||||
def get_external_ip():
|
|
||||||
site = requests.get(url)
|
|
||||||
grab = re.findall('([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', site.text)
|
|
||||||
address = grab[0]
|
|
||||||
return address
|
|
||||||
ip = get_external_ip()
|
|
||||||
if not ip:
|
|
||||||
print(">>>使用synology.com获取公网IP失败,尝试其他方式...")
|
|
||||||
msg = msg + "\n" + ">>>使用synology.com获取公网IP失败,尝试其他方式..."
|
|
||||||
else:
|
|
||||||
print(f">>>使用synology.com获取公网IP成功:{ip}")
|
|
||||||
msg = msg + "\n" + f">>>使用synology.com获取公网IP成功:{ip}"
|
|
||||||
|
|
||||||
#ip = ""
|
|
||||||
|
|
||||||
# 尝试使用httpbin.org网站获取公网IP
|
|
||||||
if not ip:
|
|
||||||
try:
|
|
||||||
url = "http://httpbin.org/ip"
|
|
||||||
response = requests.get(url)
|
|
||||||
data = response.json()
|
|
||||||
ip = data['origin']
|
|
||||||
print(f">>>使用httpbin.org获取公网IP成功:{ip}")
|
|
||||||
msg = msg + "\n" + f">>>使用httpbin.org获取公网IP成功:{ip}"
|
|
||||||
except requests.RequestException as e:
|
|
||||||
print(">>>使用httpbin.org获取公网IP失败,请检查网络连接或其他问题。")
|
|
||||||
msg = msg + "\n" + ">>>使用httpbin.org获取公网IP失败,请检查网络连接或其他问题。"
|
|
||||||
|
|
||||||
#ip = ""
|
|
||||||
|
|
||||||
# 判断是否获取到公网IP
|
|
||||||
if not ip:
|
|
||||||
print(">>>未获取到公网IP,过程终止...")
|
|
||||||
msg = msg + "\n" + ">>>未获取到公网IP,过程终止..."
|
|
||||||
else:
|
|
||||||
# 判断当前ip是否在白名单内
|
|
||||||
# 查询IP白名单
|
|
||||||
get_url = f"http://op.xiequ.cn/IpWhiteList.aspx?uid={uid}&ukey={ukey}&act=get"
|
|
||||||
response = requests.get(get_url)
|
|
||||||
print(f">>>执行前查询白名单IP:{response.text}")
|
|
||||||
msg = msg + "\n" + f">>>执行前查询白名单IP:{response.text}"
|
|
||||||
if ip in response.text:
|
|
||||||
print(">>>当前ip在白名单内,过程终止...")
|
|
||||||
msg = msg + "\n" + ">>>当前ip在白名单内,过程终止..."
|
|
||||||
else:
|
|
||||||
# 删除所有已有的白名单 IP
|
|
||||||
time.sleep(1)
|
|
||||||
delete_url = f"http://op.xiequ.cn/IpWhiteList.aspx?uid={uid}&ukey={ukey}&act=del&ip=all"
|
|
||||||
response = requests.get(delete_url)
|
|
||||||
print(f">>>清空白名单IP:{response.text}")
|
|
||||||
msg = msg + "\n" + f">>>清空白名单IP:{response.text}"
|
|
||||||
# 添加IP到白名单
|
|
||||||
time.sleep(1)
|
|
||||||
add_url = f"http://op.xiequ.cn/IpWhiteList.aspx?uid={uid}&ukey={ukey}&act=add&ip={ip}"
|
|
||||||
response = requests.get(add_url)
|
|
||||||
print(f">>>添加白名单IP:{response.text}")
|
|
||||||
msg = msg + "\n" + f">>>添加白名单IP:{response.text}"
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
# 查询IP白名单
|
|
||||||
get_url = f"http://op.xiequ.cn/IpWhiteList.aspx?uid={uid}&ukey={ukey}&act=get"
|
|
||||||
response = requests.get(get_url)
|
|
||||||
print(f">>>执行后查询白名单IP:{response.text}")
|
|
||||||
msg = msg + "\n" + f">>>执行后查询白名单IP:{response.text}"
|
|
||||||
msg = msg + "\n" + ">>>执行结束……"
|
|
||||||
send("携趣IP白名单\n\n" + msg +"\n","本通知 by xmo")
|
|
||||||
|
|
||||||
173
内网穿透.py
173
内网穿透.py
@@ -1,173 +0,0 @@
|
|||||||
# -*- coding: UTF-8 -*-
|
|
||||||
# Version: v1.4
|
|
||||||
# Created by lstcml on 2022/10/18
|
|
||||||
# 建议定时10分钟:*/10 * * * *
|
|
||||||
|
|
||||||
'''
|
|
||||||
cron: */10 * * * *
|
|
||||||
new Env('Cpolar内网穿透');
|
|
||||||
'''
|
|
||||||
|
|
||||||
'''
|
|
||||||
使用说明:
|
|
||||||
1、打开https://i.cpolar.com/m/4wLJ注册登录后获取authtoken;
|
|
||||||
2、新增变量qlnwct_authtoken,值为你账户的authtoken,运行脚本
|
|
||||||
|
|
||||||
更新记录:
|
|
||||||
v1.4
|
|
||||||
1、兼容新版的青龙面板;
|
|
||||||
|
|
||||||
v1.3
|
|
||||||
1、移动仓库目录;
|
|
||||||
|
|
||||||
v1.2
|
|
||||||
1、新增CPU架构识别,自动下载对应cpolar程序;
|
|
||||||
2、默认开启自动更新,qlnwctupdate值为false则关闭自动更新;
|
|
||||||
|
|
||||||
v1.1
|
|
||||||
1、开放推送,仅支持PushPlus推送,每次触发启动穿透会推送一次地址;
|
|
||||||
'''
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
from time import sleep
|
|
||||||
path = os.path.split(os.path.realpath(__file__))[0]
|
|
||||||
log_path = os.path.join(path, "nwct_cpolar_log")
|
|
||||||
log_name = os.path.join(log_path, "cpolar")
|
|
||||||
log_file = os.path.join(log_path, "cpolar.master.log")
|
|
||||||
app_path = os.path.join(path, "cpolar")
|
|
||||||
commond = "python3 " + os.path.join(path, "cpolar.py") + " &"
|
|
||||||
|
|
||||||
# 检查更新
|
|
||||||
def update():
|
|
||||||
print("当前运行的脚本版本:" + str(version))
|
|
||||||
try:
|
|
||||||
r1 = requests.get("https://ghproxy.com/https://raw.githubusercontent.com/jiankujidu/cpolar/main/nwct_cpolar.py").text
|
|
||||||
r2 = re.findall(re.compile("version = \d.\d"), r1)[0].split("=")[1].strip()
|
|
||||||
if float(r2) > version:
|
|
||||||
print("发现新版本:" + r2)
|
|
||||||
print("正在自动更新脚本...")
|
|
||||||
os.system("killall cpolar")
|
|
||||||
os.system("ql raw https://ghproxy.com/https://raw.githubusercontent.com/jiankujidu/cpolar/main/nwct_cpolar.py &")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# 判断CPU架构
|
|
||||||
def check_os():
|
|
||||||
r = os.popen('uname -m').read()
|
|
||||||
if 'aarch64' in r or 'arm' in r:
|
|
||||||
cpu = 'arm'
|
|
||||||
elif 'x86_64' in r or 'x64' in r:
|
|
||||||
cpu = 'amd64'
|
|
||||||
else:
|
|
||||||
print('穿透失败:不支持当前架构!')
|
|
||||||
return
|
|
||||||
print('获取CPU架构:' + r.replace('\n', ''))
|
|
||||||
download_cpolar(cpu)
|
|
||||||
|
|
||||||
# 下载主程序
|
|
||||||
def download_cpolar(cpu):
|
|
||||||
if not os.path.exists("cpolar.py"):
|
|
||||||
res = requests.get("https://ghproxy.com/https://raw.githubusercontent.com/jiankujidu/cpolar/main/cpolar.py")
|
|
||||||
with open("cpolar.py", "wb") as f:
|
|
||||||
f.write(res.content)
|
|
||||||
if not os.path.exists("cpolar"):
|
|
||||||
res = requests.get("https://static.cpolar.com/downloads/releases/3.2.88.2/cpolar-stable-linux-" + cpu + ".zip")
|
|
||||||
with open("cpolar.zip", "wb") as f:
|
|
||||||
f.write(res.content)
|
|
||||||
os.system("unzip cpolar.zip >/dev/null 2>&1&&rm -f cpolar.zip&&chmod +x cpolar&&" + app_path + " authtoken " + authtoken + ">/dev/null 2>&1")
|
|
||||||
start_nwct()
|
|
||||||
|
|
||||||
# 获取穿透url
|
|
||||||
def get_url():
|
|
||||||
try:
|
|
||||||
with open(log_file, encoding='utf-8') as f:
|
|
||||||
log_content = f.read()
|
|
||||||
reg = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
|
|
||||||
for i in re.findall(reg, log_content):
|
|
||||||
if 'cpolar' in i:
|
|
||||||
print("获取穿透链接成功...")
|
|
||||||
return i.replace('\\', '')
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
return "https://ghproxy.com/https://raw.githubusercontent.com/jiankujidu"
|
|
||||||
|
|
||||||
# 进程守护
|
|
||||||
def process_daemon():
|
|
||||||
print("正在检测穿透状态...")
|
|
||||||
global qlurl
|
|
||||||
qlurl = get_url()
|
|
||||||
try:
|
|
||||||
res = requests.get(qlurl + "/login").text
|
|
||||||
if "/images/g5.ico" in res or "/images/favicon.svg" in res:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
# 执行程序
|
|
||||||
def start_nwct():
|
|
||||||
if not process_daemon():
|
|
||||||
os.system("rm -rf " + log_path)
|
|
||||||
os.system("mkdir -p " + log_path)
|
|
||||||
os.system("killall cpolar >/dev/null 2>&1")
|
|
||||||
print("正在启动内网穿透...")
|
|
||||||
os.system(commond)
|
|
||||||
sleep(10)
|
|
||||||
if process_daemon():
|
|
||||||
if load_send():
|
|
||||||
print("启动内网穿透成功!\n青龙面板:%s" % qlurl)
|
|
||||||
send("内网穿透通知", "青龙面板访问地址:" + qlurl)
|
|
||||||
else:
|
|
||||||
print("启动内网穿透失败...")
|
|
||||||
else:
|
|
||||||
print("穿透程序已在运行...\nQQ交流群:706397373\n青龙面板:%s" % qlurl)
|
|
||||||
|
|
||||||
|
|
||||||
# 推送
|
|
||||||
def load_send():
|
|
||||||
global send
|
|
||||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
sys.path.append(cur_path)
|
|
||||||
sendNotifPath = cur_path + "/sendNotify.py"
|
|
||||||
if not os.path.exists(sendNotifPath):
|
|
||||||
res = requests.get("https://ghproxy.com/https://raw.githubusercontent.com/jiankujidu/cpolar/main/sendNotify.py")
|
|
||||||
with open(sendNotifPath, "wb") as f:
|
|
||||||
f.write(res.content)
|
|
||||||
|
|
||||||
try:
|
|
||||||
from sendNotify import send
|
|
||||||
return True
|
|
||||||
except:
|
|
||||||
print("加载通知服务失败!")
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
version = 1.4
|
|
||||||
try:
|
|
||||||
authtoken = os.environ['qlnwct_authtoken']
|
|
||||||
except:
|
|
||||||
authtoken = ""
|
|
||||||
try:
|
|
||||||
token = os.environ['PUSH_PLUS_TOKEN']
|
|
||||||
except:
|
|
||||||
token = ""
|
|
||||||
try:
|
|
||||||
check_update = os.environ['qlnwctupdate']
|
|
||||||
except:
|
|
||||||
check_update = "true"
|
|
||||||
|
|
||||||
if check_update != "false":
|
|
||||||
update()
|
|
||||||
else:
|
|
||||||
print("变量qlnwctupdate未设置,脚本自动更新未开启!")
|
|
||||||
if len(authtoken ) < 1:
|
|
||||||
print("请新增变量qlnwct_authtoken!")
|
|
||||||
else:
|
|
||||||
check_os()
|
|
||||||
2367
彼得团币5.0.4.py
2367
彼得团币5.0.4.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user