pappyproxy package

Subpackages

Submodules

pappyproxy.comm module

pappyproxy.config module

class pappyproxy.config.PappyConfig

Bases: object

The configuration settings for the proxy. To access the config object for the current session (eg from plugins) use pappyproxy.pappy.session.config.

cert_dir

The location of the CA certs that Pappy will use. This can be configured in the config.json file for a project.

Default:{DATADIR}/certs
pappy_dir

The file where pappy’s scripts are located. Don’t write anything here, and you probably don’t need to write anything here. Use DATA_DIR instead.

Default:Wherever the scripts are installed
data_dir

The data directory. This is where files that have to be read by Pappy every time it’s run are put. For example, plugins are stored in {DATADIR}/plugins and certs are by default stored in {DATADIR}/certs. This defaults to ~/.pappy and isn’t configurable right now.

Default:~/.pappy
datafile

The location of the CA certs that Pappy will use. This can be configured in the config.json file for a project.

Default:data.db
debug_dir

The directory to write debug output to. Don’t put this outside the project folder since it writes all the request data to this directory. You probably won’t need to use this. Configured in the config.json file for the project.

Default:None
listeners

The list of active listeners. It is a list of tuples of the format (port, interface) Not modifiable after startup. Configured in the config.json file for the project.

Default:[(8000, '127.0.0.1')]
socks_proxy

Details for a SOCKS proxy. It is a dict with the following key/values:

host: The SOCKS proxy host
port: The proxy port
username: Username (optional)
password: Password (optional)

If null, no proxy will be used.

Default:null
http_proxy

Details for an upstream HTTP proxy. It is a dict with the following key/values:

host: The proxy host
port: The proxy port
username: Username (optional)
password: Password (optional)

If null, no proxy will be used.

plugin_dirs

List of directories that plugins are loaded from. Not modifiable.

Default:['{DATA_DIR}/plugins', '{PAPPY_DIR}/plugins']
save_history

Whether command history should be saved to a file/loaded at startup.

Default:True
config_dict

The dictionary read from config.json. When writing plugins, use this to load configuration options for your plugin.

global_config_dict

The dictionary from ~/.pappy/global_config.json. It contains settings for Pappy that are specific to the current computer. Avoid putting settings here, especially if it involves specific projects.

archive

Project archive compressed as a tar.bz2 archive if libraries available on the system, otherwise falls back to zip archive.

Default:project.archive
crypt_dir

Temporary working directory to unpack an encrypted project archive. Directory will contain copies of normal startup files, e.g. conifg.json, cmdhistory, etc. On exiting pappy, entire directory will be compressed into an archive and encrypted. Compressed as a tar.bz2 archive if libraries available on the system, otherwise falls back to zip.

Default:crypt
crypt_file

Encrypted archive of the temporary working directory crypt_dir. Compressed as a tar.bz2 archive if libraries available on the system, otherwise falls back to zip.

Default:project.crypt
crypt_session

Boolean variable to determine whether pappy started in crypto mode

Default:False
salt_len

Length of the nonce-salt value appended to the end of crypt_file

Default:16

pappyproxy.console module

Contains helpers for interacting with the console. Includes definition for the class that is used to run the console.

class pappyproxy.console.ProxyCmd(*args, **kwargs)

Bases: cmd2.Cmd

An object representing the console interface. Provides methods to add commands and aliases to the console.

add_alias(command, alias)

Add an alias for a command. ie add_alias(“foo”, “f”) will let you run the ‘foo’ command with ‘f’

add_aliases(alias_list)

Pass in a list of tuples to add them all as aliases. ie add_aliases([(‘foo’, ‘f’), (‘foo’, ‘fo’)]) will add ‘f’ and ‘fo’ as aliases for ‘foo’

set_cmd(command, func, autocomplete_func=None)

Add a command to the console.

set_cmds(cmd_dict)

Set multiple commands from a dictionary. Format is: {‘command’: (do_func, autocomplete_func)} Use autocomplete_func=None for no autocomplete function

pappyproxy.context module

class pappyproxy.context.Context

Bases: object

A class representing a set of requests that pass a set of filters

Variables:
  • active_filters (List of functions that takes one pappyproxy.http.Request and returns either true or false.) – Filters that are currently applied to the context
  • active_requests – Requests which pass all the filters applied to the context
  • inactive_requests – Requests which do not pass all the filters applied to the context
add_filter(filt)

Add a filter to the context. This will remove any requests that do not pass the filter from the active_requests set.

