Last active
July 19, 2016 14:26
-
-
Save Femtometer/50a014c30a0919b7a48a372c8a95f51b to your computer and use it in GitHub Desktop.
Command line PAC generate code for OSX
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 | |
// Generate gfwlist.js for ShadowsocksX | |
// Install gfwlist2pac in python2.7 | |
// Download gfwlist.txt from github | |
// Use "sh code.sh" to generate. | |
PROXY="127.0.0.1:1080" | |
TXTROOT="/Users/USRNAME/desktop" | |
# 下载PAC与SH文件同级目录 | |
check_module_installed() | |
{ | |
pip2 list | grep gfwlist2pac &> /dev/null | |
if [ $? -eq 1 ]; then | |
echo "Installing gfwlist2pac." | |
pip2 install gfwlist2pac | |
fi | |
} | |
update_gfwlist() | |
{ | |
ls | grep gfwlist.txt | |
cd ~/.ShadowsocksX || exit 1 | |
if [ -f "gfwlist.js" ]; then | |
echo "Del old file." | |
mv gfwlist.js ~/.Trash | |
fi | |
gfwlist2pac \ | |
--input $TXTROOT/gfwlist.txt \ | |
--file ./gfwlist.js \ | |
--proxy "SOCKS5 $PROXY; SOCKS $PROXY; DIRECT;" \ | |
--precise | |
echo "PAC Updated." | |
} | |
check_module_installed | |
update_gfwlist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment