mirror of
https://github.com/Ytong825/mao.git
synced 2025-12-17 23:34:39 +08:00
1
This commit is contained in:
193
农夫山泉抽水.py
193
农夫山泉抽水.py
@@ -1,193 +0,0 @@
|
||||
import time
|
||||
import os
|
||||
import requests
|
||||
from datetime import datetime
|
||||
import json
|
||||
|
||||
|
||||
#抓取农夫山泉抽水小程序 获取apitoken值填入环境变量 变量名字为nfsq
|
||||
# Constants
|
||||
API_BASE_URL = "https://gateway.jmhd8.com"
|
||||
USER_INFO_URL = f"{API_BASE_URL}/geement.usercenter/api/v1/user/information"
|
||||
TASK_LIST_URL = f"{API_BASE_URL}/geement.marketingplay/api/v1/task"
|
||||
JOIN_TASK_URL = f"{API_BASE_URL}/geement.marketingplay/api/v1/task/join"
|
||||
LOTTERY_URL = "https://thirtypro.jmhd8.com/api/v1/nongfuwater/snake/checkerboard/lottery"
|
||||
MARKETING_LOTTERY_URL = f"{API_BASE_URL}/geement.marketinglottery/api/v1/marketinglottery"
|
||||
SENIORITY_URL = f"{API_BASE_URL}/geement.usercenter/api/v1/user/seniority"
|
||||
TODAY_COUNT_URL = f"{API_BASE_URL}/geement.actjextra/api/v1/act/lottery/data/todaycount"
|
||||
GOODS_SIMPLE_URL = f"{API_BASE_URL}/geement.actjextra/api/v1/act/win/goods/simple"
|
||||
|
||||
# Headers
|
||||
HEADERS = {
|
||||
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11581",
|
||||
'content-type': "application/x-www-form-urlencoded",
|
||||
'xweb_xhr': "1",
|
||||
'unique_identity': "b78effb9-789e-416c-8e2b-84f7d9dadbb6",
|
||||
'sec-fetch-site': "cross-site",
|
||||
'sec-fetch-mode': "cors",
|
||||
'sec-fetch-dest': "empty",
|
||||
'referer': "https://servicewechat.com/wxd79ec05386a78727/86/page-frame.html",
|
||||
'accept-language': "zh-CN,zh;q=0.9"
|
||||
}
|
||||
|
||||
|
||||
def get_apitokens():
|
||||
tokenString = os.getenv("nfsq")
|
||||
if not tokenString:
|
||||
print('没有配置nfsq')
|
||||
exit()
|
||||
return tokenString.split("#")
|
||||
|
||||
|
||||
def make_request(method, url, headers=None, params=None, json_data=None):
|
||||
try:
|
||||
if method == 'GET':
|
||||
response = requests.get(url, headers=headers, params=params)
|
||||
elif method == 'POST':
|
||||
response = requests.post(url, headers=headers, json=json_data)
|
||||
response.raise_for_status() # Check for HTTP errors
|
||||
return response.json()
|
||||
except requests.RequestException as e:
|
||||
print(f"请求错误: {e}")
|
||||
return None
|
||||
|
||||
|
||||
def login(apitoken):
|
||||
headers = {**HEADERS, 'apitoken': apitoken}
|
||||
response = make_request('GET', USER_INFO_URL, headers=headers)
|
||||
|
||||
# 检查 token 是否失效
|
||||
if response is None or (response and response.get('code') == 401): # 假设 401 表示未授权,即 token 失效
|
||||
print(f"Token '{apitoken}' 失效,请检查!")
|
||||
return None, None
|
||||
|
||||
if response and 'data' in response:
|
||||
data = response['data']
|
||||
return data['user_no'], data['nick_name']
|
||||
return None, None
|
||||
|
||||
|
||||
def get_task_list(apitoken):
|
||||
headers = {**HEADERS, 'apitoken': apitoken}
|
||||
params = {'pageNum': '1', 'pageSize': '10', 'task_status': '2', 'status': '1', 'group_id': '24121016331837'}
|
||||
response = make_request('GET', TASK_LIST_URL, headers=headers, params=params)
|
||||
return response['data'] if response else []
|
||||
|
||||
|
||||
def do_task(taskId, apitoken):
|
||||
headers = {**HEADERS, 'apitoken': apitoken}
|
||||
params = {'action_time': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'task_id': taskId}
|
||||
response = make_request('GET', JOIN_TASK_URL, headers=headers, params=params)
|
||||
print(response)
|
||||
|
||||
|
||||
def lottery(apitoken):
|
||||
payload = {
|
||||
"code": "SCENE-24121018362724",
|
||||
"provice_name": "上海市",
|
||||
"city_name": "上海市",
|
||||
"area_name": "浦东新区",
|
||||
"address": "上海市浦东新区东方路121号",
|
||||
"longitude": 121.520630,
|
||||
"dimension": 31.239136
|
||||
}
|
||||
headers = {**HEADERS, 'apitoken': apitoken, 'Content-Type': "application/json"}
|
||||
response = make_request('POST', LOTTERY_URL, headers=headers, json_data=payload)
|
||||
return response
|
||||
|
||||
|
||||
def marketing_lottery(apitoken, code):
|
||||
payload = {
|
||||
"code": code,
|
||||
"provice_name": "上海市",
|
||||
"city_name": "上海市",
|
||||
"area_name": "浦东新区",
|
||||
"address": "上海市浦东新区东方路121号",
|
||||
"longitude": 121.520630,
|
||||
"dimension": 31.239136
|
||||
}
|
||||
headers = {**HEADERS, 'apitoken': apitoken, 'Content-Type': "application/json"}
|
||||
response = make_request('POST', MARKETING_LOTTERY_URL, headers=headers, json_data=payload)
|
||||
if response and response['code'] == 500:
|
||||
print(response['msg'])
|
||||
elif response and 'data' in response:
|
||||
print(response['data']['prizedto']['prize_name'])
|
||||
|
||||
|
||||
def today_count(apitoken):
|
||||
params = {'act_code': "ACT2412101428048"}
|
||||
headers = {**HEADERS, 'apitoken': apitoken}
|
||||
response = make_request('GET', TODAY_COUNT_URL, headers=headers, params=params)
|
||||
return response['data'] if response else 0
|
||||
|
||||
|
||||
def goods_simple(apitoken):
|
||||
params = {'act_codes': "ACT2412101428048,ACT24121014352835,ACT24121014371732"}
|
||||
headers = {**HEADERS, 'apitoken': apitoken}
|
||||
response = make_request('GET', GOODS_SIMPLE_URL, headers=headers, params=params)
|
||||
return response['data'] if response else []
|
||||
|
||||
|
||||
def process_account(apitoken):
|
||||
user_no, nick_name = login(apitoken)
|
||||
|
||||
# 增加检查,如果 token 失效则直接跳过
|
||||
if user_no is None and nick_name is None:
|
||||
return
|
||||
|
||||
print(f"============账号nick_name:{nick_name or user_no}============")
|
||||
|
||||
everydata_counted = today_count(apitoken)
|
||||
print("每日赠送抽奖", f"[{everydata_counted}/3]")
|
||||
|
||||
if everydata_counted < 3:
|
||||
code = "SCENE-24121018345681"
|
||||
for _ in range(3 - everydata_counted):
|
||||
marketing_lottery(apitoken, code)
|
||||
time.sleep(1)
|
||||
|
||||
task_list = get_task_list(apitoken)
|
||||
print("======执行任务======")
|
||||
for task in task_list:
|
||||
task_name = task["name"]
|
||||
task_status = task["complete_status"]
|
||||
task_id = task['id']
|
||||
allow_complete_count = task["allow_complete_count"]
|
||||
complete_count = task["complete_count"]
|
||||
|
||||
if task_status == 1:
|
||||
print(f"{task_name} 已完成,跳过")
|
||||
else:
|
||||
print(f"开始 {task_name} [{complete_count}/{allow_complete_count}]")
|
||||
for _ in range(allow_complete_count - complete_count):
|
||||
do_task(task_id, apitoken)
|
||||
time.sleep(1)
|
||||
|
||||
print("时来运转游戏")
|
||||
for _ in range(3):
|
||||
lottery_mes = lottery(apitoken)
|
||||
if lottery_mes and lottery_mes["success"] == False:
|
||||
print(lottery_mes['msg'])
|
||||
break
|
||||
else:
|
||||
print(lottery_mes['data'] if lottery_mes else "请求失败")
|
||||
time.sleep(1)
|
||||
|
||||
print("======任务完成情况======")
|
||||
for task in task_list:
|
||||
task_name = task["name"]
|
||||
task_status = task["complete_status"]
|
||||
complete_count = task["complete_count"]
|
||||
allow_complete_count = task["allow_complete_count"]
|
||||
print(f"[{'√' if task_status == 1 else '×'}] {task_name} [{complete_count}/{allow_complete_count}]")
|
||||
|
||||
print("======查询奖品======")
|
||||
goods_list = goods_simple(apitoken)
|
||||
for good in goods_list:
|
||||
if good.get("win_goods_sub_type"):
|
||||
print(good["win_goods_name"])
|
||||
|
||||
if __name__ == '__main__':
|
||||
apitoken_list = get_apitokens()
|
||||
for apitoken in apitoken_list:
|
||||
process_account(apitoken)
|
||||
92
福彩抽奖.py
92
福彩抽奖.py
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -- coding: utf-8 --
|
||||
# -------------------------------
|
||||
# @Author : github@wd210010 https://github.com/wd210010/only_for_happly
|
||||
# @Time : 2024/1/15 9:23
|
||||
# -------------------------------
|
||||
# cron "0 0 8 * * *" script-path=xxx.py,tag=匹配cron用
|
||||
# const $ = new Env('福彩抽奖')
|
||||
import requests,json,os,random,time
|
||||
from urllib.parse import quote
|
||||
|
||||
#活动路径 中国福彩公众号 右下角新年活动
|
||||
#手机号登录后 抓取https://ssqcx-serv.cwlo.com.cn域名下的请求头的Authorization 放入青龙变量或者放入config.sh 变量名为zgfcau 放在config.sh的话 多账号用&分割 放在青龙变量就多建几个变量
|
||||
zgfcaulist =os.getenv("zgfcau").split('&')
|
||||
#推送加 token
|
||||
plustoken =os.getenv("plustoken")
|
||||
|
||||
|
||||
def Push(contents):
|
||||
# plustoken推送
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
json = {"token": plustoken, 'title': '中国福彩抽奖', 'content': contents.replace('\n', '<br>'), "template": "json"}
|
||||
resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json()
|
||||
print('push+推送成功' if resp['code'] == 200 else 'push+推送失败')
|
||||
|
||||
wish = ['财运亨通','事业有成','身体健康','家庭和睦','笑口常开','步步高升','心想事成','万事如意','龙马精神','福禄双全']
|
||||
wishidlist =[]
|
||||
for i in range(len(zgfcaulist)):
|
||||
print(f'账号{i+1}')
|
||||
headers ={
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
|
||||
'Authorization': zgfcaulist[i],
|
||||
}
|
||||
data = random.choice(wish)
|
||||
params = quote(data)
|
||||
print('**开始发送愿望**')
|
||||
try:
|
||||
for j in range(3):
|
||||
resp = requests.post('https://ssqcx-serv.cwlo.com.cn/api/wish/send',headers=headers,data=f'wish={params}')
|
||||
result = json.loads(resp.text)
|
||||
print(result['msg'])
|
||||
if j == 0:
|
||||
wish_id = result['data']['wish_id']
|
||||
wishidlist.append(wish_id)
|
||||
except:
|
||||
print('该Authorization可能无效!')
|
||||
print('**开始抽奖**')
|
||||
try:
|
||||
for i in range(3):
|
||||
resp2 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/lottery/start', headers=headers)
|
||||
result2 = json.loads(resp2.text)
|
||||
# print(result2)
|
||||
success = result2['msg']
|
||||
if success =='成功' and len(result2['data']['lottery_sn'])>0:
|
||||
massage = f'账号{i+1}中奖了!请自行查看'
|
||||
print(massage)
|
||||
Push(contents=massage)
|
||||
elif success =='成功' and len(result2['data']['lottery_sn'])==0:
|
||||
print('未中奖')
|
||||
else:
|
||||
print(success)
|
||||
time.sleep(2)
|
||||
except:
|
||||
print('该Authorization可能无效!')
|
||||
print(wishidlist)
|
||||
print('**开始点赞**')
|
||||
for a in range(len(wishidlist)):
|
||||
for b in range(len(zgfcaulist)):
|
||||
headers2 = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
|
||||
'Authorization': zgfcaulist[b],
|
||||
}
|
||||
resp3 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/wish/zan',headers=headers2,data=f'wish_id={wishidlist[a]}')
|
||||
result3 = json.loads(resp3.text)
|
||||
print(result3)
|
||||
for c in range(len(zgfcaulist)):
|
||||
headers3 = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.45(0x18002d2a) NetType/WIFI Language/zh_CN',
|
||||
'Authorization': zgfcaulist[c],
|
||||
}
|
||||
resp4 = requests.post('https://ssqcx-serv.cwlo.com.cn/api/user/prize', headers=headers3)
|
||||
try:
|
||||
result4 = json.loads(resp4.text)['data']['prize']
|
||||
print(f'账号{c+1}获取已经获得奖品:')
|
||||
print(f'获得奖品数量:{str(len(result4))}')
|
||||
for d in range(len(result4)):
|
||||
print(result4[d]['prize_title'])
|
||||
except:
|
||||
print('*****')
|
||||
160
谐趣ip多账号自动化.py
Normal file
160
谐趣ip多账号自动化.py
Normal file
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
cron: 0 */2 * * *
|
||||
new Env('携趣IP检查');
|
||||
"""
|
||||
# 变量名:xqipck 需要的值:[uid,ukey,vkey]多账户用#隔开或者换行单账号格式用[uid,ukey,vkey]
|
||||
#作者:偷豆豆的大舅哥
|
||||
#版本:1.2
|
||||
#更新时间:2025-02-18
|
||||
#说明:本脚本用于检查携趣IP是否可用,自动添加或删除白名单ip查询ip剩余数量
|
||||
|
||||
import base64
|
||||
import codecs
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
|
||||
def _O0O0(s): return codecs.encode(s, 'rot_13')
|
||||
def _0O0O(s): return codecs.decode(s, 'rot_13')
|
||||
|
||||
_A1B2 = _O0O0("脚本由偷豆豆的大舅哥创作")
|
||||
_C3D4 = _O0O0("475866384")
|
||||
|
||||
def _X1(content, end='\n'): return print(content, end=end) and sys.stdout.flush()
|
||||
|
||||
def _X4(url, params=None):
|
||||
_h = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': 'http://op.xiequ.cn/'
|
||||
}
|
||||
try:
|
||||
_r = requests.get(url, params=params, headers=_h, timeout=10)
|
||||
return _r.text if _r.status_code == 200 else None
|
||||
except: return None
|
||||
|
||||
def _X5():
|
||||
try:
|
||||
_r = requests.get('https://whois.pconline.com.cn/ipJson.jsp?json=true')
|
||||
_r.encoding = 'utf-8'
|
||||
_d = _r.json()
|
||||
return _d.get('ip', None)
|
||||
except: return None
|
||||
|
||||
def _X6():
|
||||
try:
|
||||
_c = os.getenv('xqipck')
|
||||
if not _c: return []
|
||||
_a = []
|
||||
for _i in _c.replace('\n', '#').split('#'):
|
||||
_i = _i.strip()
|
||||
if not _i or not (_i.startswith('[') and _i.endswith(']')): continue
|
||||
_p = _i[1:-1].split('&')
|
||||
if len(_p) != 3: continue
|
||||
_a.append({'uid': _p[0].strip(), 'ukey': _p[1].strip(), 'vkey': _p[2].strip()})
|
||||
return [_x for _x in _a if all(_x.values())]
|
||||
except: return []
|
||||
|
||||
def _X7(uid, ukey):
|
||||
_u = 'http://op.xiequ.cn/ApiUser.aspx'
|
||||
_p = {'act': 'suitdt', 'uid': uid, 'ukey': ukey}
|
||||
_r = _X4(_u, _p)
|
||||
if not _r: return {'success': False}
|
||||
try:
|
||||
_d = json.loads(_r)
|
||||
if _d.get('success') == 'true' and _d.get('data'):
|
||||
_i = _d['data'][0]
|
||||
return {
|
||||
'success': True,
|
||||
'package_type': _i.get('type', ''),
|
||||
'total_ips': int(_i.get('num', 0)),
|
||||
'used_ips': int(_i.get('use', 0)),
|
||||
'remaining_ips': int(_i.get('num', 0)) - int(_i.get('use', 0)),
|
||||
'end_date': _i.get('enddate', ''),
|
||||
'is_valid': _i.get('valid') == 'true'
|
||||
}
|
||||
except: pass
|
||||
return {'success': False}
|
||||
|
||||
def _X8(uid, ukey):
|
||||
_u = 'http://op.xiequ.cn/IpWhiteList.aspx'
|
||||
return _X4(_u, {'uid': uid, 'ukey': ukey, 'act': 'get'}) or ''
|
||||
|
||||
def _X9(uid, ukey, ip):
|
||||
_u = 'http://op.xiequ.cn/IpWhiteList.aspx'
|
||||
_r = _X4(_u, {'uid': uid, 'ukey': ukey, 'act': 'add', 'ip': ip})
|
||||
if not _r: return False
|
||||
if _r == 'Err:IpRep': return True
|
||||
if _r in ['success', 'OK']:
|
||||
time.sleep(1)
|
||||
return ip in (_X8(uid, ukey) or '').split('\n')
|
||||
return False
|
||||
|
||||
def _X10(uid, ukey):
|
||||
_u = 'http://op.xiequ.cn/IpWhiteList.aspx'
|
||||
_r = _X4(_u, {'uid': uid, 'ukey': ukey, 'act': 'del', 'ip': 'all'})
|
||||
return _r in ['success', 'OK'] if _r else False
|
||||
|
||||
def _X11(whitelist, ip):
|
||||
try: return ip in whitelist.split('\n') if whitelist.strip() else False
|
||||
except: return False
|
||||
|
||||
def main():
|
||||
_X1('==== 携趣IP检查任务开始 ====')
|
||||
_X1(f'任务开始时间:{time.strftime("%Y-%m-%d %H:%M:%S")}')
|
||||
|
||||
_a = _X6()
|
||||
_X1(f'已加载 {len(_a)} 个账号')
|
||||
|
||||
_ip = _X5()
|
||||
if not _ip:
|
||||
_X1('获取IP失败')
|
||||
return
|
||||
_X1(f'当前IP:{_ip}')
|
||||
|
||||
for _i, _acc in enumerate(_a, 1):
|
||||
_X1(f'\n检查账号 {_i} (uid: {_acc["uid"]})')
|
||||
_X1('-' * 30)
|
||||
|
||||
_s = _X7(_acc['uid'], _acc['ukey'])
|
||||
if not _s['success']:
|
||||
_X1('获取账号状态失败')
|
||||
continue
|
||||
|
||||
_X1(f'套餐:{_s["package_type"]} (到期:{_s["end_date"]})')
|
||||
_X1(f'IP:总{_s["total_ips"]},已用{_s["used_ips"]},剩余{_s["remaining_ips"]}')
|
||||
|
||||
if not _s['is_valid'] or _s['remaining_ips'] <= 0:
|
||||
_X1('账号无效或无可用IP')
|
||||
continue
|
||||
|
||||
_w = _X8(_acc['uid'], _acc['ukey'])
|
||||
|
||||
if _X11(_w, _ip):
|
||||
if _w.strip().count('\n') > 0:
|
||||
if not _X10(_acc['uid'], _acc['ukey']) or not _X9(_acc['uid'], _acc['ukey'], _ip):
|
||||
continue
|
||||
else: _X1('白名单正常')
|
||||
else:
|
||||
if _w.strip() and not _X10(_acc['uid'], _acc['ukey']): continue
|
||||
if not _X9(_acc['uid'], _acc['ukey'], _ip): continue
|
||||
|
||||
if not _X11(_X8(_acc['uid'], _acc['ukey']), _ip):
|
||||
_X1('白名单更新失败')
|
||||
continue
|
||||
|
||||
_X1(f'✓ 账号可用 (剩余IP:{_s["remaining_ips"]})')
|
||||
return
|
||||
|
||||
_X1('\n==== 携趣IP检查任务结束 ====')
|
||||
_X1(f'任务结束时间:{time.strftime("%Y-%m-%d %H:%M:%S")}')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user