Connection¶
-
class
baboossh.
Connection
(endpoint, user, cred)[source]¶ A
User
andCreds
to authenticate on anEndpoint
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 aTunnel
to it or use it as a pivot to reach newEndpoint
s-
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.
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 databasefind_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 databaseAttributes
Returns the number of hops between “Local” and the
Endpoint
Returns whether the Connection is in scope
-
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
orTag
) – the Connection endpoint to search or aTag
of endpoints to searchuser (
User
) – the Connection user to searchcreds (
Creds
) – the Connection creds to searchscope (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
- Returns
A single Connection or None.
-