From d01f05886c9447ae7e4408db7adf2412b6f57b02 Mon Sep 17 00:00:00 2001 From: Leon <62660101+Oreomeow@users.noreply.github.com> Date: Wed, 21 Jul 2021 23:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AC0721-002=20denpendencies=20&=20curt?= =?UTF-8?q?inlv=20cc=E2=80=99d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/sh/Helpcode2.8/code.sh | 58 ++++++++++++------------- Scripts/sh/Helpcode2.8/config_sample.sh | 36 +++++++++++---- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/Scripts/sh/Helpcode2.8/code.sh b/Scripts/sh/Helpcode2.8/code.sh index 498387d..17ba1c0 100644 --- a/Scripts/sh/Helpcode2.8/code.sh +++ b/Scripts/sh/Helpcode2.8/code.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -## Build 20210721-001 +## Build 20210721-002 ## 导入通用变量与函数 dir_shell=/ql/shell @@ -440,8 +440,10 @@ for ((i=1; i<=100; i++)); do fi # fi fi - elif [[ $i -gt $user_sum ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_my$i")" ]]; then + elif [[ $i -gt $user_sum ]] && [[ $i -gt 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_my$i")" ]]; then sed -i "/^$config_name_my$i/d" $file_task_before + elif [[ $i -eq 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_my$i")" ]]; then + sed -i "s/^$config_name_my$i='\S*'$/$config_name_my$i=''/" $file_task_before fi done @@ -459,8 +461,10 @@ for ((j=1; j<=100; j++)); do if [ "$new_rule" != "$old_rule" ]; then sed -i "s/^$config_name_for_other$j=\"$old_rule\"$/$config_name_for_other$j=\"$new_rule\"/" $file_task_before fi - elif [[ $j -gt $user_sum ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_for_other$j")" ]]; then + elif [[ $j -gt $user_sum ]] && [[ $j -gt 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_for_other$j")" ]]; then sed -i "/^$config_name_for_other$j/d" $file_task_before + elif [[ $j -eq 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name_for_other$j")" ]]; then + sed -i "s/^$config_name_for_other$j=\"\S*\"$/$config_name_for_other$j=\"\"/" $file_task_before fi done } @@ -490,17 +494,19 @@ for ((k=1; k<=100; k++)); do sed -i "s/^$config_name$k='$old_code'$/$config_name$k='$new_code'/" $file_task_before fi fi - elif [[ $k -gt $user_sum ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name$k")" ]]; then + elif [[ $k -gt $user_sum ]] && [[ $k -gt 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name$k")" ]]; then sed -i "/^$config_name$k/d" $file_task_before + elif [[ $k -eq 1 ]] && [[ ! -z "$(cat $file_task_before | grep "^$config_name$k")" ]]; then + sed -i "s/^$config_name$k='\S*'$/$config_name$k=''/" $file_task_before fi done } export_codes_sub_only(){ -if [ "$(cat $dir_scripts/"$repo"_jd_cfd.js | grep "// console.log(\`token")" != "" ]; then - echo -e "\n# 正在修改 "$repo"_jd_cfd.js ,待完全运行 "$repo"_jd_cfd.js 后即可输出 token !" -fi -sed -i 's/.*\(c.*log\).*\(${JSON.*token)}\).*/ \1(\`\\n【京东账号${$.index}(${$.UserName})的京喜token好友互助码】\2\\n\`)/g' /ql/scripts/*_jd_cfd.js + if [ "$(cat $dir_scripts/"$repo"_jd_cfd.js | grep "// console.log(\`token")" != "" ]; then + echo -e "\n# 正在修改 "$repo"_jd_cfd.js ,待完全运行 "$repo"_jd_cfd.js 后即可输出 token !" + fi + sed -i 's/.*\(c.*log\).*\(${JSON.*token)}\).*/ \1(\`\\n【京东账号${$.index}(${$.UserName})的京喜token好友互助码】\2\\n\`)/g' /ql/scripts/*_jd_cfd.js local task_name=$1 local config_name=$2 local chinese_name=$3 @@ -589,12 +595,15 @@ install_dependencies_normal(){ canvas) cd /ql/scripts if [[ "$(npm ls $i)" =~ (empty) ]]; then + if [[ "echo $(npm ls $i) | grep ERR" != "" ]]; then + npm uninstall $i + fi apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source fi ;; typescript) if [[ "$(npm ls $i -g)" =~ (empty) ]]; then - if [[ "$(npm ls $i)" =~ $i ]]; then + if [[ "echo $(npm ls $i -g) | grep ERR" != "" ]]; then npm uninstall $i fi npm i $i -g --force @@ -602,7 +611,7 @@ install_dependencies_normal(){ ;; *) if [[ "$(npm ls $i -g)" =~ (empty) ]]; then - if [[ "$(npm ls $i)" =~ $i ]]; then + if [[ "echo $(npm ls $i -g) | grep ERR" != "" ]]; then npm uninstall $i fi npm i $i -g @@ -614,36 +623,25 @@ install_dependencies_normal(){ install_dependencies_force(){ for i in $@; do - cd /ql/scripts - if [[ "$(npm ls $i)" =~ $i ]]; then - npm uninstall $i - rm -rf /ql/scripts/node_modules/$i - rm -rf /ql/scripts/node_modules/lodash - elif [[ "$(npm ls $i -g)" =~ $i ]]; then - npm uninstall -g $i - rm -rf /usr/local/lib/node_modules/$i - rm -rf /usr/local/lib/node_modules/lodash - fi case $i in canvas) cd /ql/scripts if [[ "$(npm ls $i)" =~ (empty) ]]; then - apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source --force - fi - ;; - typescript) - if [[ "$(npm ls $i -g)" =~ (empty) ]]; then - if [[ "$(npm ls $i)" =~ $i ]]; then + if [[ "$(npm ls $i)" =~ $i ]] || [[ "echo $(npm ls $i) | grep ERR" != "" ]]; then npm uninstall $i fi - npm i $i -g --force + rm -rf /ql/scripts/node_modules/$i + rm -rf /usr/local/lib/node_modules/lodash/* + apk add --no-cache build-base g++ cairo-dev pango-dev giflib-dev && npm i $i --prefix /ql/scripts --build-from-source --force fi ;; *) if [[ "$(npm ls $i -g)" =~ (empty) ]]; then - if [[ "$(npm ls $i)" =~ $i ]]; then + if [[ "$(npm ls $i)" =~ $i ]] || [[ "$(npm ls $i -g)" =~ $i ]] || [[ "echo $(npm ls $i -g) | grep ERR" != "" ]]; then npm uninstall $i fi + rm -rf /usr/local/lib/node_modules/$i + rm -rf /usr/local/lib/node_modules/lodash/* npm i $i -g --force fi ;; @@ -655,9 +653,7 @@ install_dependencies_all(){ install_dependencies_normal $package_name cd /ql/scripts for i in $package_name; do - if [[ "$(npm ls $i -g)" =~ (empty) ]] && [[ "$(npm ls $i)" =~ (empty) ]] || [[ "$(npm ls $i)" =~ ERR ]] || [[ "$(npm ls $i -g)" =~ ERR ]]; then - install_dependencies_force $i - fi + install_dependencies_force $i done } diff --git a/Scripts/sh/Helpcode2.8/config_sample.sh b/Scripts/sh/Helpcode2.8/config_sample.sh index 20632a2..8175ec2 100644 --- a/Scripts/sh/Helpcode2.8/config_sample.sh +++ b/Scripts/sh/Helpcode2.8/config_sample.sh @@ -1,6 +1,6 @@ ## Version: v2.8.0 ## Date: 2021-06-20 -## Mod: Build20210717-001 +## Mod: Build20210721-001 ## Update Content: 可持续发展纲要\n1. session管理破坏性修改\n2. 配置管理可编辑config下文件\n3. 自定义脚本改为查看脚本\n4. 移除互助相关 ## 上面版本号中,如果第2位数字有变化,那么代表增加了新的参数,如果只有第3位数字有变化,仅代表更新了注释,没有增加新的参数,可更新可不更新 @@ -109,21 +109,24 @@ export GOBOT_TOKEN="" export GOBOT_QQ="" ## 10. 临时屏蔽某个Cookie -## 如果某些Cookie已经失效了,但暂时还没法更新,可以使用此功能在不删除该Cookie和重新修改Cookie编号的前提下,临时屏蔽掉某些编号的Cookie +## 如果某些 Cookie 已经失效了,但暂时还没法更新,可以使用此功能在不删除该Cookie和重新修改Cookie编号的前提下,临时屏蔽掉某些编号的Cookie ## 多个Cookie编号以半角的空格分隔,两侧一对半角双引号,使用此功能后,在运行js脚本时账户编号将发生变化 -## 举例1:TempBlockCookie="2" 临时屏蔽掉Cookie2 -## 举例2:TempBlockCookie="2 4" 临时屏蔽掉Cookie2和Cookie4 +## 举例1:TempBlockCookie="2" 临时屏蔽掉 Cookie2 +## 举例2:TempBlockCookie="2 4" 临时屏蔽掉 Cookie2 和 Cookie4 -## 如果只是想要屏蔽某个账号不参加某些活动,可以参考下面 case 这个命令的例子来控制 +## 如果只是想要屏蔽某个 Cookie 不参加某些活动,可以参考下面 case 这个命令的例子来控制 ## case $1 in ## *jd_fruit*) # 东东农场活动脚本关键词 -## TempBlockCookie="5" # 账号5不玩东东农场 +## TempBlockCookie="5" # Cookie5 不玩东东农场 ## ;; ## *jd_dreamFactory* | *jd_jdfactory*) # 京喜工厂和东东工厂的活动脚本关键词 -## TempBlockCookie="2" # 账号2不玩京喜工厂和东东工厂 +## TempBlockCookie="2" # Cookie2 不玩京喜工厂和东东工厂 ## ;; ## *jd_jdzz* | *jd_joy*) # 京喜赚赚和宠汪汪的活动脚本关键词 -## TempBlockCookie="3 6" # 账号3、账号6不玩京东赚赚和宠汪汪 +## TempBlockCookie="3 6" # Cookie3 、Cookie6 不玩京东赚赚和宠汪汪 +## ;; +## *) # 其他活动 +## TempBlockCookie="" # 默认为空值,表示其他帐号参加全部活动。填写帐号序号表示临时屏蔽指定 Cookie 参加其他活动 ## ;; ## esac case $1 in @@ -136,6 +139,9 @@ case $1 in *jd_jdzz* | *jd_joy*) TempBlockCookie="" ;; + *) + TempBlockCookie="" + ;; esac ## 其他需要的变量,脚本中需要的变量使用 export 变量名= 声明即可 @@ -352,7 +358,11 @@ export zlzh=$(echo $JD_COOKIE | sed "s/&/ /g; s/\S*pt_pin=\(\S\+\);\S*/\'\1\',/g export qjd_zlzh=$(echo $JD_COOKIE | sed "s/&/ /g; s/\S*pt_pin=\(\S\+\);\S*/\'\1\',/g; s/^/[/; s/$\|,$/]/;" | awk 'BEGIN{for(i=0;i<10;i++)hex[i]=i;hex["A"]=hex["a"]=10;hex["B"]=hex["b"]=11;hex["C"]=hex["c"]=12;hex["D"]=hex["d"]=13;hex["E"]=hex["e"]=14;hex["F"]=hex["f"]=15;}{gsub(/\+/," ");i=$0;while(match(i,/%../)){;if(RSTART>1);printf"%s",substr(i,1,RSTART-1);printf"%c",hex[substr(i,RSTART+1,1)]*16+hex[substr(i,RSTART+2,1)];i=substr(i,RSTART+RLENGTH);}print i;}') ## 支持中文用户名 ## 3、签到领现金助力 export cash_zlzh=$(echo $JD_COOKIE | sed "s/&/ /g; s/\S*pt_pin=\(\S\+\);\S*/\'\1\',/g; s/^/[/; s/$\|,$/]/;" | awk 'BEGIN{for(i=0;i<10;i++)hex[i]=i;hex["A"]=hex["a"]=10;hex["B"]=hex["b"]=11;hex["C"]=hex["c"]=12;hex["D"]=hex["d"]=13;hex["E"]=hex["e"]=14;hex["F"]=hex["f"]=15;}{gsub(/\+/," ");i=$0;while(match(i,/%../)){;if(RSTART>1);printf"%s",substr(i,1,RSTART-1);printf"%c",hex[substr(i,RSTART+1,1)]*16+hex[substr(i,RSTART+2,1)];i=substr(i,RSTART+RLENGTH);}print i;}') ## 支持中文用户名 -## 4、入会开卡 +## 4、京喜工厂开团助力 for Python +### 支持指定账号开团,跑1次脚本默认开3次团,如未指定账号默认给账号一开团。 +### 变量ENV 指定开团账号。可填用户名 或 pt_pin 的值。示例:export jxgc_kaituan="用户1&用户2" +export jxgc_kaituan="$(echo $JD_COOKIE | sed "s/&/ /g; s/\S*pt_pin=\(\S\+\)\S*;/\1/g; s/ /\&/g;" | awk 'BEGIN{for(i=0;i<10;i++)hex[i]=i;hex["A"]=hex["a"]=10;hex["B"]=hex["b"]=11;hex["C"]=hex["c"]=12;hex["D"]=hex["d"]=13;hex["E"]=hex["e"]=14;hex["F"]=hex["f"]=15;}{gsub(/\+/," ");i=$0;while(match(i,/%../)){;if(RSTART>1);printf"%s",substr(i,1,RSTART-1);printf"%c",hex[substr(i,RSTART+1,1)]*16+hex[substr(i,RSTART+2,1)];i=substr(i,RSTART+RLENGTH);}print i;}')" +## 5、入会开卡 ### int,入会送豆满足此值,否则不入会 export openCardBean="30" ### 布尔值,是否记录符合条件的shopid(默认True) @@ -420,6 +430,14 @@ export olympicgames_inviteId="" ### export exchangeAccounts="$(echo $JD_COOKIE | sed "s/&/\n/g; s/\S*;pt_pin=\(\S\+\);\S*/\1@10/g; s/\n/\&/g;")" ##兑10元现金,比较难兑 export exchangeAccounts="$(echo $JD_COOKIE | sed "s/&/ /g; s/\S*pt_pin=\(\S\+\);\S*/\1@2/g; s/ /&/g;")" ##兑2元现金 +# JDHelloWorld 环境变量 +## 1、新版京喜财富岛提现 +### 提现金额,可选0.1 0.5 1 2 10 +export CFD_CASHOUT_MONEY=10 +### token,顺序、数量必须与cookie一致。抓包地址:https://m.jingxi.com/jxbfd/user/ExchangePrize +### export CFD_CASH_TOKEN='[{"strPgtimestamp":"你的值","strPhoneID":"你的值","strPgUUNum":"你的值"},{"strPgtimestamp":"你的值","strPhoneID":"你的值","strPgUUNum":"你的值"}]' +export CFD_CASH_TOKEN='[{"strPgtimestamp":"1626623544085","strPhoneID":"878e21db65d2d606","strPgUUNum":"56eaaf98f7d7a69c59e50c6bb40e79c1"}]' + ## 其他命令: ## 1、一键改写京东兑蓝币脚本的cookies;需手动运行 (已集成至最新的 code.sh) ## sed -i "s/cookies=''/cookies='$(. /ql/shell/share.sh && . /ql/config/env.sh && echo $JD_COOKIE)'/g" /ql/scripts/*_jd_blueCoin.py