owtf.managers package

Submodules

owtf.managers.command_register module

owtf.managers.config module

owtf.managers.config_manager

owtf.managers.config.config_gen_query(session, criteria)[source]

Generate query

Parameters:criteria (dict) – Filter criteria
Returns:
Return type:
owtf.managers.config.derive_config_dict(config_obj)[source]

Get the config dict from the obj

Parameters:config_obj – The config object
Returns:
Return type:
owtf.managers.config.derive_config_dicts(config_obj_list)[source]

Derive multiple config dicts

Parameters:config_obj_list (list) – List of all config objects
Returns:List of config dicts
Return type:list
owtf.managers.config.get_all_config_dicts(session, criteria=None)[source]

Get all config dicts for a criteria

Parameters:criteria (dict) – Filter criteria
Returns:Config dict
Return type:dict
owtf.managers.config.get_all_tools(session)[source]

Get all tools from the config DB

Returns:Config dict for all tools
Return type:dict
owtf.managers.config.get_config_val(session, key)[source]

Get the value of the key from DB

Parameters:key (str) – Key to lookup
Returns:Value
Return type:str
owtf.managers.config.get_replacement_dict(session)[source]

Get the config dict

Returns:Replaced dict
Return type:dict
owtf.managers.config.get_sections_config(session)[source]

Get all sections in from the config db

Returns:List of sections
Return type:list
owtf.managers.config.get_tcp_ports(start_port, end_port)[source]

Get TCP ports from the config file

Parameters:
  • start_port (str) – Start port in a range
  • end_port (str) – End port
Returns:

Comma-separate string of tcp ports

Return type:

str

owtf.managers.config.get_udp_ports(start_port, end_port)[source]

Get UDP ports from the config file

Parameters:
  • start_ort – Start port in a range
  • end_port (str) – End port
Returns:

Comma-separate string of udp ports

Return type:

str

owtf.managers.config.load_config_file(file_path, fallback_file_path)[source]

Load YAML format configuration file

Parameters:
  • file_path (str) – The path to config file
  • fallback_file_path (str) – The fallback path to config file
Returns:

config_map

Return type:

dict

owtf.managers.config.load_framework_config(default, fallback, root_dir, owtf_pid)[source]

Load framework configuration into a global dictionary.

Parameters:
  • default (str) – The path to config file
  • fallback (int) – The fallback path to config file
  • fallback – OWTF root directory
  • fallback – PID of running program
Returns:

None

Return type:

None

owtf.managers.config.load_general_config(session, default, fallback)[source]

Load Db config from file

Parameters:
  • session (object) – SQLAlchemy database session
  • default (str) – The fallback path to config file
  • fallback (str) – The path to config file
Returns:

None

Return type:

None

owtf.managers.config.update_config_val(session, key, value)[source]

Update the configuration value for a key

Parameters:
  • key (str) – Key whose value to update
  • value (str) – New value
Returns:

None

Return type:

None

owtf.managers.error module

owtf.db.error_manager

Component to handle data storage and search of all errors

owtf.managers.error.add_error(session, message, trace)[source]

Add an error to the DB

Parameters:
  • message (str) – Message to be added
  • trace (str) – Traceback
Returns:

None

Return type:

None

owtf.managers.error.delete_error(session, error_id)[source]

Deletes an error from the DB

Parameters:error_id (int) – ID of the error to be deleted
Returns:None
Return type:None
owtf.managers.error.derive_error_dict(error_obj)[source]

Get the error dict from an object

Parameters:error_obj – Error object
Returns:Error dict
Return type:dict
owtf.managers.error.derive_error_dicts(error_obj_list)[source]

Get error dicts for a list of error objs

Parameters:error_obj_list (list) – List of error objects
Returns:List of error dicts
Return type:list
owtf.managers.error.gen_query_error(session, criteria)[source]

Generates the ORM query using the criteria

Parameters:criteria (dict) – Filter criteria
Returns:
Return type:
owtf.managers.error.get_all_errors(session, criteria=None)[source]

Get all error dicts based on criteria

Parameters:criteria (dict) – Filter criteria
Returns:Error dicts
Return type:list
owtf.managers.error.get_error(session, error_id)[source]

Get an error based on the id

Parameters:error_id (int) – Error id
Returns:Error dict
Return type:dict
owtf.managers.error.update_error(session, error_id, user_message)[source]

Update an error message in the DB

Parameters:
  • error_id (int) – ID of the error message
  • user_message (str) – New message
Returns:

None

Return type:

None

owtf.managers.mapping module

owtf.managers.mapping

Manages the mapping between different plugin groups and codes

owtf.managers.mapping.derive_mapping_dict(obj)[source]

Fetch the mapping dict from an object

Parameters:obj – The mapping object
Returns:Mappings dict
Return type:dict
owtf.managers.mapping.derive_mapping_dicts(obj_list)[source]

Fetches the mapping dicts based on the objects list

Parameters:obj_list (list) – The plugin object list
Returns:Mapping dicts as a list
Return type:list
owtf.managers.mapping.get_all_mappings(session)[source]

Create a mapping between OWTF plugins code and OWTF plugins description.

Returns:Mapping dictionary {code: [mapped_code, mapped_description], code2: [mapped_code, mapped_description], …}
Return type:dict
owtf.managers.mapping.get_mapping_category(session, plugin_code)[source]

Get the categories for a plugin code

Parameters:plugin_code (int) – The code for the specific plugin
Returns:category for the plugin code
Return type:str
owtf.managers.mapping.get_mapping_types()[source]