Parameters:filt (Function that takes one pappyproxy.http.Request and returns either true or false. (or a pappyproxy.context.Filter)) – The filter to add
filter_up()

Removes the last filter that was applied to the context.

set_filters(filters)

Set the list of filters for the context.

class pappyproxy.context.Filter(filter_string)

Bases: object

A class representing a filter. Its claim to fame is that you can use pappyproxy.context.Filter.from_filter_string() to generate a filter from a filter string.

static from_filter_string(filter_string)

Create a filter from a filter string. If passed a list of arguments, they will be used instead of parsing the string.

Return type:Deferred that returns a pappyproxy.context.Filter
pappyproxy.context.async_set_tag(tag, reqs)

Remove the tag from every request then add the given requests to memory and give them the tag. The async version.

Parameters:
  • tag (String) – The tag to set
  • reqs (List of Requests) – The requests to assign to the tag
pappyproxy.context.set_tag(tag, reqs)

Remove the tag from every request then add the given requests to memory and give them the tag. The non-async version.

Parameters:
  • tag (String) – The tag to set
  • reqs (List of Requests) – The requests to assign to the tag

pappyproxy.http module

class pappyproxy.http.HTTPMessage(full_message=None, update_content_length=False)

Bases: object

A base class which represents an HTTP message. It is used to implement both requests and responses

Variables:
add_data(data)

Used for building a message from a Twisted protocol. Add data to the message. The data must conform to the content encoding and transfer encoding given in the headers passed in to add_line(). Can be any fragment of the data. I do not suggest that you use this function ever.

Parameters:data (string) – The data to add
add_line(line)

Used for building a message from a Twisted protocol. Add a line (for status line and headers). Lines must be added in order and the first line must be the status line. The line should not contain the trailing carriage return/newline. I do not suggest you use this for anything.

Parameters:line (string) – The line to add
body

The data portion of the message

Getter:Returns the data portion of the message
Setter:Set the data of the response and update metadata
Type:string
body_pretty

Same thing as pappy.http.HTTPMessage.body() but the output is colorized for the terminal.

clear()

Resets all internal data and clears the message

copy()

Returns a copy of the request

Return type:Request
from_json(json_string)

Update the metadata of the message to match data from to_json()

Parameters:json_string (JSON data in a string) – The JSON data to use
full_message

The full message including the start line, headers, and body

full_message_pretty

Same as pappyproxy.http.HTTPMessage.full_message() except the output is colorized

headers_section

The raw text of the headers including the extra newline at the end.

Getter:Returns the raw text of the headers including the extra newline at the end.
Type:string
headers_section_pretty

Same thing as pappyproxy.http.HTTPMessage.headers_section() except that the headers are colorized for terminal printing.

reserved_meta_keys = ['full_message']

Internal class variable. Do not modify.

to_json()

Return a JSON encoding of the message that can be used by from_json() to recreate the message. The full_message portion is base64 encoded because json doesn’t play nice with binary blobs.

class pappyproxy.http.RepeatableDict(from_pairs=None, case_insensitive=False)

A dict that retains the order of items inserted and keeps track of duplicate values. Can optionally treat keys as case insensitive. Custom made for the proxy, so it has strange features

add_pairs(pairs)

Add a list of pairs to the dictionary.

Parameters:pairs (List of tuples of length 2) – The list of key/value pairs to add
all_pairs()

A list of all the key/value pairs stored in the dictionary

all_vals(key)

Return all the values associated with a given key

append(key, val)

Append a pair to the end of the dictionary. Will add a duplicate if the key already exists.

clear()

Remove all key/value pairs from the dictionary

from_dict(d)

Set the RepeatableDict to contain the same items as a normal dictionary.

Parameters:d (dict) – The dictionary to use
set_val(key, val)

Set a value in the dictionary. Will replace the first instance of the key with the value. If multiple values of the keys are already in the dictionary, the duplicates of the key will be removed and the first instance of the key will be replaced with the value. If the dictionary is case insensitive, it will maintain the original capitalization. This is the same behavior as assigning a value via d[key] = val. If the key is not present, it will be added to the end of the dict.

sort()

Sort the dictionary by the key. Requires that all keys can be compared to each other

class pappyproxy.http.Request(full_request=None, update_content_length=True, port=None, is_ssl=None, host=None, path_type=None, proxy_creds=None, explicit_port=False)

Bases: pappyproxy.http.HTTPMessage

