API
Monarch build services leverage the monarch-c2-sdk python package for handling build requests. Under the hood, a build service is a simple HTTP server that handles post requests from the build client that comes pre-installed in monarch builder containers.
Each request is automatically reformatted into a BuildRequest
object, predefined by the monarch package, that contains the build parameters as a dictionary of values.
class BuildRequest:
def __init__(self, params: dict):
"""
An object representing a build request received from the main C2 server.
:param params: a dictionary of build parameters.
"""
self.params = params
After this, a registered callback, your build routine, is called with the BuildRequest
passed as a parameter. Your callback is expected to return a BuildResponse
object, which tells Monarch's build client whether build was successful, if any errors were reported, and if none, the actual binary that was built.
class BuildResponse:
def __init__(self, status: int, error: str, build: str):
"""
An object representing a response to a build request received from the main C2 server.
A build would typically end with a status (STATUS_SUCCESS | STATUS_ERROR), an error message (if applicable),
and the binary or file produced by the build.
:param status: build status, either STATUS_SUCCESS or STATUS_ERROR
:param error: build error message, if any
:param build: the build file. If multiple files are produced, then return an archive.
"""
self.status = status
self.error = error
self.build = build
Last updated