恩施人才App Python签到脚本
# -*- coding: utf8 -*- | |
# Author: LiaoGuoYin | |
# 使用方法: | |
# 1. 修改 user 中的用户名密码 | |
# 2. 去 https://lbs.qq.com/tool/getpoint/index.html 通过签到地址名来获取对应的经纬度,替换 payload 中 sdd,sjd,swd 字段值 | |
# 3. 运行脚本 | |
# 《浅层逆向恩施人才App,并实现自动签到脚本》文章存档: https://liaoguoyin.com/2019/07/24/EnShiAppFakeSignature.html | |
import requests | |
notification_key = '***' # 改我(可留空) | |
user = { | |
"usercode": "***", # 改我 | |
"userpass": "***", # 改我 | |
} | |
payload = { | |
# https://lbs.qq.com/tool/getpoint/index.html | |
"sdd": "***", # 改我 | |
"sjd": 108.948238, # 改我 | |
"swd": 30.284552, # 改我 | |
"sjwdzbxlx": "腾讯地图", | |
"dsj": "", | |
"sid": "", | |
"ilx": 1, | |
"fywJxsxsxb": "", | |
"sbz": "上班" | |
} | |
headers = { | |
"Host": "119.96.243.148:90", | |
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) " | |
"Mobile/15E148 Html5Plus/1.0", | |
} | |
URL_HOST = 'http://119.96.243.148:90' | |
def main(): | |
session = requests.Session() | |
session.headers = headers | |
try: | |
# Login | |
response = session.post(f"{URL_HOST}/studentLogin.do", data=user) | |
response_json = response.json() | |
if not response_json['object']: | |
print('用户名或密码错误,请检查上文配置文件!') | |
exit(0) | |
login_log = f"{response_json['object']['user']['sxm']}, {response_json['msg']}" | |
print(login_log) | |
# Get the latest internship sid | |
response = session.post(f"{URL_HOST}/mobile/internship/list.do") | |
response_json = response.json() | |
latest_internship = response_json[0] | |
for each in response_json: | |
if each['ssxzt'] == '实习中': | |
latest_internship = each | |
break | |
sxsxid = latest_internship['sid'] | |
latest_internship_log = f"获取岗位成功: {latest_internship['syrdw']} - {latest_internship['szwmc']} - {latest_internship['ssxzt']}" | |
print(latest_internship_log) | |
# Get the history sign records | |
response = session.post(f"{URL_HOST}/mobile/signature/list.do", | |
{'rows': 10, 'page': 1, 'sxsxid': sxsxid}) | |
response_json = response.json() | |
latest_sign_record = response_json[0] | |
latest_sign_record_log = f"获取最近一次签到记录成功: {latest_sign_record['sdd']} - {latest_sign_record['dsj']} - {latest_sign_record['slx']}" | |
print(latest_sign_record_log) | |
# Post to sign | |
payload['fywJxsxsxb'] = sxsxid | |
response = session.post(f"{URL_HOST}/mobile/signature/save.do", json=payload) | |
response_json = response.json() | |
return f'{user["usercode"]}签到成功!', str(response_json) | |
except KeyError as e: | |
return f'{user["usercode"]}签到失败! 估计是改版了', e | |
def run(event, context): | |
result_message, result_detail = main() | |
print(result_message, result_detail) | |
requests.get(f'https://sc.ftqq.com/{notification_key}.send', params={ | |
'text': result_message, | |
'desp': result_detail | |
}) | |
if __name__ == '__main__': | |
run('', '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment