本文主要是介绍青龙面板配置互助码自动获取,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
注:仅限Fake库的脚本。
-
1.登录宝塔面板(http://服务器IP地址:8888/tencentcloud/)
-
2.上传必要文件(这一步可上传也可新建文件自行更改文件)
-
task_before.sh源码:
#!/usr/bin/env bashif [[ $(ls $dir_code) ]]; thenlatest_log=$(ls -r $dir_code | head -1). $dir_code/$latest_log
fi
-
code.sh源码:
#!/usr/bin/env bash## 导入通用变量与函数
dir_shell=/ql/shell
. $dir_shell/share.shenv_name=(FRUITSHARECODESPETSHARECODESPLANT_BEAN_SHARECODESDREAM_FACTORY_SHARE_CODESDDFACTORY_SHARECODESJDZZ_SHARECODESJDJOY_SHARECODESJXNC_SHARECODESBOOKSHOP_SHARECODESJD_CASH_SHARECODESJDSGMH_SHARECODESJDCFD_SHARECODESJDHEALTH_SHARECODES
)
var_name=(ForOtherFruitForOtherPetForOtherBeanForOtherDreamFactoryForOtherJdFactoryForOtherJdzzForOtherJoyForOtherJxncForOtherBookShopForOtherCashForOtherSgmhForOtherCfdForOtherHealth
)name_js=(shufflewzc_faker3_jd_fruitshufflewzc_faker3_jd_petshufflewzc_faker3_jd_plantBeanshufflewzc_faker3_jd_dreamFactoryshufflewzc_faker3_jd_jdfactoryshufflewzc_faker3_jd_jdzzshufflewzc_faker3_jd_crazy_joyshufflewzc_faker3_jd_jxncshufflewzc_faker3_jd_bookshopshufflewzc_faker3_jd_cashshufflewzc_faker3_jd_sgmhshufflewzc_faker3_jd_cfdshufflewzc_faker3_jd_health
)name_config=(FruitPetBeanDreamFactoryJdFactoryJdzzJoyJxncBookShopCashSgmhCfdHealth
)name_chinese=(东东农场东东萌宠京东种豆得豆京喜工厂东东工厂京东赚赚crazyJoy任务京喜农场口袋书店签到领现金闪购盲盒京喜财富岛东东健康社区
)gen_pt_pin_array() {local envs=$(eval echo "\$JD_COOKIE")local array=($(echo $envs | sed 's/&/ /g'))user_sum="${#array[*]}"local tmp1 tmp2 i pt_pin_tempfor i in "${!array[@]}"; dopt_pin_temp=$(echo ${array[i]} | perl -pe "{s|.*pt_pin=([^; ]+)(?=;?).*|\1|; s|%|\\\x|g}")[[ $pt_pin_temp == *\\x* ]] && pt_pin[i]=$(printf $pt_pin_temp) || pt_pin[i]=$pt_pin_tempdone
}export_codes_sub() {local task_name=$1local config_name=$2local chinese_name=$3local config_name_my=My$config_namelocal config_name_for_other=ForOther$config_namelocal i j k m n pt_pin_in_log code tmp_grep tmp_my_code tmp_for_other user_num random_num_listif cd $dir_log/$task_name &>/dev/null && [[ $(ls) ]]; then## 寻找所有互助码以及对应的pt_pini=0pt_pin_in_log=()code=()pt_pin_and_code=$(ls -r *.log | xargs awk -v var="的$chinese_name好友互助码" 'BEGIN{FS="[( )】]+"; OFS="&"} $3~var {print $2,$4}')for line in $pt_pin_and_code; dopt_pin_in_log[i]=$(echo $line | awk -F "&" '{print $1}')code[i]=$(echo $line | awk -F "&" '{print $2}')let i++done## 输出My系列变量if [[ ${#code[*]} -gt 0 ]]; thenfor ((m = 0; m < ${#pt_pin[*]}; m++)); dotmp_my_code=""j=$((m + 1))for ((n = 0; n < ${#code[*]}; n++)); doif [[ ${pt_pin[m]} == ${pt_pin_in_log[n]} ]]; thentmp_my_code=${code[n]}breakfidoneecho "$config_name_my$j='$tmp_my_code'"doneelseecho "## 从日志中未找到任何互助码"fi## 输出ForOther系列变量if [[ ${#code[*]} -gt 0 ]]; thenechocase $HelpType in0) ## 全部一致tmp_for_other=""for ((m = 0; m < ${#pt_pin[*]}; m++)); doj=$((m + 1))tmp_for_other="$tmp_for_other@\${$config_name_my$j}"doneecho "${config_name_for_other}1=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"for ((m = 1; m < ${#pt_pin[*]}; m++)); doj=$((m + 1))echo "$config_name_for_other$j=\"\${${config_name_for_other}1}\""done;;1) ## 均等助力for ((m = 0; m < ${#pt_pin[*]}; m++)); dotmp_for_other=""j=$((m + 1))for ((n = $m; n < $(($user_sum + $m)); n++)); do[[ $m -eq $n ]] && continueif [[ $((n + 1)) -le $user_sum ]]; thenk=$((n + 1))elsek=$((n + 1 - $user_sum))fitmp_for_other="$tmp_for_other@\${$config_name_my$k}"doneecho "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"done;;2) ## 本套脚本内账号间随机顺序助力for ((m = 0; m < ${#pt_pin[*]}; m++)); dotmp_for_other=""random_num_list=$(seq $user_sum | sort -R)j=$((m + 1))for n in $random_num_list; do[[ $j -eq $n ]] && continuetmp_for_other="$tmp_for_other@\${$config_name_my$n}"doneecho "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"done;;*) ## 按编号优先for ((m = 0; m < ${#pt_pin[*]}; m++)); dotmp_for_other=""j=$((m + 1))for ((n = 0; n < ${#pt_pin[*]}; n++)); do[[ $m -eq $n ]] && continuek=$((n + 1))tmp_for_other="$tmp_for_other@\${$config_name_my$k}"doneecho "$config_name_for_other$j=\"$tmp_for_other\"" | perl -pe "s|($config_name_for_other\d+=\")@|\1|"done;;esacfielseecho "## 未运行过 $task_name.js 脚本,未产生日志"fi
}export_all_codes() {gen_pt_pin_arrayecho -e "\n# 从日志提取互助码,如果为空就是所有日志中都没有。\n"echo -n "# 你选择的互助码模板为:"case $HelpType in0)echo "所有账号助力码全部一致。";;1)echo "所有账号机会均等助力。";;2)echo "本套脚本内账号间随机顺序助力。";;*)echo "按账号编号优先。";;esacfor ((i = 0; i < ${#name_js[*]}; i++)); doecho -e "\n## ${name_chinese[i]}:"export_codes_sub "${name_js[i]}" "${name_config[i]}" "${name_chinese[i]}"done
}export_all_codes | perl -pe "{s|京东种豆|种豆|; s|crazyJoy任务|疯狂的JOY|}"combine_sub() {local what_combine=$1local combined_all=""local tmp1 tmp2local envs=$(eval echo "\$JD_COOKIE")local array=($(echo $envs | sed 's/&/ /g'))local user_sum=${#array[*]}for ((i = 1; i <= $user_sum; i++)); dolocal tmp1=$what_combine$ilocal tmp2=${!tmp1}combined_all="$combined_all&$tmp2"doneecho $combined_all | perl -pe "{s|^&||; s|^@+||; s|&@|&|g; s|@+&|&|g; s|@+|@|g; s|@+$||}"
}## 正常依次运行时,组合所有账号的Cookie与互助码
combine_all() {echo -e "\n## 互助变量:"for ((i = 0; i < ${#env_name[*]}; i++)); doresult=$(combine_sub ${var_name[i]})if [[ $result ]]; thenecho "export ${env_name[i]}=\"$result\""fidone
}if [[ $(ls $dir_code) ]]; thenlatest_log=$(ls -r $dir_code | head -1). $dir_code/$latest_logcombine_all
fi
-
文件下载地址https://www.aliyundrive.com/s/1qiTh9Ppsva
-
3.修改code.sh源码
-
双击打开code.sh文件进行源码编辑
编辑红框内的代码,根据自己所拉的库进行代码修改,下列文章包含可选库。
青龙面板搭建_FuSheng_Wu的博客-CSDN博客准备工作:1.购买轻量应用服务器(https://cloud.tencent.com/product/lighthouse) Ps:建议先关注腾讯云服务器的公众号,然后看看有没有活动,正常价买不划算。2.安装宝塔Linux面板(服务器—选择购买的服务器—应用管理)3.开端口(防火墙—添加规则)4.获取宝塔面板登录密码(应用管理—应用内软件信息—登录) username: 账号 password:...https://blog.csdn.net/FuSheng_Wu/article/details/121143511?spm=1001.2014.3001.5501
-
4.创建任务(青龙面板—定时任务—添加任务)
注:任务创建之后先手动运行一次,可能会显示没有助力码,正常现象,所有任务运行一次后生成日志后,此脚本会自己读取日志文件进行自行编辑。
这篇关于青龙面板配置互助码自动获取的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!