Created
November 4, 2016 08:44
-
-
Save inmyfree/579e9781aeb4de2a2bad2bb60af7db6b to your computer and use it in GitHub Desktop.
curlproxy.sh
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
#!/bin/bash | |
cd /mnt/media_a/proxyconfig/ | |
mkdir tmp html result | |
for ((i=1;i<8;i++)) | |
do | |
curl https://kya.cc/?page=$i > ./html/proxy.html | |
#获取代理名称 | |
cat ./html/proxy.html |awk '/<strong class="fe">/, /<\/strong>/' | grep -o "[^ ]\+\( \+[^ ]\+\)*" > ./tmp/addressName.log | |
#获取代理的ss配置 | |
cat ./html/proxy.html |awk '/data-url="ss:/, /"/' | grep -o "[^ ]\+\( \+[^ ]\+\)*" > ./tmp/ssbase64.log | |
paste ./tmp/ssbase64.log ./tmp/addressName.log > ./result/$i.txt | |
done | |
cat ./result/*.txt > result.txt | |
sed -i "s/<strong class=\"fe\">//g" ./result.txt | |
sed -i "s/<\/strong>//g" ./result.txt | |
sed -i "s/<span class=\"list-group-item\" data-qr=\"/https:\/\/kya.cc/g" ./result.txt | |
sed -i "s/\" data-url=\"/ /g" ./result.txt | |
sed -i "s/\" title=\"配置链接和二维码\">//g" ./result.txt | |
cat result.txt |awk '{print $2}' > ./tmp/ss.log | |
sed -i "s/ss:\/\///g" ./tmp/ss.log | |
rm -rf ./tmp/ss1.log | |
while read line | |
do | |
echo $line|base64 -d >> ./tmp/ss1.log | |
echo -e "\r" >>./tmp/ss1.log | |
done < ./tmp/ss.log | |
paste ./result.txt ./tmp/ss1.log > ./result1.txt | |
mv result1.txt result.txt | |
cat result.txt |awk '{print $3"\t\t", $4"\t" }'|sort|uniq > ./proxy.conf | |
chmod 777 ./proxy.conf | |
echo -e "\n update: " `date` "\n data format: encryption mode:password@host ip:port \n site: https://kya.cc \n client down: https://kya.cc/download \n github down: https://github.com/shadowsocks/shadowsocks-windows/releases" >> ./proxy.conf | |
curl www.ishadowsocks.org > ./tmp/ishadowsocks.html | |
cat ./tmp/ishadowsocks.html |awk '/<section id="free">/, /<\/section>/'|awk '/<div class="col-sm-4 text-center">/, /<\/div>/' > ./tmp/item.html | |
sed -i "s/<div class=\"col-sm-4 text-center\">//g" ./tmp/item.html | |
sed -i "s/<h4><font color=\"red\">注意:每6小时更换一次密码<\/font><\/h4>//g" ./tmp/item.html | |
sed -i "s/<\/div>/\r\n/g" ./tmp/item.html | |
sed -i "s/<font color=\"green\">//g" ./tmp/item.html | |
sed -i "s/<\/font>//g" ./tmp/item.html | |
sed -i "s/<h4>//g" ./tmp/item.html | |
sed -i "s/<\/h4>//g" ./tmp/item.html | |
grep -o "[^ ]\+\( \+[^ ]\+\)*" ./tmp/item.html > proxy.ishadowsocks.conf | |
rm -rf ./html/ ./result/ ./tmp/ result.txt | |
cat proxy.ishadowsocks.conf proxy.conf >proxyall.conf | |
rm proxy.ishadowsocks.conf proxy.conf | |
mv proxyall.conf proxy.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment