Endpoint

class baboossh.Endpoint(ip, port)[source]

A SSH endpoint

An Endpoint is a couple of an IP address and a port on which a SSH server is (supposed) being run.

ip

The IP address of the Endpoint

Type

str

port

The port number of the Endpoint

Type

str

id

The endpoint id

Type

int

host

The Endpoint’s Host

Type

Host

scope

Whether the Endpoint is in scope or not

Type

bool

reachable

Whether the Endpoint was reached with path find

Type

bool

distance

The number of hops to reach the Endpoint

Type

int

found

The Endpoint on which the current Endpoint was discovered

Type

Endpoint

__init__(ip, port)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(ip, port)

Initialize self.

delete()

Delete an Endpoint from the Workspace

find_all([scope, found])

Find all Endpoints matching the criteria

find_one([endpoint_id, ip_port])

Find an Endpoint by its id or it’s IP address:Port

get_id(ip, port)

save()

Save the Endpoint in database

search(field, val[, show_all])

Search in the workspace for an Endpoint

Attributes

connection

port

search_fields

delete()[source]

Delete an Endpoint from the Workspace

classmethod find_all(scope=None, found=None)[source]

Find all Endpoints matching the criteria

Parameters
  • scope (bool) – List Endpoints in scope (True), out of scope (False), or both (None)

  • found (Endpoint) – The Endpoint the endpoints were discovered on

Returns

A list of all Endpoint s in the Workspace

classmethod find_one(endpoint_id=None, ip_port=None)[source]

Find an Endpoint by its id or it’s IP address:Port

Parameters
  • endpoint_id (int) – the Endpoint id to search

  • ip_port (str) – The IP and port as “<ip>:<port>”

Returns

A single Endpoint or None.

save()[source]

Save the Endpoint in database

If the Endpoint object has an id it means it is already stored in database, so it is updated. Else it is inserted and the id is set in the object.

classmethod search(field, val, show_all=False)[source]

Search in the workspace for an Endpoint

Parameters
  • field (str) – the Endpoint attribute to search in

  • val (str) – the value to search for

  • show_all (bool) – whether to include out-of scope Endpoint s in search results

Returns

A List of Endpoint s corresponding to the search.