Example #1
0
def get_note(workspace_name, note_id):
    """Take a workspace name and note_id as strings. Return a dictionary
    containing the note matching note_id on workspace workspace_name if found,
    or None if no notes were found.

    Will raise a MoreThanOneObjectFoundByID error if for some reason
    the note_id is shared by two or more notes in the workspace. This
    should never happen.
    """
    return force_unique(get_notes(workspace_name, couchid=note_id))
Example #2
0
def get_credential(workspace_name, credential_id):
    """Take a workspace name and credential_id as strings. Return a dictionary
    containing the credential matching credential_id on workspace
    workspace_name if found, or None if no credentials were found.

    Will raise a MoreThanOneObjectFoundByID error if for some reason
    the credential_id is shared by two or more credentials in the workspace.
    This should never happen.
    """
    return force_unique(get_services(workspace_name, couchid=credential_id))
Example #3
0
def get_web_vuln(workspace_name, vuln_id):
    """Take a workspace name and vuln_id as strings. Return a dictionary
    containing the web vuln matching vuln_id on workspace workspace_name if found,
    or None if no web vulns were found.

    Will raise a MoreThanOneObjectFoundByID error if for some reason
    the vuln_id is shared by two or more web vulns in the workspace. This
    should never happen.
    """
    return force_unique(get_web_vulns(workspace_name, couchid=vuln_id))
Example #4
0
def get_object(workspace_name, object_signature, object_id):
    """Take a workspace_name, an object_signature and an object_id as strings,
    return the dictionary containging the object of type object_signature
    and matching object_id in the workspace workspace_name, or None if
    no object matching object_id was found.

    object_signature must be either 'hosts', 'vulns', 'interfaces'
    'services', 'credentials', 'notes' or 'commands'.
    Will raise an WrongObjectSignature error if this condition is not met.

    Will raise a MoreThanOneObjectFoundByID error if for some reason
    the object_id is shared by two or more objects in the workspace. This
    should never happen.
    """
    objects = get_objects(workspace_name, object_signature, couchid=object_id)
    return force_unique(objects)
Example #5
0
def get_note(workspace_name, note_id):
    return force_unique(get_notes(workspace_name, couchid=note_id))
Example #6
0
def get_credential(workspace_name, credential_id):
    return force_unique(get_credentials(workspace_name, couchid=credential_id))
Example #7
0
def get_service(workspace_name, service_id):
    """Return the Service of id service_id. None if not found."""
    return force_unique(get_services(workspace_name, couchid=service_id))
Example #8
0
def get_web_vuln(workspace_name, vuln_id):
    """Return the WebVuln of id vuln_id. None if not found."""
    return force_unique(get_web_vulns(workspace_name, couchid=vuln_id))
Example #9
0
def get_web_vuln(workspace_name, vuln_id):
    """Return the WebVuln of id vuln_id. None if not found."""
    return force_unique(get_web_vulns(workspace_name, couchid=vuln_id))
Example #10
0
def get_host(workspace_name, host_id):
    """Return the host by host_id. None if it can't be found."""
    return force_unique(get_hosts(workspace_name, couchid=host_id))
Example #11
0
def get_command(workspace_name, command_id):
    return force_unique(get_commands(workspace_name, couchid=command_id))
Example #12
0
def get_note(workspace_name, note_id):
    return force_unique(get_notes(workspace_name, couchid=note_id))
Example #13
0
def get_credential(workspace_name, credential_id):
    return force_unique(get_credentials(workspace_name, couchid=credential_id))
Example #14
0
def get_service(workspace_name, service_id):
    """Return the Service of id service_id. None if not found."""
    return force_unique(get_services(workspace_name, couchid=service_id))
Example #15
0
def get_interface(workspace_name, interface_id):
    """Return the Interface of id interface_id. None if not found."""
    return force_unique(get_interfaces(workspace_name, couchid=interface_id))
Example #16
0
def get_interface(workspace_name, interface_id):
    """Return the Interface of id interface_id. None if not found."""
    return force_unique(get_interfaces(workspace_name, couchid=interface_id))
Example #17
0
def get_command(workspace_name, command_id):
    return force_unique(get_commands(workspace_name, couchid=command_id))
Example #18
0
def get_host(workspace_name, host_id):
    """Return the host by host_id. None if it can't be found."""
    return force_unique(get_hosts(workspace_name, couchid=host_id))