Git Product home page Git Product logo

pactester's Introduction

I have stopped maintaining this version of pactester. Please use the version that comes with pacparser. -Manu Garg

Pactester

Pactester is a tool to test Proxy Auto Configuration (PAC) files. PAC files are used by browsers to determine the "right" proxy for a URL. Since the PAC file evaluation mechanism is generated inside the browser and cannot be accessed from outside, the only way to tell which proxy your browser will use for a specific URL is manual inspection of the PAC file. But manual inspectiondoesn't really scale very well. Pactester resolves this problem. It makes use of JavaScript interpreter and netscape/mozilla APIs to evaluate the PAC files and automates the whole process.

Pactester reads a PAC file, evaluates it in a JavaScript context and uses this PAC file's logic to determine the proxy for a specific URL.

Usage: ./pactester <-p pacfile> <-u url> [-h host] [-c client_ip] ./pactester <-p pacfile> <-f urlslist> [-c client_ip]

Options: -p pacfile: PAC file to test -u url: URL to test -h host: Host part of the URL -c client_ip: client IP address (defaults to IP address of the machine on which script is running) -f urlslist: a file containing list of URLs to be tested.

Example: ./pactester -p wpad.dat -u http://www.google.com ./pactester -p wpad.dat -u http://www.google.com -c 192.168.1.105 ./pactester -p wpad.dat -f url_list

  • How It Works?

It evaluates the PAC file in a Javascript context. To do that it uses the JavaScript::SpiderMonkey perl module, which is a perl interface to Mozilla's C implementation of Javascript- Spidermonkey.

PAC files use certain JavaScript functions. These functions have been defined in pac_utils.js file included with this tool (This file was generated using another file from Mozilla source code). Also, since JavaScript has no DNS resolving capability which is required by the "dnsResolve" and "myIpAddress" functions in the PAC files, these functions have been defined in perl and then exported to a JavaScript context.

  • Install

Please see 'INSTALL' in the root directory of the package.

  • How to use it?

Pactester can be used to determine the proxy for a single URL or a list of URLs.

To determine the proxy for a single URL: ./pactester -p www.pac -u http://www.example.com

For a list of URLs : ./pactester -p www.pac -f urllist where urllist is a file containing the list of URLs separated by newline.

  • Extending command line web clients:

Pactester can be also be used to extend command line web clients like curl and perl-libwww library.

To use it with curl: Right now, curl doesn't have the functionality to evaluate PAC files to find out proxy for a given URL. However, based on pactester, you can write a wrapper perl script around curl. This perl script will first find out the proxy for the URL, the way that pactester finds out, and then it will call curl with the option '-x "proxy server as returned by pactester method"'.

Similarly, this method can be used inside perl-libwww web clients too.

  • Platforms

Pactester has been tested to work on Linux and Intel Macs.

Author: Manu Garg [email protected] Copyright (C) 2007 Google Inc.

pactester's People

Contributors

manugarg avatar

Watchers

Gudmundur magnusson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.