Skip to content

Know which proxy will be used by your .PAC file.

License

Notifications You must be signed in to change notification settings

kujiy/pacparser-web

Repository files navigation

Web Interface of Pacparser

Have you ever wondered "When I access to this URL, Which proxy will I use? Or direct?" Me helps you.

Demo(Currently not working)

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.

Getting started

  1. Clone this repository

    $ git clone https://github.com/kujiy/pacparser-web.git
  2. Update app/yourpacs.py with your .pac file URL.

    $ cd pacparser-web
    $ vi app/yourpacs.py
  3. 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
  4. Launch your container

    $ cd pacparser-web
    $ docker-compose up
  5. Access to http://localhost/ or http://your-docker-host:5000/ with your browser

  • You can change the port in docker-compose.yml .

Getting error?

  • 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.

How to Use

  1. Access your container with browsers
  2. Select pac file(those are defined in app/yourpacs.py) and input target URL then submit
  3. You'll get pacparser answer.

Related projects

File architect

  • main.py is the main file
  • index.html is a template file of the form

Build procedure

  1. Dockerfile
  1. docker-compose.yml
  • Replace main.py to mine(works with pacparser).
  • Set proxy to connect internet.
  1. entrypoint.sh
  • Download pacparser from github and install(make).

Access and what's happen

  1. Access to pacparser-web with your browser
  2. ngx/uwsgi execute /app/main.py
  3. main.py gets query strings of pac file and search url from accessed URL
  4. Download latest pac file(To test with latest one)
  5. Get its last modified date with stat command(This is just for me)
  6. Ask pacparser "Which proxy will you use for this URL?" and get an answer
  7. Call html template engine(Flask's render_template)
  8. /app/templates/index.html called
  9. Show html forms
How to debug

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 .

About

Know which proxy will be used by your .PAC file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published