Browse Source

葫芦侠

pull/15/head
张洛 3 years ago
parent
commit
2c34c66fd3
  1. 14
      README.md
  2. 33
      checksendNotify.py
  3. 7
      hlx.py
  4. 25
      sfa.js
  5. 44
      wzyd.py

14
README.md

@ -16,5 +16,15 @@
## 使用方法 ## 使用方法
1拉取仓库 ### 1拉取仓库
https://github.com/yuxian158/check.git
ql repo https://github.com/yuxian158/check.git '' 'checksendNotify'
### 2参数列表
| 值 | 名称 | 例子 | 说明 |
| :----------: | ------------ | ------------------------------------------------------------ | ------------------- |
| 葫芦侠用户名 | hlx_username | '13888888888' | |
| 葫芦侠密钥 | hlx_password | 7607db7a5bbbbbec8c7bbbbbbb | 密码的32位小md5加密 |
| 王者营地 | wzyd | areaId=xxxxxx&roleId=xxxxxx&gameId=xxxxxx&serverId=xxxxxx&gameOpenid=xxxxxx&userId=xxxxxx、&appVersion=xxxxxx&cClientVersionName=xxxxxx&platid=xxxxxx&source=xxxxxx&algorithm=xxxxxx&、version=xxxxxx&timestamp=xxxxxx&appid=xxxxxx&openid=xxxxxx&sig=xxxxxx&encode=2&、msdkEncodeParam=xxxxxx&、cSystem=xxxxxx&h5Get=xxxxxx&msdkToken=&appOpenid=xxxxxx | 抓包获得 |

33
checksendNotify.py

@ -0,0 +1,33 @@
import requests
import os
def message2telegram(tg_api_host, tg_proxy, tg_bot_token, tg_user_id, content):
print("Telegram 推送开始")
send_data = {"chat_id": tg_user_id, "text": content, "disable_web_page_preview": "true"}
if tg_api_host:
url = f"https://{tg_api_host}/bot{tg_bot_token}/sendMessage"
else:
url = f"https://api.telegram.org/bot{tg_bot_token}/sendMessage"
if tg_proxy:
proxies = {
"http": tg_proxy,
"https": tg_proxy,
}
else:
proxies = None
if requests.post(url=url, data=send_data, proxies=proxies) == 200:
print("推送成功")
return 1
else:
print("推送失败")
return 0
def send(content):
tg_api_host = os.environ.get('TG_API_HOST')
tg_proxy = ''
tg_bot_token = os.environ.get('TG_BOT_TOKEN')
tg_user_id = os.environ.get('TG_USER_ID')
message2telegram(tg_api_host=tg_api_host, tg_proxy=tg_proxy, tg_bot_token=tg_bot_token, tg_user_id=tg_user_id,
content=content)

7
hlx.py

@ -2,7 +2,7 @@
import requests import requests
import os import os
from checksendNotify import send
r = requests.Session() r = requests.Session()
@ -101,9 +101,8 @@ def start():
if "hlx_username" in os.environ and "hlx_password" in os.environ: if "hlx_username" in os.environ and "hlx_password" in os.environ:
print('已经在环境中找到用户名和密码,开始执行程序') print('已经在环境中找到用户名和密码,开始执行程序')
res = hlx(os.environ['hlx_username'], os.environ['hlx_password']) res = hlx(os.environ['hlx_username'], os.environ['hlx_password'])
result = 'notify ' + f' \'{scriptName}\'' + f' \'{res}\'' result = f' \'{scriptName}\'' + f' \'{res}\''
print(result) send(result)
else: else:
print('未找到用户名和密码停止执行') print('未找到用户名和密码停止执行')

25
sfa.js

@ -0,0 +1,25 @@
const whitelist = ["/bot"];
const tg_host = "api.telegram.org";
addEventListener('fetch', event =>{
event.respondWith(handleRequest(event.request))
})
function validate(path) {
for (var i = 0; i < whitelist.length; i++) {
if (path.startsWith(whitelist[i])) return true;
}
return false;
}
async function handleRequest(request) {
var u = new URL(request.url);
u.host = tg_host;
if (!validate(u.pathname)) return new Response('Unauthorized', {
status: 403
});
var req = new Request(u, {
method: request.method,
headers: request.headers,
body: request.body
});
const result = await fetch(req);
return result;
}

44
wzyd.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
import json
import os
import time
from urllib import parse
import requests
class WZYDCheckIn:
def __init__(self, check_item):
self.check_item = check_item
@staticmethod
def sign(data):
response = requests.post(url="https://ssl.kohsocialapp.qq.com:10001/play/h5sign", data=data).json()
try:
if response["result"] == 0:
msg = "签到成功"
else:
msg = response["returnMsg"]
except:
msg = "请求失败,请检查接口"
return msg
def main(self):
wzyd_data = self.check_item[0]
data = {k: v[0] for k, v in parse.parse_qs(wzyd_data).items()}
try:
user_id = data.get("userId", "")
except Exception as e:
print(f"获取用户信息失败: {e}")
user_id = "未获取到用户信息"
sign_msg = self.sign(data=data)
msg = f"帐号信息: {user_id}\n签到信息: {sign_msg}"
return msg
if __name__ == "__main__":
if 'wzry' in os.environ:
print('王者营地签到开始')
text = WZYDCheckIn(check_item=os.environ).main()
localtime = time.asctime( time.localtime(time.time()) )
Loading…
Cancel
Save