owtf.managers package

Submodules

owtf.managers.command_register module

owtf.managers.config module

owtf.managers.config_manager

Manage configuration methods.

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

Generate query

Parameters:

criteria (dict) – Filter criteria

Returns:

Return type:

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_conf(session)[source]

Get the config dict

Returns:

Replaced dict

Return type:

dict

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.managers.mapping module

owtf.managers.plugin module

owtf.managers.plugin

This module manages the plugins and their dependencies

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_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_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.poutput module

owtf.managers.resource module

owtf.managers.resource

Provides helper functions for plugins to fetch resources.

owtf.managers.resource.get_raw_resource_list(session, resource_list)[source]

Get raw resources as from a resource list

Parameters:

resource_list (list) – List of resource types

Returns:

List of raw resources

Return type:

list

owtf.managers.resource.get_raw_resources(session, resource_type)[source]

Fetch raw resources filtered on type

Parameters:

resource_type (str) – Resource type

Returns:

List of raw resources

Return type:

list

owtf.managers.resource.get_resource_list(session, resource_type_list)[source]

Get list of resources from list of types

Parameters:

resource_type_list (list) – List of resource types

Returns:

List of resources

Return type:

list

owtf.managers.resource.get_resources(resource_type)[source]

Fetch resources filtered on type

Parameters:

resource_type (str) – Resource type

Returns:

List of resources

Return type:

list

owtf.managers.resource.get_resources_from_file(resource_file)[source]

Fetch resources for a file

Parameters:

resource_file (str) – Path to the resource file

Returns:

Resources as a set

Return type:

set

owtf.managers.resource.get_rsrc_replacement_dict(session)[source]

Get the configuration update changes as a dict :return: :rtype:

owtf.managers.resource.load_resources_from_file(session, default, fallback)[source]

Parses the resources config file and loads data into the DB .. note:

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

file_path (str) – Path to the resources config file

Returns:

None

Return type:

None

owtf.managers.session module

owtf.managers.session

Manager functions for sessions

owtf.managers.session.add_session(session, session_name)[source]

Adds a new session to the DB

Parameters:

session_name (str) – Name of the new session

Returns:

None

Return type:

None

owtf.managers.session.add_target_to_session(*args, **kwargs)[source]
owtf.managers.session.delete_session(session, session_id)[source]

Deletes a session from the DB

Parameters:

session_id (int) – ID of the session to delete

Returns:

None

Return type:

None

owtf.managers.session.get_all_session_dicts(session, filter_data)[source]

Get session dicts based on filter criteria

Parameters:

filter_data (dict) – Filter data

Returns:

List of session dicts

Return type:

dict

owtf.managers.session.remove_target_from_session(*args, **kwargs)[source]
owtf.managers.session.session_generate_query(session, filter_data=None)[source]

Generate query based on filter data

Parameters:

filter_data (dict) – Filter data

Returns:

Return type:

owtf.managers.session.session_required(func)[source]

In order to use this decorator on a method there is one requirements , target_id must be a kwarg of the function

All this decorator does is check if a valid value is passed for target_id if not get the target_id from target manager and pass it

owtf.managers.target module

owtf.managers.transaction module

owtf.managers.url module

owtf.managers.worker module

owtf.managers.worklist module

Module contents