Path

class baboossh.Path(src, dst)[source]

Indicates an endpoint is reachable from a host

A path is created when an Endpoint can be reached from a Host, either by being on the same network or by not having filtering between both. This is used to pivot through compromised hosts to reach endpoints which could not be accessed from the user’s position in the network (“Local”)

This class provides various functions to get paths to Endpoints through several pivots, or to discover new paths to the host.

src

the starting Host of the path. if None, the path starts at “Local”, the user current’s position in the network.

Type

Host or None

dst

the destination Endpoint of the path

Type

Endpoint

id

The path id

Type

int

__init__(src, dst)[source]

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

Methods

__init__(src, dst)

Initialize self.

delete()

Delete an Path from the Workspace

direct(dst)

Check if there is a direct Path from “Local” to an Endpoint

find_all([src, dst])

Find all Paths

find_one([path_id])

Find an path by its id

get(dst[, first])

Get the chain of paths from “Local” to an Endpoint

get_id(src, dst)

save()

Save the Path in database

Attributes

scope

delete()[source]

Delete an Path from the Workspace

classmethod direct(dst)[source]

Check if there is a direct Path from “Local” to an Endpoint

Parameters

dst (Endpoint) – the Endpoint to use as destination

Returns

True if there is a Path from “Local” to dst, False otherwise

classmethod find_all(src=None, dst=None)[source]

Find all Paths

Parameters
  • src (Host or None) – the Host to use as source, “Local” if (int)0

  • dst (Endpoint) – the Endpoint to use as destination

Returns

A list of all Path s in the Workspace

classmethod find_one(path_id=None)[source]

Find an path by its id

Parameters

pathId (int) – the path id to search

Returns

A single Path or None.

classmethod get(dst, first=True)[source]

Get the chain of paths from “Local” to an Endpoint

Parameters

dst (Endpoint) – the destination Endpoint

Returns

A List of Hosts forming a chain from “Local” to dst

Raises

NoPathError – if no path could be found to dst

save()[source]

Save the Path in database

If the Path 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.