Database Manager

class pipeline.models.db_manager.DBManager(db_location)

Class that encapsulates database transactions and queries

add(item)

Simple helper to add a record to the database

add_ipv4_or_v6_address_to_target(tgt, ipaddr)

Simple helper that adds an appropriate IPAddress to the given target

close()

Simple helper to close the database session

get_all_endpoints()

Simple helper that returns all Endpoints from the database

get_all_exploit_types()

Simple helper that returns all exploit types reported by searchsploit

get_all_hostnames() → list

Simple helper to return all hostnames from Target records

get_all_ipv4_addresses() → list

Simple helper to return all ipv4 addresses from Target records

get_all_ipv6_addresses() → list

Simple helper to return all ipv6 addresses from Target records

get_all_nmap_reported_products()

Simple helper that returns all products reported by nmap

get_all_nse_script_types()

Simple helper that returns all NSE Script types from the database

get_all_port_numbers()

Simple helper that returns all Port.port_numbers from the database

get_all_targets()

Simple helper to return all ipv4/6 and hostnames produced by running amass

get_all_web_targets()

Simple helper that returns all Targets tagged as having an open web port

get_and_filter(model, defaults=None, **kwargs)

Simple helper to either get an existing record if it exists otherwise create and return a new instance

get_endpoint_by_status_code(code)

Simple helper that returns all Endpoints filtered by status code

get_endpoints_by_ip_or_hostname(ip_or_host)

Simple helper that returns all Endpoints filtered by ip or hostname

get_nmap_scans_by_ip_or_hostname(ip_or_host)

Simple helper that returns all Endpoints filtered by ip or hostname

get_or_create(model, **kwargs)

Simple helper to either get an existing record if it exists otherwise create and return a new instance

get_or_create_target_by_ip_or_hostname(ip_or_host)

Simple helper to query a Target record by either hostname or ip address, whichever works

get_ports_by_ip_or_host_and_protocol(ip_or_host, protocol)

Simple helper that returns all ports based on the given protocol and host

get_status_codes()

Simple helper that returns all status codes found during scanning