10

I've learned that different programs process pac files in different ways, and maybe most of them even don't support pac files. So I want to know if there is a tool that setup a proxy says 127.0.0.1:1234. And when I set some program's proxy to 127.0.0.1:1234, this tool use a pac file to decide whether to redirect to proxy or connect directly. Are there any tools that satisfy the above feature?

3 Answers 3

6

Browsers with JavaScript support usually support PAC files. Anything else usually doesn't, in particular I'm not aware of any off-the-shelf proxy software that does. There are many proxies that support a way to perform differently based on the target URL, however, just not through a JavaScript program. See Transparent local proxy to many proxies

A PAC file is a JavaScript program, so support for PAC files requires a JavaScript interpreter. While there are proxies written in JavaScript, I can't find one that supports PAC files. The Python library pacparser implements PAC support (on top of Mozilla's JavaScript engine), and there are many proxies written in Python, but amazingly there doesn't seem to be any actual proxy program that uses pacparser.

2

Eh...finally I use other rules instead of pac and tried Privoxy and it works. Here's what I've done.

  1. Install Privoxy and listen to 127.0.0.1:1234.
  2. Get gfwlist.txt and convert it into Privoxy actions file.
  3. In the actions file some url will be sent using proxy and others connect directly.
1

I've been in the same boat as you, trying to figure out how to parse pac files and the like to obtain the IP and port of valid proxies to populate proxychains.conf with.

So far the easiest and quickest method I've found is writing a script that uses lynx, grep, awk, and sed. It's not the prettiest code but it works and updates my proxy table in a minute or less. edit If anyone could maybe show me how to streamline this script, that would be awesome.

#!/bin/bash
proxylst=proxy.lst
proxynew=proxy.new
lstdir=~/Documents/.proxyupdate
echo "fetching proxy list"
lynx --dump https://someproxysite/proxy-server-list/port-8080/ | awk 'NR%2==0'| grep -e "8080" | awk {'print $1 " " $2'} | awk -F "[" '{print $1" "substr($2,4)}' > $lstdir/$proxylst
lynx --dump https://someproxysite/proxy-server-list/port-8080/ | awk 'NR%2==0'| grep -e "8080" | awk {'print $1 " " $2'} | awk -F "[" '{print $1" "substr($2,4)}' >> $lstdir/$proxylst
lynx --dump https://someproxysite/proxy-server-list/port-8080/ | awk 'NR%2==0'| grep -e "8080" | awk {'print $1 " " $2'} | awk -F "[" '{print $1" "substr($2,4)}' >> $lstdir/$proxylst
echo "scan complete. updating /etc/proxychains.conf.."
sed 's/^/http /' $lstdir/$proxylst > $lstdir/$proxynew
grep -v 'http *.*.*.* 8080' /etc/proxychains.conf > $lstdir/proxyconf.new && cat $lstdir/$proxynew >> $lstdir/proxyconf.new
cp $lstdir/proxyconf.new /etc/proxychains.conf
echo
rm -rf $lstdir/proxyconf.new  $lstdir/$proxylst $lstdir/$proxynew
echo "update complete."'

set this up in as a cron entry and update your tables hourly and you'll be good to go. Since proxychains and firefox don't really play well together I use the pac from proxynovacom as my autoconfiguration file and it works smoothly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .