Connection

class baboossh.Connection(endpoint, user, cred)[source]

A User and Creds to authenticate on an Endpoint

A connection represents the working association of those 3 objects to connect a target. It can be used to run payloads on a Host, open a Tunnel to it or use it as a pivot to reach new Endpoint s

endpoint

the Connection ‘s endpoint

Type

Endpoint

user

the Connection ‘s user

Type

User

creds

the Connection ‘s credentials

Type

Creds

id

the Connection ‘s id

Type

int

used_by_connections

a list of Connection using the current one as a pivot. Used for recursive connection closure.

Type

[Connection,..]

used_by_tunnels

a list of Tunnel using the current connection as a pivot. Used for recursive connection closure.

Type

[Tunnel,..]

__init__(endpoint, user, cred)[source]

Create the object and fetches info from database if it has been saved.

Parameters
  • endpoint (Endpoint) – The Connection’s endpoint

  • user (User) – The Connection’s user

  • cred (Creds) – The Connection’s credentials

Methods

__init__(endpoint, user, cred)

Create the object and fetches info from database if it has been saved.

close()

delete()

Delete the Connection from the Workspace’s database

find_all([endpoint, user, creds, scope])

Find all Connection matching the criteria

find_one([connection_id, endpoint, scope, …])

Find a Connection by its id, endpoint or if it can be used as a gateway to an Endpoint

from_target(arg)

get_id(endpoint, user, cred)

Generate an ID for unicity

identify(socket)

Indentify the host

open([verbose, target])

probe([gateway, verbose])

run(payload, current_workspace_directory, stmt)

save()

Save the Connection to the Workspace’s database

Attributes

distance

Returns the number of hops between “Local” and the Endpoint

scope

Returns whether the Connection is in scope

delete()[source]

Delete the Connection from the Workspace’s database

property distance

Returns the number of hops between “Local” and the Endpoint

classmethod find_all(endpoint=None, user=None, creds=None, scope=None)[source]

Find all Connection matching the criteria

If two or more arguments are specified, the returned Connections must match each (“AND”)

Parameters
  • endpoint (Endpoint or Tag) – the Connection endpoint to search or a Tag of endpoints to search

  • user (User) – the Connection user to search

  • creds (Creds) – the Connection creds to search

  • scope (bool) – whether to include only in scope Connections (True), out of scope Connections (False) or both (None)

Returns

A list of matching Connection.

classmethod find_one(connection_id=None, endpoint=None, scope=None, gateway_to=None)[source]

Find a Connection by its id, endpoint or if it can be used as a gateway to an Endpoint

Parameters
  • connection_id (int) – the Connection id to search

  • endpoint (Endpoint) – the Connection endpoint to search

  • gateway_to (Endpoint) – the Endpoint to which you want to find a gateway

  • scope (bool) – whether to include only in scope Connections (True), out of scope Connections (False) or both (None)

Returns

A single Connection or None.

classmethod get_id(endpoint, user, cred)[source]

Generate an ID for unicity

Args: See __init__

Returns

A str corresponding to the Connection hash

identify(socket)[source]

Indentify the host

save()[source]

Save the Connection to the Workspace’s database

property scope

Returns whether the Connection is in scope

The Connection is in scope if its User, its Creds AND it Endpoint are all in scope