diff --git a/api/agent.html b/api/agent.html index 3280fc3..fa9240e 100644 --- a/api/agent.html +++ b/api/agent.html @@ -188,7 +188,7 @@

Client< the broker.

-bind(port: int = 5555, ip: str = '*') None
+bind(port: int = 5555, ip: str = '*') None

Bind on the given IP and port, to listen incoming messages.

Parameters:
@@ -205,7 +205,7 @@

Client<
-connect(remote: str = 'localhost', port: int = 5555) bool
+connect(remote: str = 'localhost', port: int = 5555) bool

Connect to a remote server on the given remote IP and port.

Parameters:
@@ -222,7 +222,7 @@

Client<
-critical(message: str) None[source]
+critical(message: str) None[source]

Send a critical (level) message to the broker.

Parameters:
@@ -233,7 +233,7 @@

Client<
-debug(message: str) None[source]
+debug(message: str) None[source]

Send a debug message to the broker

Parameters:
@@ -244,7 +244,7 @@

Client<
-error(message: str) None[source]
+error(message: str) None[source]

Send an error (level) message to the broker.

Parameters:
@@ -255,7 +255,7 @@

Client<
-info(message: str) None[source]
+info(message: str) None[source]

Send an info (level) message to the broker

Parameters:
@@ -280,7 +280,7 @@

Client<
-register_callback(typ: MessageType, callback: Callable) None
+register_callback(typ: MessageType, callback: Callable) None

Register a callback function on a given message type.

Parameters:
@@ -297,7 +297,7 @@

Client<
-register_data_callback(cb: Callable) None[source]
+register_data_callback(cb: Callable) None[source]

Register callback called when data is received. At the moment data are necessarily AlertData messages.

@@ -309,7 +309,7 @@

Client<
-register_seed_callback(cb: Callable) None[source]
+register_seed_callback(cb: Callable) None[source]

Register a callback called when an input seed is received from the broker. The callback function take 2 parameters seed type and content.

@@ -321,7 +321,7 @@

Client<
-register_start_callback(cb: Callable) None[source]
+register_start_callback(cb: Callable) None[source]

Register a callback that will be called when a start message will be received. The callback should take 11 parameters.

@@ -333,7 +333,7 @@

Client<
-register_stop_callback(cb: Callable) None[source]
+register_stop_callback(cb: Callable) None[source]

Register a callback called when the broker send a STOP message. The fuzzing has to stop running and sending data.

@@ -345,13 +345,13 @@

Client<
-run() None
+run() None

Run receiving loop in a blocking manner.

