diff --git a/chnroutes.py b/chnroutes.py index 99401a6..98577bc 100755 --- a/chnroutes.py +++ b/chnroutes.py @@ -190,6 +190,14 @@ def generate_android(metric): print "Old school way to call up/down script from openvpn client. " \ "use the regular openvpn 2.1 method to add routes if it's possible" +def generate_proxifier(metric): + import ipaddress + results = fetch_ip_data() + for ip, mask, _ in results: + network = ipaddress.IPv4Network("%s/%s" % (ip, mask)) + print "%s-%s;" % (network.network_address, network.broadcast_address), + print "\nUsage: copy all IP ranges and paste to \"Target Hosts\" of your Proxifier rule. " + def fetch_ip_data(): #fetch data from apnic @@ -235,7 +243,7 @@ def fetch_ip_data(): default='openvpn', nargs='?', help="Target platforms, it can be openvpn, mac, linux," - "win, android. openvpn by default.") + "win, android, proxifier. openvpn by default.") parser.add_argument('-m','--metric', dest='metric', default=5, @@ -255,6 +263,8 @@ def fetch_ip_data(): generate_win(args.metric) elif args.platform.lower() == 'android': generate_android(args.metric) + elif args.platform.lower() == 'proxifier': + generate_proxifier(args.metric) else: print>>sys.stderr, "Platform %s is not supported."%args.platform exit(1)