Variables:
  • time_end (datetime.datetime) – The datetime that the request ended.
  • time_start (datetime.datetime) – The datetime that the request was made
  • cookies (RepeatableDict) – Cookies sent with the request
  • fragment (String) – The fragment part of the url (The part that comes after the #)
  • url_params (RepeatableDict) – The url parameters of the request (aka the get parameters)
  • path (String) – The path of the request
  • port (Integer) – The port that the request was sent to (or will be sent to)
  • post_params (RepeatableDict) – The post parameters of the request
  • reqid (String) – The request id of the request
  • response (Response) – The associated response of this request
  • submitted (Bool) – Whether the request has been submitted
  • unmangled (Request) – If the request was mangled, the version of the request before it was mangled.
  • verb (String) – The HTTP verb of the request (ie POST, GET)
  • version (String) – The HTTP version of the request (ie HTTP/1.1)
  • tags (List of Strings) – Tags associated with the request
  • plugin_data (Dict) – Data about the request created by plugins. If you modify this, please add your own key to it for your plugin and store all your plugin’s data under that key (probably as another dict). For example if you have a plugin called foo, try and store all your data under req.plugin_data['foo'].
  • path_type (Enum) – An enum which describes how the path portion of the request should be represented. PATH_RELATIVE -> normal relative path, PATH_ABSOLUTE -> The absolute path (including the protocol), PATH_HOST -> Just the path and the port (Used for CONNECT requests when connecting to an upstream HTTP proxy).
  • explicit_port – A flag to indicate that the port should always be included in the URL
async_deep_save()

Saves self, unmangled, response, and unmangled response. Returns a deferred which fires after everything has been saved.

Return type:twisted.internet.defer.Deferred
async_save()

Save/update the request in the data file. Returns a twisted deferred which fires when the save is complete.

Return type:twisted.internet.defer.Deferred
async_submit()

Same as submit() but generates deferreds. Submits the request using its host, port, etc. and updates its response value to the resulting response.

Parameters:mangle (Bool) – Whether to pass the request through active intercepting macros.
Return type:Twisted deferred
cache = <pappyproxy.requestcache.RequestCache object>

The request cache that stores requests in memory for performance

connect_request

If the request uses SSL, this will be a request object that can be used with an upstream HTTP server to connect to a server using SSL

deep_delete()

Delete a request, its unmangled version, its response, and its response’s unmangled version from history. Also removes the request from all contexts. Returns a Twisted deferred.

Return type:Deferred
full_path

The full path of the request including URL params and fragment. ie /path/to/stuff?foo=bar&baz=something#somewhere

Getter:Returns the full path of the request
Type:string
full_request

Alias for Request.full_message

Getter:Returns the full text of the request
Type:string
get_plugin_dict(name)

Get the data dictionary for the given plugin name.

host

The host of the request. ie www.google.com.

Getter:Returns the host of the request
Setter:Changes the host of the request and updates the Host header
Type:string
is_ssl

Whether the request is sent over SSL

Getter:Returns if the request is sent over SSL
Setter:Sets if the request is sent over SSL
Type:Bool
static load_request(to_load)

Load a request with the given request id and return it. Returns a deferred which calls back with the request when complete.

Parameters:
  • allow_special (bool) – Whether to allow special IDs such as u## or s##
  • use_cache (bool) – Whether to use the cache. If set to false, it will always query the data file to get the request
Return type:

twisted.internet.defer.Deferred

static load_requests_by_tag(tag)

Load all the requests in the data file with a given tag and return them in a list. Returns a deferred which calls back with the list of requests when complete.

Return type:twisted.internet.defer.Deferred
static load_requests_by_time()

Load all the requests in the data file and return them in a list. Returns a deferred which calls back with the list of requests when complete.

Return type:twisted.internet.defer.Deferred
path_tuple

The path in tuple form starting with the host. For example, path_parts for a request to http://www.example.com/foo/bar.php would be:

('www.example.com', 'foo', 'bar.php')
Getter:Returns the path in tuple form
Type:Tuple
proxy_creds

A username/password tuple representing the username/password to authenticate to a proxy server. Sets the Proxy-Authorization header. Getter will return (None, None) if no creds exist

Getter:Returns the username/password tuple used for proxy authorization
Setter:Sets the username/password tuple used for proxy authorization
Type:Tuple of two strings: (username, password)
raw_data

Alias for Request.body

Getter:Returns the data portion of the request
Setter:Set the data of the request and update metadata
Type:string
raw_headers

Alias for Request.headers_section

Getter:Returns the raw text of the headers including the extra newline at the end.
Type:string
rsptime

The response time of the request

Getter:Returns the response time of the request
Type:datetime.timedelta
save()

Save/update the request in the data file. Saves the request, its unmangled version, the response, and the unmanbled response. Cannot be called from inside an async function.

saved

If the request is saved in the data file

Getter:Returns True if the request is saved in the data file
Type:Bool
sort_time

If the request has a submit time, returns the submit time’s unix timestamp. Returns 0 otherwise

start_line

The status line of the request. ie GET / HTTP/1.1

Getter:Returns the status line of the request
Setter:Sets the status line of the request
Type:string
status_line

Alias for pappyproxy.http.Request.start_line.

Getter:Returns the status line of the request
Setter:Sets the status line of the request
Type:string
submit()

Submits the request using its host, port, etc. and updates its response value to the resulting response. Cannot be called in async functions. This is what you should use to submit your requests in macros.

static submit_request(request, save_request=False, intercepting_macros={}, stream_transport=None)

Submits the request then sets request.response. Returns a deferred that is called with the request that was submitted.

Parameters:
  • request – The request to submit
  • save_request (Bool) – Whether to save the request to history
  • intercepting_macros (Dict or collections.OrderedDict) – Dictionary of intercepting macros to be applied to the request
  • stream_transport (twisted.internet.interfaces.ITransport) – Return transport to stream to. Set to None to not stream the response.
url

The full url of the request including url params, protocol, etc. ie https://www.google.com, http://foo.fakewebsite.com:1234/path?a=b. When setting the URL, the port, is_ssl, path, url params, host, etc are all automatically updated.

Getter:Returns the url of the request
Setter:Sets the url of the request and updates metadata
Type:string
url_color

same as .url, except colored. Used for printing URLs to the terminal.

Getter:Returns the url of the request
Type:string
class pappyproxy.http.Response(full_response=None, update_content_length=True)

Bases: pappyproxy.http.HTTPMessage

Variables:
  • cookies (RepeatableDict of ResponseCookie objects) – Cookies set by the response
  • response_code (Integer) – The response code of the response
  • response_text (String) – The text associated with the response code (ie OK, NOT FOUND, etc)
  • rspid (String) – If the response is saved in the data file, the id of the response
  • unmangled (Response) – If the response was mangled, the unmangled version of the response
  • version (String) – The version part of the status line (ie HTTP/1.1)

Add a pappyproxy.http.ResponseCookie to the response.

Warning

This will add duplicate cookies. If you want to add a cookie you’re not sure exists, use set_cookie()

async_save()

Save/update the just request in the data file. Returns a twisted deferred which fires when the save is complete. It is suggested that you use :func: ~pappyproxy.http.Request.async_deep_save instead to save responses.

Return type:twisted.internet.defer.Deferred

Delete a cookie from the response by its key

full_response

The full text of the response including the headers and data. Alias for Response.full_message

Getter:Returns the full text of the response
Type:string
static load_response(*args, **kwargs)

Load a response from its response id. Returns a deferred. I don’t suggest you use this.

Return type:twisted.internet.defer.Deferred
raw_data

Alias for Response.body

Getter:Returns the data portion of the response
Setter:Set the data of the response and update metadata
Type:string
raw_headers

Alias for Response.headers_section

Getter:Returns the raw text of the headers including the extra newline at the end.
Type:string

Set a cookie in the response. cookie must be a pappyproxy.http.ResponseCookie

Set a cookie by key and value. Will not have path, secure, etc set at all.

soup

Returns a beautifulsoup4 object for parsing the html of the response

Getter:Returns a BeautifulSoup object representing the html of the response
start_line

The status line of the response. ie HTTP/1.1 200 OK

Getter:Returns the status line of the response
Setter:Sets the status line of the response
Type:string
class pappyproxy.http.ResponseCookie(set_cookie_string=None)

Bases: object

A cookie representing a cookie set by a response

Variables:
  • key – The key of the cookie
  • val – The value of the cookie
  • expires – The value of the “expires” attribute
  • max_age – The max age of the cookie
  • domain – The domain of the cookie
  • path – The path of the cookie
  • secure – The secure flag of the cookie
  • http_only – The httponly flag of the cookie
cookie_str

Returns the full string of the cookie. ie foo=bar; secure; path=/

Getter:Returns the full string of the cookie.
Setter:Set the metadata from a cookie string. ie from a Set-Cookie header
pappyproxy.http.async_submit_requests(reqs, mangle=False)
Parameters:mangle (Bool) – Whether to pass the requests through intercepting macros
Return type:DeferredList

Submits a list of requests at the same time asynchronously. Responses/unmangled versions will be attached to the request objects in the list. Prints progress to stdout.

pappyproxy.http.get_request(url='', url_params={})

Create a request object that makes a GET request to the given url with the given url params.

pappyproxy.http.init(pool)

Initialize the http module.

Parameters:pool (SQLite ConnectionPool) – The ConnectionPool to use to store the request/response objects
pappyproxy.http.post_request(url, post_params={}, url_params={})

Create a request object that makes a POST request to the given url with the given post and url params.

pappyproxy.iter module

pappyproxy.iter.common_passwords()

List common passwords

pappyproxy.iter.common_usernames()

List common usernames

pappyproxy.iter.fuzz_path_trav()

Fuzz common values for path traversal.

pappyproxy.iter.fuzz_sqli()

Fuzz common values that could cause sql errors

pappyproxy.iter.fuzz_xss()

Fuzz values for finding XSS

pappyproxy.macros module

class pappyproxy.macros.FileInterceptMacro(filename='')

Bases: pappyproxy.macros.InterceptMacro

An intercepting macro that loads a macro from a file.

class pappyproxy.macros.InterceptMacro

Bases: object

A class representing a macro that modifies requests as they pass through the proxy

class pappyproxy.macros.Macro(filename='')

Bases: object

A class representing a macro that can perform a series of requests and add data to storage.

pappyproxy.macros.load_macros(loc)

Loads the macros stored in the location and returns a list of Macro objects

pappyproxy.macros.mangle_request(*args, **kwargs)

Mangle a request with a list of intercepting macros. Returns a tuple that contains the resulting request (with its unmangled value set if needed) and a bool that states whether the request was modified Returns (None, True) if the request was dropped.

Return type:(Request, Bool)
pappyproxy.macros.mangle_response(*args, **kwargs)

Mangle a request’s response with a list of intercepting macros. Returns a bool stating whether the request’s response was modified. Unmangled values will be updated as needed.

Return type:Bool

pappyproxy.pappy module

Handles the main Pappy session.

pappyproxy.pappy.session

The pappyproxy.pappy.PappySession object for the current session. Mainly used for accessing the session’s config information.

class pappyproxy.pappy.PappySession(sessconfig)

Bases: object

An object representing a pappy session. Mainly you’ll only use this to get to the session config.

Variables:config (pappyproxy.config.PappyConfig) – The configuration settings for the session

pappyproxy.plugin module

This module contains all the api calls written for use in plugins. If you want to do anything that is’t allowed through these function calls or through the functions provided for macros, contact me and I’ll see what I can do to add some more functionality into the next version.

pappyproxy.plugin.active_intercepting_macros()

Returns a dict of the active intercepting macro objects. Modifying this list will not affect which macros are active.

pappyproxy.plugin.add_intercepting_macro(name, macro)

Adds an intercepting macro to the proxy. You can either use a pappyproxy.macros.FileInterceptMacro to load an intercepting macro from the disk, or you can create your own using an pappyproxy.macros.InterceptMacro for a base class. You must give a unique name that will be used in pappyproxy.plugin.remove_intercepting_macro() to deactivate it. Remember that activating an intercepting macro will disable request streaming and will affect performance. So please try and only use this if you may need to modify messages before they are passed along.

pappyproxy.plugin.add_to_history(req)

Save a request to history without saving it to the data file. The request will only be saved in memory, so when the program is exited or clrmem is run, the request will be deleted.

Parameters:req (pappyproxy.http.Request) – The request to add to history
pappyproxy.plugin.async_main_context_ids(n=-1)

Returns a deferred that resolves into a list of up to n of the most recent requests in the main context. You can then use pappyproxy.http.Request.load_request() to load the requests in the current context. If no value is passed for n, this will return all of the IDs in the context.

pappyproxy.plugin.in_memory_reqs()

Returns a list containing the ids of the requests which exist in memory only (requests with an m## style id). You can call either pappyproxy.http.Request.save() or pappyproxy.http.Request.async_deep_save() to save the request to the data file.

pappyproxy.plugin.main_context_ids(*args, **kwargs)

Same as pappyproxy.plugin.async_main_context_ids() but can be called from macros and other non-async only functions. Cannot be called in async functions.

pappyproxy.plugin.plugin_by_name(name)

Returns an interface to access the methods of a plugin from its name. For example, to call the foo function from the bar plugin you would call plugin_by_name('bar').foo().

pappyproxy.plugin.remove_intercepting_macro(name)

Stops an active intercepting macro. You must pass in the name that you used when calling pappyproxy.plugin.add_intercepting_macro() to identify which macro you would like to stop.

pappyproxy.plugin.req_history(num=-1, ids=None, include_unmangled=False)

Returns an a generator that generates deferreds which resolve to requests in history, ignoring the current context. If n is given, it will stop after n requests have been generated. If ids is given, it will only include those IDs. If include_unmangled is True, then the iterator will include requests which are the unmangled version of other requests.

An example of using the iterator to print the 10 most recent requests:

@defer.inlineCallbacks
def find_food():
    for req_d in req_history(10):
        req = yield req_d
        print '-'*10
        print req.full_message_pretty
pappyproxy.plugin.require_modules(*largs)

A wrapper to make sure that plugin dependencies are installed. For example, if a command requires the psutil and objgraph package, you should format your command like:

@require_modules('psutil', 'objgraph')
def my_command(line):
    import objgraph
    import psutil
    # ... rest of command ...

If you try to run the command without being able to import all of the required modules, the command will print an error and not run the command.

pappyproxy.plugin.run_cmd(cmd)

Run a command as if you typed it into the console. Try and use existing APIs to do what you want before using this.

pappyproxy.proxy module

pappyproxy.repeater module

pappyproxy.session module

class pappyproxy.session.Session(cookie_names=None, header_names=None, cookie_vals=None, header_vals=None)

Bases: object

A class used to maintain a session over multiple requests. Can remember cookies and apply a specific header to requests. It is also possible to give the session a list of cookie names and it will only save those cookies.

apply_req(request)

Apply saved headers and cookies to the request

apply_rsp(response)

Will add a Set-Cookie header for each saved cookie. Will not apply any saved headers. If the cookie was added from a call to save_rsp(), the Set-Cookie flags will be the same as the original response.

Returns a string with the value of the cookie with the given string, even if the value is a ResponseCookie. If you want to get a ResponseCookie, use get_rsp_cookie().

Returns the ResponseCookie associated with the key regardless of if the value is stored as a string or a ResponseCookie.

save_req(req, cookies=None, headers=None)

Updates the state of the session from the given request. Cookie and headers can be added to their whitelists by passing in a list for either cookies or headers.

save_rsp(rsp, cookies=None)

Update the state of the session from the response. Only cookies can be updated from a response. Additional values can be added to the whitelist by passing in a list of values for the cookies parameter. If save_all is given, all set cookies will be added to the session.

Set a cookie in the session. val can be either a string or a ResponseCookie. If a ResponseCookie is used, make sure its key value is the same as the key passed in to the function.

pappyproxy.util module

exception pappyproxy.util.PappyException

Bases: exceptions.Exception

The exception class for Pappy. If a plugin command raises one of these, the message will be printed to the console rather than displaying a traceback.

pappyproxy.util.confirm(message, default='n')

A helper function to get confirmation from the user. It prints message then asks the user to answer yes or no. Returns True if the user answers yes, otherwise returns False.

pappyproxy.util.get_req_data_row(request)

Get the row data for a request to be printed.

pappyproxy.util.load_reqlist(line, allow_special=True)

A helper function for parsing a list of requests that are passed as an argument. If allow_special is True, then it will parse IDs such as u123 or s123. Even if allow_special is false, it will still parse m## IDs. Will print any errors with loading any of the requests and will return a list of all the requests which were successfully loaded. Returns a deferred.

Returns:Twisted deferred
pappyproxy.util.print_request_rows(request_rows)

Takes in a list of request rows generated from pappyproxy.console.get_req_data_row() and prints a table with data on each of the requests. Used instead of pappyproxy.console.print_requests() if you can’t count on storing all the requests in memory at once.

pappyproxy.util.print_requests(requests)

Takes in a list of requests and prints a table with data on each of the requests. It’s the same table that’s used by ls.

pappyproxy.util.print_table(coldata, rows)

Print a table. Coldata: List of dicts with info on how to print the columns. name is the heading to give column, width (optional) maximum width before truncating. 0 for unlimited.

Rows: List of tuples with the data to print

pappyproxy.util.printable_data(data)

Return data, but replaces unprintable characters with periods.

Parameters:data (String) – The data to make printable
Return type:String

Module contents