-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
372 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 特别声明: | ||
|
||
- 本仓库发布的 MyActions 项目中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断. | ||
|
||
- 本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。 | ||
|
||
- sazs34 对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害. | ||
|
||
- 间接使用脚本的任何用户,包括但不限于建立 VPS 或在某些行为违反国家/地区法律或相关法规的情况下进行传播, sazs34 对于由此引起的任何隐私泄漏或其他后果概不负责. | ||
|
||
- 请勿将 MyActions 项目的任何内容用于商业或非法目的,否则后果自负. | ||
|
||
- 如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我们将在收到认证文件后删除相关脚本. | ||
|
||
- 任何以任何方式查看此项目的人或直接或间接使用该 MyActions 项目的任何脚本的使用者都应仔细阅读此声明。sazs34 保留随时更改或补充此免责声明的权利。一旦使用并复制了任何相关脚本或 MyActions 项目的规则,则视为您已接受此免责声明. | ||
|
||
**您必须在下载后的 24 小时内从计算机或手机中完全删除以上内容.** </br> | ||
|
||
> **_您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此声明,请仔细阅读_** | ||
|
||
# 说明: | ||
|
||
鉴于 lxk0301 大佬的分支因为 fork 过多用于执行 actions 导致被删,为了防范于未然 | ||
|
||
> 麻烦各位**不要 fork**`不要fork` _不要 fork_ 不要 fork [不要 fork](backup/reposync.md) ,通过下面的方法重新创建分支,同步代码 | ||
[此方式亲测可行,请放心食用,点击查看如何使用 reposync 的方式进行同步代码](backup/reposync.md) | ||
|
||
[此方式亲测可行,请放心食用,点击查看如何使用 reposync 的方式进行同步代码](backup/reposync.md) | ||
|
||
[此方式亲测可行,请放心食用,点击查看如何使用 reposync 的方式进行同步代码](backup/reposync.md) | ||
|
||
|
||
## 使用教程 | ||
|
||
1. [按照这个教程进行 reposync](backup/reposync.md) | ||
2. 再在`Settings`-`Secrets`里面添加`JD_COOKIE` | ||
3. 多条 cookie 用`&`隔开,支持无数条 cookie | ||
4. 前三步之后,点击一下右上角的 star(fork 左边那个),让 workflow 运行一次。 | ||
|
||
上面四步搞定后就不用管了。 | ||
|
||
更多Secrets配置[点击查看](backup/secrets.md) | ||
|
||
|
||
> 具体如何取 cookie 如何配置,可参考 [lxk0301 的获取京东Cookies教程](https://github.com/lxk0301/jd_scripts/blob/master/githubAction.md#%E4%BA%AC%E4%B8%9Ccookie) | ||
|
||
## 鸣谢 | ||
|
||
[@NobyDa](https://github.com/NobyDa) - 京东每日签到 | ||
|
||
[@lxk0301](https://github.com/lxk0301) - 京东系列其他签到 | ||
|
||
[@yangtingxiao](https://github.com/yangtingxiao) - 京东排行榜,天天提额 | ||
|
||
[@Zero-S1](https://github.com/Zero-S1/xmly_speed) - 喜马拉雅极速版签到 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const exec = require("child_process").execSync; | ||
const fs = require("fs"); | ||
const axios = require("axios"); | ||
const smartReplace = require("./smartReplace"); | ||
|
||
async function changeFiele() { | ||
let response = await axios.get(process.env.SYNCURL); | ||
let content = response.data; | ||
content = await smartReplace.inject(content); | ||
await fs.writeFileSync("./executeOnce.js", content, "utf8"); | ||
console.log("替换变量完毕"); | ||
} | ||
|
||
async function start() { | ||
console.log(`北京时间 (UTC+08):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}}`); | ||
if (process.env.JD_COOKIE) { | ||
console.log(`当前共${process.env.JD_COOKIE.split("&").length}个账号需要签到`); | ||
} else { | ||
console.log("请填写 JD_COOKIE 后在继续"); | ||
} | ||
if (!process.env.SYNCURL) { | ||
console.log("请填写 SYNCURL 后在继续"); | ||
return; | ||
} | ||
|
||
try { | ||
await changeFiele(); | ||
await exec("node executeOnce.js", { stdio: "inherit" }); | ||
} catch (e) { | ||
console.log("执行异常:" + e); | ||
} | ||
console.log("执行完毕"); | ||
} | ||
|
||
start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "myactions", | ||
"version": "1.0.0", | ||
"description": "sign everything", | ||
"main": "app.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sazn1314/MyActions.git" | ||
}, | ||
"keywords": [ | ||
"sign" | ||
], | ||
"author": "sazs", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/sazn1314/MyActions/issues" | ||
}, | ||
"homepage": "https://github.com/sazn1314/MyActions#readme", | ||
"dependencies": { | ||
"request": "^2.88.2", | ||
"request-promise": "^4.2.5", | ||
"crypto-js": "^4.0.0", | ||
"got": "^11.5.1", | ||
"http-server": "^0.12.3", | ||
"node-schedule": "^1.3.2", | ||
"tough-cookie": "^4.0.0", | ||
"tunnel": "0.0.6", | ||
"axios": "0.20.0", | ||
"download": "^8.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
requests | ||
rsa | ||
python-dateutil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
const axios = require("axios"); | ||
const fs = require("fs"); | ||
const replacements = []; | ||
var remoteContent; | ||
async function init(content) { | ||
remoteContent = content; | ||
await inject(); | ||
return batchReplace(remoteContent); | ||
} | ||
//#region 注入代码 | ||
async function inject() { | ||
await inject_jd(); | ||
} | ||
|
||
async function inject_jd() { | ||
if (!process.env.JD_COOKIE) return; | ||
if (remoteContent.indexOf("function requireConfig()") >= 0 && remoteContent.indexOf("jd_bean_sign.js") >= 0) { | ||
replacements.push({ | ||
key: "resultPath = err ? '/tmp/result.txt' : resultPath;", | ||
value: `resultPath = err ? './tmp/result.txt' : resultPath;`, | ||
}); | ||
replacements.push({ | ||
key: "JD_DailyBonusPath = err ? '/tmp/JD_DailyBonus.js' : JD_DailyBonusPath;", | ||
value: `JD_DailyBonusPath = err ? './tmp/JD_DailyBonus.js' : JD_DailyBonusPath;`, | ||
}); | ||
replacements.push({ | ||
key: "outPutUrl = err ? '/tmp/' : outPutUrl;", | ||
value: `outPutUrl = err ? './tmp/' : outPutUrl;`, | ||
}); | ||
} | ||
await downloader_jd(); | ||
await downloader_notify(); | ||
} | ||
|
||
function batchReplace() { | ||
for (var i = 0; i < replacements.length; i++) { | ||
remoteContent = remoteContent.replace(replacements[i].key, replacements[i].value); | ||
} | ||
// console.log(remoteContent); | ||
return remoteContent; | ||
} | ||
//#endregion | ||
|
||
//#region 文件下载 | ||
|
||
async function downloader_jd() { | ||
if (/require\(['"`]{1}.\/jdCookie.js['"`]{1}\)/.test(remoteContent)) | ||
await download("https://github.com/lxk0301/jd_scripts/raw/master/jdCookie.js", "./jdCookie.js", "京东Cookies"); | ||
if (remoteContent.indexOf("jdFruitShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdFruitShareCodes.js", | ||
"./jdFruitShareCodes.js", | ||
"东东农场互助码" | ||
); | ||
} | ||
if (remoteContent.indexOf("jdPetShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdPetShareCodes.js", | ||
"./jdPetShareCodes.js", | ||
"京东萌宠" | ||
); | ||
} | ||
if (remoteContent.indexOf("jdPlantBeanShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdPlantBeanShareCodes.js", | ||
"./jdPlantBeanShareCodes.js", | ||
"种豆得豆互助码" | ||
); | ||
} | ||
if (remoteContent.indexOf("jdSuperMarketShareCodes") > 0) | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdSuperMarketShareCodes.js", | ||
"./jdSuperMarketShareCodes.js", | ||
"京小超互助码" | ||
); | ||
if (remoteContent.indexOf("jdFactoryShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdFactoryShareCodes.js", | ||
"./jdFactoryShareCodes.js", | ||
"东东工厂互助码" | ||
); | ||
} | ||
if (remoteContent.indexOf("jdDreamFactoryShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdDreamFactoryShareCodes.js", | ||
"./jdDreamFactoryShareCodes.js", | ||
"京喜工厂互助码" | ||
); | ||
} | ||
if (remoteContent.indexOf("jdJxStoryShareCodes") > 0) { | ||
await download( | ||
"https://github.com/lxk0301/jd_scripts/raw/master/jdJxStoryShareCodes.js", | ||
"./jdJxStoryShareCodes.js", | ||
"京喜故事互助码" | ||
); | ||
} | ||
} | ||
|
||
async function downloader_notify() { | ||
await download("https://github.com/lxk0301/jd_scripts/raw/master/sendNotify.js", "./sendNotify.js", "统一通知"); | ||
} | ||
|
||
async function download(url, path, target) { | ||
let response = await axios.get(url); | ||
let fcontent = response.data; | ||
await fs.writeFileSync(path, fcontent, "utf8"); | ||
console.log(`下载${target}完毕`); | ||
} | ||
//#endregion | ||
|
||
module.exports = { | ||
inject: init, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import requests | ||
import os | ||
import re | ||
import time | ||
from datetime import datetime | ||
from dateutil import tz | ||
|
||
|
||
def loadFileContent(downloadUrl): | ||
return requests.get(downloadUrl).text | ||
|
||
|
||
def writeFile(content, fileName): | ||
file = './'+fileName | ||
with open(file, 'w', encoding='utf-8') as f: | ||
f.write(content.replace('\r\n', '\n')) | ||
|
||
|
||
def safe_cast(val, to_type, default=None): | ||
try: | ||
return to_type(val) | ||
except (ValueError, TypeError): | ||
return default | ||
|
||
|
||
def readSecret(key): | ||
if key in os.environ and not os.environ[key].strip() == '': | ||
return os.environ[key] | ||
else: | ||
return None | ||
|
||
|
||
def isOver(): | ||
hourLimit = readSecret("XMLY_ACCUMULATE_HOURS") | ||
print("HOURS:"+str(safe_cast(hourLimit, int, -1))) | ||
if not hourLimit is None and safe_cast(hourLimit, int, 0) > 0: | ||
date_stamp = (int(time.time())-57600) % 86400 | ||
print(datetime.now(tz=tz.gettz('Asia/Shanghai') | ||
).strftime("%Y-%m-%d %H:%M:%S", )) | ||
print("今日已过秒数: ", date_stamp) | ||
if date_stamp > int(hourLimit) * 60 * 60: | ||
return True | ||
else: | ||
return False | ||
else: | ||
print("未配置XMLY_ACCUMULATE_HOURS,因此不会对执行时长进行限制") | ||
return False | ||
|
||
|
||
def isJumpIndex(idx): | ||
indexLimit = readSecret("XMLY_ACCUMULATE_INDEX") | ||
if indexLimit is None: | ||
return False | ||
xmly_accumulate_index = [safe_cast(i, int, -1) | ||
for i in indexLimit.split(",")] | ||
if len(xmly_accumulate_index) <= 0: | ||
xmly_accumulate_index = None | ||
index = -1 | ||
try: | ||
index = xmly_accumulate_index.index(idx+1) | ||
except ValueError: | ||
print("无需禁用") | ||
return index >= 0 | ||
|
||
|
||
def smartNotify(content): | ||
notify_bark = readSecret("BARK_PUSH") | ||
notify_serverJ = readSecret("PUSH_KEY") | ||
# notify_tg_token = readSecret("TG_BOT_TOKEN") | ||
# notify_tg_userId = readSecret("TG_USER_ID") | ||
if not content: | ||
return content | ||
if notify_bark is not None: | ||
print("bark通知已开启") | ||
content = content.replace( | ||
'bark_token = BARK', 'bark_token="'+notify_bark+'"', 1) | ||
if notify_serverJ is not None: | ||
print("server酱通知已开启") | ||
content = content.replace( | ||
'sckey = SCKEY', 'sckey="'+notify_serverJ+'"', 1) | ||
# if notify_tg_token is not None and notify_tg_userId is not None: | ||
# content = content.replace("", "") | ||
|
||
# only for test | ||
# content = content.replace( | ||
# 'if _notify_time.split()[0] == str(notify_time) and int(_notify_time.split()[1]) > 30:', 'if True:', 1) | ||
return content | ||
|
||
|
||
def run(): | ||
cookies = readSecret("XMLY_SPEED_COOKIE") | ||
if cookies is None: | ||
print("无法获取Cookie,请在Secrets中配置XMLY_SPEED_COOKIE") | ||
return | ||
print("\n同步文件中...") | ||
webFileContent = loadFileContent(os.environ["SYNCURL"]) | ||
print("\n文件同步完毕, 处理中...") | ||
agentPattern = re.compile(r'UserAgent = \"[\d\D]*?\"', re.S) | ||
|
||
rewriteAgent = readSecret("XMLY_ANDROID_AGENT") | ||
if rewriteAgent is None: | ||
rewriteAgent = 'UserAgent = "ting_1.8.30(Redmi+7,Android28)"' | ||
else: | ||
rewriteAgent = 'UserAgent = "' + rewriteAgent + '"' | ||
|
||
for idx, xmlyCookie in enumerate(cookies.split('\n')): | ||
executeContent = webFileContent.replace( | ||
'xmly_speed_cookie = os.environ["XMLY_SPEED_COOKIE"]', 'xmly_speed_cookie = "' + xmlyCookie + '"', 1) | ||
if xmlyCookie.find("_device=android") > 0: # 此时表示是获取的安卓的cookie,需要使用安卓的agent | ||
executeContent = re.sub(agentPattern, rewriteAgent, executeContent) | ||
if isOver(): | ||
executeContent = executeContent.replace("XMLY_ACCUMULATE_TIME = 1", "XMLY_ACCUMULATE_TIME = 0", 1).replace( | ||
"action 自动刷时长打开", "action 自动刷时长2指定关闭", 1) | ||
print("已接受XMLY_ACCUMULATE_HOURS配置,为索引" + | ||
str(idx)+"的数据执行了禁用当天继续刷新时长的操作") | ||
if isJumpIndex(idx+1): | ||
executeContent = executeContent.replace("XMLY_ACCUMULATE_TIME = 1", "XMLY_ACCUMULATE_TIME = 0", 1).replace( | ||
"action 自动刷时长打开", "action 自动刷时长被指定关闭", 1) | ||
print("已接受XMLY_ACCUMULATE_INDEX配置,为索引" + | ||
str(idx)+"的数据执行了禁用当天刷新时长的操作") | ||
executeContent = smartNotify(executeContent) | ||
writeFile(executeContent, 'execute'+str(idx)+'.py') | ||
os.system('python ./'+'execute'+str(idx)+'.py') | ||
print("\n***************************\n文件全部执行完毕") | ||
exit(0) | ||
|
||
|
||
run() |