owtf.proxy package

Submodules

owtf.proxy.cache_handler module

owtf.proxy.cache_handler

Inbound Proxy Module developed by Bharadwaj Machiraju (blog.tunnelshade.in) as a part of Google Summer of Code 2013

class owtf.proxy.cache_handler.CacheHandler(cache_dir, request, cookie_regex, blacklist)[source]

Bases: object

This class will be used by the request handler to either load or dump to cache. Main things that are done here :- * The request_hash is generated here * The file locks are managed here * .rd files are created here

calculate_hash(callback=None)[source]

Based on blacklist boolean the cookie regex is used for filtering of cookies in request_hash generation. However the original request is not tampered.

Parameters:callback – Callback function
Returns:
Return type:
create_response_object()[source]

Create a proxy response object from cache file

Returns:
Return type:
dump(response)[source]

This function takes in a HTTPResponse object and dumps the request and response data. It also creates a .rd file with same file name

Note

This is used by transaction logger

Parameters:response – The proxy response
Returns:
Return type:
load()[source]

This is the function which is called for every request. If file is not found in cache, then a file lock is created for that and a None is returned.

Returns:Load a transaction from cache
Return type:
class owtf.proxy.cache_handler.DummyObject[source]

Bases: object

This class is just used to create a fake response object

owtf.proxy.cache_handler.request_from_cache(file_path)[source]

A fake request object is created with necessary attributes

Parameters:file_path (str) – The file path for the cache file
Returns:
Return type:
owtf.proxy.cache_handler.response_from_cache(file_path)[source]

A fake response object is created with necessary attributes

Parameters:file_path (str) – The file path for the cache file
Returns:
Return type:

owtf.proxy.gen_cert module

owtf.proxy.gen_cert

Inbound Proxy Module developed by Bharadwaj Machiraju (blog.tunnelshade.in) as a part of Google Summer of Code 2013

owtf.proxy.gen_cert.gen_signed_cert(domain, ca_crt, ca_key, ca_pass, certs_folder)[source]

This function takes a domain name as a parameter and then creates a certificate and key with the domain name(replacing dots by underscores), finally signing the certificate using specified CA and returns the path of key and cert files. If you are yet to generate a CA then check the top comments

Parameters:
  • domain (str) – domain for the cert
  • ca_crt (str) – ca.crt file path
  • ca_key (str) – ca.key file path
  • ca_pass (str) – Password for the certificate
  • certs_folder (str) –
Returns:

Key and cert path

Return type:

str

owtf.proxy.main module

owtf.proxy.proxy module

owtf.proxy.socket_wrapper module

owtf.proxy.socket_wrapper

Inbound Proxy Module developed by Bharadwaj Machiraju (blog.tunnelshade.in) as a part of Google Summer of Code 2013

owtf.proxy.socket_wrapper.wrap_socket(socket, domain, ca_crt, ca_key, ca_pass, certs_folder, success=None, failure=None, io=None, **options)[source]

Wrap an active socket in an SSL socket.

Parameters:
  • socket
  • domain
  • ca_crt
  • ca_key
  • ca_pass
  • certs_folder
  • success
  • failure
  • io
  • options
Returns:

Return type:

owtf.proxy.tor_manager module

owtf.proxy.tor_manager

TOR manager module developed by Marios Kourtesis <name.surname@gmail.com>

class owtf.proxy.tor_manager.TOR_manager(args)[source]

Bases: object

authenticate()[source]

This function is handling the authentication process to TOR control connection.

Returns:
Return type:
static is_tor_running()[source]

Check if tor is running

Returns:True if running, else False
Return type:bool
static msg_configure_tor()[source]
static msg_start_tor()[source]
open_connection()[source]

Opens a new connection to TOR control

Returns:
Return type:
renew_ip()[source]

Sends an NEWNYM message to TOR control in order to renew the IP address

Returns:True if IP is renewed, else False
Return type:bool
run()[source]

Starts a new TOR_control_process which will renew the IP address.

Returns:
Return type:
tor_control_process()[source]

This will run in a new process in order to renew the IP address after certain time.

Returns:None
Return type:None

owtf.proxy.transaction_logger module

Module contents