1 # inside url we need domain, username and password
2 [ -z "$domain" ] && write_log
14 "Service section not configured correctly! Missing 'domain'"
3 [ -z "$username" ] && write_log
14 "Service section not configured correctly! Missing 'username'"
4 [ -z "$password" ] && write_log
14 "Service section not configured correctly! Missing 'password'"
6 local urlCp
='http://cp.cnkuai.cn/'
7 local urlLogin
='http://cp.cnkuai.cn/userlogin.asp'
8 local urlCaptcha
='http://cp.cnkuai.cn/inc/image.asp'
9 local urlDnsA
='http://cp.cnkuai.cn/dns_a.asp'
10 local urlDnsAAAA
='http://cp.cnkuai.cn/dns_ipv6.asp'
11 local urlDnsSave
='http://cp.cnkuai.cn/dns_save.asp'
19 hexdump -s "$((x+width*y))" -n 3 -e '3/1 "%02X"' "$filename"
26 if [ "$(getPixel "$filename" $((xoffset+2)) 5)" = '000000' ]; then
28 elif [ "$(getPixel "$filename" $((xoffset+5)) 7)" = '000000' ]; then
30 elif [ "$(getPixel "$filename" $((xoffset+4)) 3)" = '000000' ]; then
32 elif [ "$(getPixel "$filename" $((xoffset+6)) 4)" = '000000' ]; then
34 elif [ "$(getPixel "$filename" $((xoffset+5)) 8)" = '000000' ]; then
36 elif [ "$(getPixel "$filename" $((xoffset+6)) 8)" = '000000' ]; then
38 elif [ "$(getPixel "$filename" $((xoffset+5)) 6)" = '000000' ]; then
40 elif [ "$(getPixel "$filename" $((xoffset+0)) 4)" = '000000' ]; then
42 elif [ "$(getPixel "$filename" $((xoffset+1)) 5)" = '000000' ]; then
51 str
=$
(captchaChar
"$1" 9)
52 str
=$str$
(captchaChar
"$1" 18)
53 str
=$str$
(captchaChar
"$1" 26)
54 str
=$str$
(captchaChar
"$1" 35)
60 #login to cnkuai dns cp
61 curl
-c '/tmp/cnkuai.cookiejar' "$urlCaptcha" | gif2rgb
> /tmp
/cnkuai.rgb ||
return 1
62 yzm
=$
(captcha
"/tmp/cnkuai.rgb")
63 curl
-b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' -H "Content-Type: application/x-www-form-urlencoded" -H "Referer: $urlCp" -d "userid=$URL_USER&password=$URL_PASS&yzm=$yzm&B1=%C8%B7%C8%CF%B5%C7%C2%BD&lx=0&userlx=3" -X POST
"$urlLogin" > /dev
/null ||
return 1
65 if [ "$use_ipv6" -eq 0 ]; then
66 curl
-b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' "$urlDnsA" > /tmp
/cnkuai.html ||
return 1
68 curl
-b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' "$urlDnsAAAA" > /tmp
/cnkuai.html ||
return 1
71 domainline
=$
(awk "/<td>$domain<\/td>/{ print NR; exit }" /tmp
/cnkuai.html
)
73 domainid
=$
(awk "NR==$((domainline+3))" /tmp
/cnkuai.html |
sed 's/^.*name=\x27domainid\x27 value="//g' |
sed 's/".*$//g')
75 dnslistid
=$
(awk "NR==$((domainline+3))" /tmp
/cnkuai.html |
sed 's/^.*name=\x27dnslistid\x27 value="//g' |
sed 's/".*$//g')
79 if [ "$use_ipv6" -eq 0 ]; then
80 data
="T2=$__IP&T3=120&act=dns_a_edit&domainid=$domainid&dnslistid=$dnslistid&B1=%D0%DE%B8%C4"
82 data
="T2=$__IP&T3=120&act=dns_ipv6_edit&domainid=$domainid&dnslistid=$dnslistid&B1=%D0%DE%B8%C4"
84 curl
-b '/tmp/cnkuai.cookiejar' -c '/tmp/cnkuai.cookiejar' -H "Content-Type: application/x-www-form-urlencoded" -H "Referer: $urlDnsA" -d "$data" -X POST
"$urlDnsSave" > /dev
/null ||
return 1