-send(msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None
+send(msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None

Send a message on the socket (thus to the broker). Should only be used as a client (fuzzing agent).

@@ -366,7 +366,7 @@

Client<
-send_alert_data(alert_data: AlertData) None[source]
+send_alert_data(alert_data: AlertData) None[source]

Send information related to the coverage or validation of a specific SAST alert.

@@ -378,7 +378,7 @@

Client<
-send_hello(engines: List[FuzzingEngineInfo], arch: Arch | None = None, platform: Platform | None = None) bool[source]
+send_hello(engines: List[FuzzingEngineInfo], arch: Arch | None = None, platform: Platform | None = None) bool[source]

Send the hello message to the broker. engines parameter is the list of fuzzing engines that “we” as client support. E.g: Pastisd is meant to be an interface for all engines locally, so it will advertise multiple engines.

@@ -395,7 +395,7 @@

Client<
-send_log(level: LogLevel, message: str) None[source]
+send_log(level: LogLevel, message: str) None[source]

Log message to be sent and printed by the broker. All logs received by the broker are logged in a client specific logfile.

@@ -411,7 +411,7 @@

Client<
-send_seed(typ: SeedType, seed: bytes) None[source]
+send_seed(typ: SeedType, seed: bytes) None[source]

Send an input seed to the broker. The typ indicates the type of the seed, namely, input, crash or hang.

@@ -426,14 +426,14 @@

Client<
-send_stop_coverage_criteria() None[source]
+send_stop_coverage_criteria() None[source]

Send a message to the broker indicating, the program has been fully covered in accordance to the coverage criteria (metric).

-send_telemetry(state: State | None = None, exec_per_sec: int | None = None, total_exec: int | None = None, cycle: int | None = None, timeout: int | None = None, coverage_block: int | None = None, coverage_edge: int | None = None, coverage_path: int | None = None, last_cov_update: int | None = None) None[source]
+send_telemetry(state: State | None = None, exec_per_sec: int | None = None, total_exec: int | None = None, cycle: int | None = None, timeout: int | None = None, coverage_block: int | None = None, coverage_edge: int | None = None, coverage_path: int | None = None, last_cov_update: int | None = None) None[source]

Send a telemetry message to the broker. These data could be used on the broker side to plot statistics.

@@ -455,7 +455,7 @@

Client<
-send_to(id: bytes, msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None
+send_to(id: bytes, msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None

Send a message to a given client. Only meant to be used when running as a server.

@@ -471,19 +471,19 @@

Client<
-start() None
+start() None

Start the listening thread.

-stop() None
+stop() None

Stop the listening thread.

-warning(message: str) None[source]
+warning(message: str) None[source]

Send a warning (level) message to the broker.

Parameters:
@@ -503,7 +503,7 @@

Broker<

Bases: NetworkAgent

-bind(port: int = 5555, ip: str = '*') None
+bind(port: int = 5555, ip: str = '*') None

Bind on the given IP and port, to listen incoming messages.

Parameters:
@@ -520,7 +520,7 @@

Broker<
-connect(remote: str = 'localhost', port: int = 5555) bool
+connect(remote: str = 'localhost', port: int = 5555) bool

Connect to a remote server on the given remote IP and port.

Parameters:
@@ -551,7 +551,7 @@

Broker<
-register_callback(typ: MessageType, callback: Callable) None
+register_callback(typ: MessageType, callback: Callable) None

Register a callback function on a given message type.

Parameters:
@@ -568,43 +568,43 @@

Broker<
-register_data_callback(cb: Callable) None[source]
+register_data_callback(cb: Callable) None[source]
-register_hello_callback(cb: Callable) None[source]
+register_hello_callback(cb: Callable) None[source]
-register_log_callback(cb: Callable) None[source]
+register_log_callback(cb: Callable) None[source]
-register_seed_callback(cb: Callable) None[source]
+register_seed_callback(cb: Callable) None[source]
-register_stop_coverage_callback(cb: Callable) None[source]
+register_stop_coverage_callback(cb: Callable) None[source]
-register_telemetry_callback(cb: Callable) None[source]
+register_telemetry_callback(cb: Callable) None[source]
-run() None
+run() None

Run receiving loop in a blocking manner.

-send(msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None
+send(msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None

Send a message on the socket (thus to the broker). Should only be used as a client (fuzzing agent).

@@ -619,7 +619,7 @@

Broker<
-send_seed(id: bytes, typ: SeedType, seed: bytes) None[source]
+send_seed(id: bytes, typ: SeedType, seed: bytes) None[source]

Send the given input to the client id.

Parameters:
@@ -634,7 +634,7 @@

Broker<
-send_start(id: bytes, name: str, package: str | Path, argv: List[str], exmode: ExecMode, fuzzmode: FuzzMode, ckmode: CheckMode, covmode: CoverageMode, engine: FuzzingEngineInfo, engine_args: str, seed_loc: SeedInjectLoc, sast_report: bytes | None = None) None[source]
+send_start(id: bytes, name: str, package: str | Path, argv: List[str], exmode: ExecMode, fuzzmode: FuzzMode, ckmode: CheckMode, covmode: CoverageMode, engine: FuzzingEngineInfo, engine_args: str, seed_loc: SeedInjectLoc, sast_report: bytes | None = None) None[source]

Send a START message to a fuzzing agent with all the parameters it is meant to run with.

Parameters:
@@ -658,7 +658,7 @@

Broker<
-send_stop(id: bytes) None[source]
+send_stop(id: bytes) None[source]

Send a stop message to the client.

Parameters:
@@ -669,7 +669,7 @@

Broker<
-send_to(id: bytes, msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None
+send_to(id: bytes, msg: InputSeedMsg | StartMsg | StopMsg | HelloMsg | LogMsg | TelemetryMsg | StopCoverageCriteria | DataMsg, msg_type: MessageType | None = None) None

Send a message to a given client. Only meant to be used when running as a server.

@@ -685,13 +685,13 @@

Broker<
-start() None
+start() None

Start the listening thread.

-stop() None
+stop() None

Stop the listening thread.

diff --git a/api/descr.html b/api/descr.html index b28f5e3..da6a1e1 100644 --- a/api/descr.html +++ b/api/descr.html @@ -122,7 +122,7 @@ so that the broker can load them and forwarding them to clients.

-static from_file(filepath: Path) EngineConfiguration[source]
+static from_file(filepath: Path) EngineConfiguration[source]

Load a configuration object from file.

Parameters:
@@ -136,7 +136,7 @@
-static from_str(s: str) EngineConfiguration[source]
+static from_str(s: str) EngineConfiguration[source]

Parse a string to a configuration object.

Parameters:
@@ -175,7 +175,7 @@
-set_target(target: int) None[source]
+set_target(target: int) None[source]

Set a specific target (address, index etc), that should be targeted by the fuzzing engine. This will be used when running in a targeted way.

@@ -187,7 +187,7 @@
-to_str() str[source]
+to_str() str[source]

Serialize configuration object to string.

Returns:
@@ -223,7 +223,7 @@
-static accept_file(binary_file: Path) Tuple[bool, ExecMode | None, FuzzMode | None][source]
+static accept_file(binary_file: Path) Tuple[bool, ExecMode | None, FuzzMode | None][source]

Function called by the broker with all executable files detected in its directory. As an fuzzer developer, you have to implement this function to indicate whether a file is accepted as a target or not.

@@ -245,7 +245,7 @@
-static supported_coverage_strategies() List[CoverageMode][source]
+static supported_coverage_strategies() List[CoverageMode][source]

List of coverage metrics supported by the fuzzer. If it only support a single one, it should be CoverageMode.AUTO.

diff --git a/api/package.html b/api/package.html index a6e4079..071704d 100644 --- a/api/package.html +++ b/api/package.html @@ -113,7 +113,7 @@
-class libpastis.package.BinaryPackage(main_binary: Path)[source]
+class libpastis.package.BinaryPackage(main_binary: Path)[source]

Binary Package representing a given target to fuzz along with its shared libraries and additional files required (cmplog, dictionnary etc.). This object is received by fuzzing agents as part of the START message.

@@ -140,7 +140,7 @@
-static auto(exe_file: Path | str) BinaryPackage | None[source]
+static auto(exe_file: Path | str) BinaryPackage | None[source]

Take a file and try creating a BinaryPackage with it. The exe_file is the main executable file. From that the function will look for quokka, cmplog, dictionary files (in the same directory).

@@ -156,7 +156,7 @@
-static auto_directory(exe_file: str | Path) BinaryPackage | None[source]
+static auto_directory(exe_file: str | Path) BinaryPackage | None[source]

Create a BinaryPackage with all files it can find in the given directory. The difference with BinaryPackage.auto() is that all additional files in the directory will be added to the @@ -173,7 +173,7 @@

-property callgraph: Path | None
+property callgraph: Path | None

Path to the callgraph file if provided.

Returns:
@@ -184,7 +184,7 @@
-property cmplog: Path | None
+property cmplog: Path | None

Path to the complog executable file if provided.

Returns:
@@ -195,7 +195,7 @@
-property dictionary: Path | None
+property dictionary: Path | None

Path the to dictionnary file if provided.

Returns:
@@ -206,7 +206,7 @@
-property executable_path: Path
+property executable_path: Path

Path to the main executable file to fuzz.

Returns:
@@ -217,7 +217,7 @@
-static from_binary(name: str, binary: bytes, extract_dir: Path) BinaryPackage[source]
+static from_binary(name: str, binary: bytes, extract_dir: Path) BinaryPackage[source]

Convert the binary blob received as a BinaryPackage object. If its an archive, extract it and return the list of files. Files are extracted in /tmp. If directly an executable save it to a file and return its path. Also ensure @@ -234,14 +234,14 @@

list of file paths

Raises:
-

FileNotFoundError – if the mime type of the binary is not recognized

+

FileNotFoundError – if the mime type of the binary is not recognized

-is_cmplog() bool[source]
+is_cmplog() bool[source]

Check if the package contains a cmplog file.

Returns:
@@ -252,7 +252,7 @@
-is_dictionary() bool[source]
+is_dictionary() bool[source]

Check if the package contains a dictionnary.

Returns:
@@ -263,7 +263,7 @@
-is_quokka() bool[source]
+is_quokka() bool[source]

Check if the package contains a quokka file.

Returns:
@@ -274,7 +274,7 @@
-is_standalone() bool[source]
+is_standalone() bool[source]

Indicates that this BinaryPackage only contains the program under test and no additional files such as a Quokka database or a cmplog instrumented binary. This is used in pastis-broker when sending the ‘start’ command to agents.

@@ -282,7 +282,7 @@
-make_package() Path[source]
+make_package() Path[source]

Pack the BinaryPackage in a zip file.

Returns:
@@ -293,7 +293,7 @@
-property name: str
+property name: str

Name of the executable file

Returns:
@@ -315,7 +315,7 @@
-property quokka: Path | None
+property quokka: Path | None

Path to the quokka file if provided.

Returns:
diff --git a/api/sast.html b/api/sast.html index 6dccfd4..26a9d35 100644 --- a/api/sast.html +++ b/api/sast.html @@ -130,13 +130,13 @@ used to perform alert driven testing.

-file: str
+file: str

Severity of the alert (e.g: Review, Error, Critical ..)

-static from_json(data: dict) SASTAlert[source]
+static from_json(data: dict) SASTAlert[source]

Create a SASTAlert object from the JSON data provided.

Parameters:
@@ -150,43 +150,43 @@
-function: str
+function: str

line of code (in the file)

-line: int
+line: int

Source file impacted

-params: list
+params: list

Type of the alert BoF, UaF (in the convention of the SAST)

-raw_line: str
+raw_line: str

Function impacted

-severity: str
+severity: str

Taxonomy of the alert (e.g: CWE, CVE, MISRA checker, ..)

-taxonomy: str
+taxonomy: str

Additional parameters of the alert (list)

-to_dict() dict[source]
+to_dict() dict[source]

Export the alert attribute to a valid JSON dictionnary that can be written to file.

@@ -198,7 +198,7 @@
-type: str
+type: str

Unique ID of the alert

@@ -222,7 +222,7 @@

SAST report. Manages a list of SAST alerts taken from a report.

-add_alert(alert: SASTAlert) None[source]
+add_alert(alert: SASTAlert) None[source]

Add an alert in the report. This function is solely meant to be used by the report parser

@@ -234,7 +234,7 @@
-all_alerts_validated() bool[source]
+all_alerts_validated() bool[source]

Checks if all alerts have been validated (and thus covered)

Returns:
@@ -245,7 +245,7 @@
-static from_file(file: str | Path) SASTReport[source]
+static from_file(file: str | Path) SASTReport[source]

Parse the given file into a SAST report object.

Parameters:
@@ -259,7 +259,7 @@
-static from_json(data: str | bytes) SASTReport[source]
+static from_json(data: str | bytes) SASTReport[source]

Parse the given string into a SAST report object.

Parameters:
@@ -273,7 +273,7 @@
-get_stats() Tuple[int, int, int][source]
+get_stats() Tuple[int, int, int][source]

Get stats about the report. The results is a triple with the number of alerts covered, validated and total.

@@ -285,14 +285,14 @@
-iter_alerts() List[SASTAlert][source]
+iter_alerts() List[SASTAlert][source]

Iterate all the alerts of the report. :return: list of alerts

-to_json() str[source]
+to_json() str[source]

Export the current state of the alerts within a JSON dictionnary.

Returns:
@@ -303,7 +303,7 @@
-write(out_file) None[source]
+write(out_file) None[source]

Export the current state of the alerts within a JSON dictionary.

Parameters:
@@ -314,7 +314,7 @@
-write_csv(file: Path) None[source]
+write_csv(file: Path) None[source]

Write the report as a csv into the given file.

Parameters:
diff --git a/api/types.html b/api/types.html index 6c9f7e7..a28e619 100644 --- a/api/types.html +++ b/api/types.html @@ -225,25 +225,25 @@

Types

-class libpastis.types.AlertData(id: int, covered: bool, validated: bool, seed: bytes, address: int = 0)[source]
-

Bases: object

+class libpastis.types.AlertData(id: int, covered: bool, validated: bool, seed: bytes, address: int = 0)[source] +

Bases: object

AlertData is data message that can be sent from fuzzing agents to the broker to indicates that an alert has been covered or validated.

-address: int
+address: int

Input that reached or validated the alert

-covered: bool
+covered: bool

Id of the alert

-static from_json(data: str) AlertData[source]
+static from_json(data: str) AlertData[source]

Convert an AlertData in json to an instance.

Parameters:
@@ -257,13 +257,13 @@
-seed: bytes
+seed: bytes

True if the alert has been validated

-to_json() str[source]
+to_json() str[source]

Serialize the alert to JSON.

Returns:
@@ -274,7 +274,7 @@
-validated: bool
+validated: bool

True if the alert has been covered

@@ -336,7 +336,7 @@
class libpastis.types.CoverageMode(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
-

Bases: str, Enum

+

Bases: str, Enum

Coverage metrics to use. Some fuzzing engines do support multiple coverage metrics, thus the enum indicates the one to use.

@@ -387,7 +387,7 @@
-count(sub[, start[, end]]) int
+count(sub[, start[, end]]) int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

@@ -411,7 +411,7 @@
-endswith(suffix[, start[, end]]) bool
+endswith(suffix[, start[, end]]) bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. @@ -427,7 +427,7 @@

-find(sub[, start[, end]]) int
+find(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

@@ -436,21 +436,21 @@
-format(*args, **kwargs) str
+format(*args, **kwargs) str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

-format_map(mapping) str
+format_map(mapping) str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

-index(sub[, start[, end]]) int
+index(sub[, start[, end]]) int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

@@ -640,7 +640,7 @@
-rfind(sub[, start[, end]]) int
+rfind(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

@@ -649,7 +649,7 @@
-rindex(sub[, start[, end]]) int
+rindex(sub[, start[, end]]) int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

@@ -731,7 +731,7 @@
-startswith(prefix[, start[, end]]) bool
+startswith(prefix[, start[, end]]) bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. @@ -841,8 +841,8 @@

-class libpastis.types.FuzzingEngineInfo(name: str, version: str, pymodule: str)[source]
-

Bases: object

+class libpastis.types.FuzzingEngineInfo(name: str, version: str, pymodule: str)[source] +

Bases: object

Class to represent a fuzzing engine metadata. It contains its name, version and the Python module where to load the descriptor and configuration object.