forked from vipGhost0/ql_help
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelp.sh
94 lines (89 loc) · 2.45 KB
/
help.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
dir_code=$dir_log/code
default_env_name=(
FRUITSHARECODES
PETSHARECODES
PLANT_BEAN_SHARECODES
DREAM_FACTORY_SHARE_CODES
DDFACTORY_SHARECODES
JDZZ_SHARECODES
JDJOY_SHARECODES
JXNC_SHARECODES
BOOKSHOP_SHARECODES
JD_CASH_SHARECODES
JDSGMH_SHARECODES
JDCFD_SHARECODES
JDHEALTH_SHARECODES
)
default_var_name=(
ForOtherFruit
ForOtherPet
ForOtherBean
ForOtherDreamFactory
ForOtherJdFactory
ForOtherJdzz
ForOtherJoy
ForOtherJxnc
ForOtherBookShop
ForOtherCash
ForOtherSgmh
ForOtherCfd
ForOtherHealth
)
import_help_config () {
[ ! -n "$env_name" ] && env_name=($(echo ${default_env_name[*]}))
[ ! -n "$var_name" ] && var_name=($(echo ${default_var_name[*]}))
}
blockJDCookie() {
local envs=$(eval echo "\$JD_COOKIE")
local array=($(echo $envs | sed 's/&/ /g'))
local block_arr=${BlockPtPin:-""}
local tmp1 i pt_pin_temp
local tempcookies=""
user_sum=${#array[*]}
for ((i = 0; i < $user_sum; i++)); do
pt_pin_temp=$(echo ${array[i]} | perl -pe "{s|.*pt_pin=([^; ]+)(?=;?).*|\1|; s|%|\\\x|g}")
if [[ $block_arr =~ $pt_pin_temp ]];then
##blockPin
block_pin[i]=true
else
block_pin[i]=false
tempcookies="$tempcookies&${array[i]}"
fi
done
export JD_COOKIE=$(echo $tempcookies | perl -pe "{s|^&||; s|^@+||; s|&@|&|g; s|@+&|&|g; s|@+|@|g; s|@+$||}")
}
combine_sub() {
local what_combine=$1
local combined_all=""
local tmp1 tmp2
for ((i = 1; i <= $user_sum; i++)); do
j=$(($i - 1))
if [[ ${block_pin[j]} == true ]]; then
continue 1
fi
local tmp1=$what_combine$i
local tmp2=${!tmp1}
combined_all="$combined_all&$tmp2"
done
echo $combined_all | perl -pe "{s|^&||; s|^@+||; s|&@|&|g; s|@+&|&|g; s|@+|@|g; s|@+$||}"
}
## 正常依次运行时,组合所有账号的Cookie与互助码
combine_all() {
echo "组合所有账号的Cookie与互助码,共"${#env_name[*]}"个"
for ((i = 0; i < ${#env_name[*]}; i++)); do
result=$(combine_sub ${var_name[i]})
if [[ $result ]]; then
export ${env_name[i]}="$result"
fi
done
}
if [[ $p1 == *.js ]]; then
if [[ $AutoHelpOther == true ]] && [[ $(ls $dir_code) ]]; then
echo "导入code生成的互助码"
local latest_log=$(ls -r $dir_code | head -1)
. $dir_code/$latest_log
fi
fi
import_help_config
blockJDCookie
combine_all