In memory data saved when loading db :return: None :rtype: None

owtf.managers.mapping.get_mappings(session, mapping_type)[source]

Fetches mappings from DB based on mapping type

Parameters:mapping_type (str) – Mapping type like OWTF, OWASP (v3, v4, Top 10), NIST, CWE
Returns:Mappings
Return type:dict
owtf.managers.mapping.load_mappings(session, default, fallback)[source]

Loads the mappings from the config file

Note

This needs to be a list instead of a dictionary to preserve order in python < 2.7

Parameters:
  • session (object) – SQLAlchemy database session
  • default (str) – The fallback path to config file
  • fallback (str) – The path to config file
Returns:

None

Return type:

None

owtf.managers.plugin module

owtf.managers.plugin

This module manages the plugins and their dependencies

owtf.managers.plugin.derive_plugin_dict(obj)[source]

Fetch the plugin dict from an object

Parameters:obj – Plugin object
Returns:Plugin dict
Return type:dict
owtf.managers.plugin.derive_plugin_dicts(obj_list)[source]

Fetch plugin dicts from a obj list

Parameters:obj_list (list) – List of plugin objects
Returns:List of plugin dicts
Return type:list
owtf.managers.plugin.derive_test_group_dict(obj)[source]

Fetch the test group dict from the obj

Parameters:obj – The test group object
Returns:Test group dict
Return type:dict
owtf.managers.plugin.derive_test_group_dicts(obj_list)[source]

Fetch the test group dicts from the obj list

Parameters:obj_list (list) – The test group object list
Returns:Test group dicts in a list
Return type:list
owtf.managers.plugin.get_all_plugin_dicts(session, criteria=None)[source]

Get plugin dicts based on filter criteria

Parameters:criteria (dict) – Filter criteria
Returns:List of plugin dicts
Return type:list
owtf.managers.plugin.get_all_plugin_groups(session)[source]

Get all plugin groups from the DB

Returns:List of available plugin groups
Return type:list
owtf.managers.plugin.get_all_plugin_types(session)[source]

Get all plugin types from the DB

Returns:All available plugin types
Return type:list
owtf.managers.plugin.get_all_test_groups(session)[source]

Get all test groups from th DB

Returns:
Return type:
owtf.managers.plugin.get_groups_for_plugins(session, plugins)[source]

Gets available groups for selected plugins

Parameters:plugins (list) – Plugins selected
Returns:List of available plugin groups
Return type:list
owtf.managers.plugin.get_plugins_by_group(session, plugin_group)[source]

Get plugins by plugin group

Parameters:plugin_group (str) – Plugin group
Returns:List of plugin dicts
Return type:list
owtf.managers.plugin.get_plugins_by_group_type(session, plugin_group, plugin_type)[source]

Get plugins by group and plugin type

Parameters:
  • plugin_group (str) – Plugin group
  • plugin_type (str) – plugin type
Returns:

List of plugin dicts

Return type:

list

owtf.managers.plugin.get_plugins_by_type(session, plugin_type)[source]

Get plugins based on type argument

Parameters:plugin_type (str) – Plugin type
Returns:List of plugin dicts
Return type:list
owtf.managers.plugin.get_test_group(session, code)[source]

Get the test group based on plugin code

Parameters:code (str) – Plugin code
Returns:Test group dict
Return type:dict
owtf.managers.plugin.get_test_groups_config(file_path)[source]

Reads the test groups from a config file

Note

This needs to be a list instead of a dictionary to preserve order in python < 2.7

Parameters:file_path (str) – The path to the config file
Returns:List of test groups
Return type:list
owtf.managers.plugin.get_types_for_plugin_group(session, plugin_group)[source]

Get available plugin types for a plugin group

Parameters:plugin_group (str) – Plugin group
Returns:List of available plugin types
Return type:list
owtf.managers.plugin.load_plugins(session)[source]

Loads the plugins from the filesystem and updates their info.

Note

Walks through each sub-directory of PLUGINS_DIR. For each file, loads it thanks to the imp module. Updates the database with the information for each plugin:

  • ‘title’: the title of the plugin
  • ‘name’: the name of the plugin
  • ‘code’: the internal code of the plugin
  • ‘group’: the group of the plugin (ex: web)
  • ‘type’: the type of the plugin (ex: active, passive, …)
  • ‘descrip’: the description of the plugin
  • ‘file’: the filename of the plugin
  • ‘internet_res’: does the plugin use internet resources?
Returns:None
Return type:None
owtf.managers.plugin.load_test_groups(session, file_default, file_fallback, plugin_group)[source]

Load test groups into the DB.

Parameters:
  • test_groups_file (str) – The path to the test groups config
  • plugin_group (str) – Plugin group to load
Returns:

None

Return type:

None

owtf.managers.plugin.plugin_gen_query(session, criteria)[source]

Generate a SQLAlchemy query based on the filter criteria :param criteria: Filter criteria :type criteria: dict :return: :rtype:

owtf.managers.plugin.plugin_name_to_code(session, codes)[source]

Given list of names, get the corresponding codes

Parameters:codes (list) – The codes to fetch
Returns:Corresponding plugin codes as a list
Return type:list

owtf.managers.poutput module

owtf.managers.resource module

owtf.managers.session module

owtf.managers.target module

owtf.managers.transaction module

owtf.managers.url module

owtf.managers.worker module

owtf.managers.worklist module

Module contents