Have you ever wondered "When I access to this URL, Which proxy will I use? Or direct?" Me helps you.
https://pacparser-web.herokuapp.com/
This demo answers Direct
for http://localhost/
, PROXY your-company-proxy:8080
for http://example.com/
and PROXY your-sub-proxy:3128
for other URL.
-
Clone this repository
$ git clone https://github.com/kujiy/pacparser-web.git
-
Update
app/yourpacs.py
with your .pac file URL.$ cd pacparser-web $ vi app/yourpacs.py
-
If you're behind a proxy, tell it in
docker-compose.yml
$ cd pacparser-web $ vi docker-compose.yml # Uncomment two rows and replace with your proxy (pacparser-web needs internet access) environment: - PROXY=http://user:password@your-proxy.com:port
-
Launch your container
$ cd pacparser-web $ docker-compose up
-
Access to http://localhost/ or http://your-docker-host:5000/ with your browser
- You can change the port in
docker-compose.yml
.
-
If you are behind the proxy, set environment in
docker-compose.yml
. -
See the docker log with the following command.
$ cd pacparser-web $ docker-compose logs -f
pacweb | fatal: unable to access 'https://github.com/pacparser/pacparser.git/':
- This log means pacparser couldn't access to internet.
- Access your container with browsers
- Select pac file(those are defined in
app/yourpacs.py
) and input target URL then submit - You'll get pacparser answer.
- PAC parse engine
- https://github.com/pacparser/pacparser
- Web server with python
- https://github.com/tiangolo/uwsgi-nginx-flask-docker
- CSS Framework
- https://github.com/Dogfalo/materialize
- main.py is the main file
- index.html is a template file of the form
Dockerfile
- The Original image has python, flask and ngx. It works with
/app/main.py
.
docker-compose.yml
- Replace main.py to mine(works with pacparser).
- Set proxy to connect internet.
entrypoint.sh
- Download pacparser from github and install(make).
- Access to pacparser-web with your browser
- ngx/uwsgi execute /app/main.py
- main.py gets query strings of pac file and search url from accessed URL
- Download latest pac file(To test with latest one)
- Get its last modified date with
stat
command(This is just for me) - Ask pacparser "Which proxy will you use for this URL?" and get an answer
- Call html template engine(Flask's render_template)
- /app/templates/index.html called
- Show html forms
Login to the container with docker exec CONT_NAME -it sh
and change /app
.
If you change /app/main.py
, need supervisorctl restart uwsgi
.
Restarting will be unnecesarry for /app/templates
.