Detection Process

File location:
  • Bundled implementation: source/client/python/scan.py

  • Cluster implementation:

    • cluster/app/source/python/scan.py

    • cluster/app/source/python/utils/py

Bundled Implementation

scan.process(entry: Entry)
Availability:

bundled implementation

Process extracted files with detection APIs.

Parameters:

entry (Entry) – File to be processed.

scan.make_env(api: API)
Availability:

bundled implementation

Generate a dictionary of environment variables based on API entry.

Parameters:

api (API) – API entry from api.yml.

Return type:

Dict[str, Any]

scan.make_cwd(api: API, entry: Entry | None = None, example: bool = False)
Availability:

bundled implementation

Generate the working directory of API entry.

Parameters:
  • api (API) – API entry from api.yml.

  • entry (Entry) – File to be processed.

  • example (bool) – If using the fallback detection API example.

Returns:

Path to the working directory.

Return type:

str

scan.init(api: API, cwd: str, env: Dict[str, Any], mime: str, uuid: str)
Availability:

bundled implementation

Run the initialisation commands of API entry.

Parameters:
  • api (API) – API entry from api.yml.

  • cwd (str) – Working directory.

  • env (Dict[str, Any]) – Environment variables.

  • mime (str) – MIME type.

  • uuid (str) – Unique identifier of current scan.

Returns:

Exit code (const.EXIT_SUCCESS or const.EXIT_FAILURE).

Return type:

int

scan.run(command: str | List[str], cwd: str = None, env: Dict[str, Any] | None = None, mime: str = 'example', file: str = 'unknown')
Availability:

bundled implementation

Run command with provided settings.

Parameters:
  • command (Union[str, List[str]]) – Command to execute.

  • cwd (str) – Working dictionary.

  • env (Dict[str, Any]) – Environment variables.

  • mime (str) – MIME type.

  • file (str) – Stem of output log file.

Returns:

Exit code (const.EXIT_SUCCESS or const.EXIT_FAILURE).

Return type:

int

scan.issue(mime: str)
Availability:

bundled implementation

Called when the execution of API commands failed.

Parameters:

mime (str) – MIME type.

Returns:

Exit code (const.EXIT_FAILURE).

Return type:

int

Raises:
exception scan.APIWarning
Bases:

Warning

Availability:

bundled implementation

Warn if API execution failed.

exception scan.APIError
Bases:

Exception

Availability:

bundled implementation

Error if API execution failed.

Cluster Implementation

process.process(entry: Entry)
Availability:

cluster implementation

See also

scan.process()

process.make_env(api: API)
Availability:

cluster implementation

See also

scan.make_env()

process.make_cwd(api: API, entry: Entry | None = None, example: bool = False)
Availability:

cluster implementation

See also

scan.make_cwd()

process.init(api: API, cwd: str, env: Dict[str, Any], mime: str, uuid: str)
Availability:

cluster implementation

See also

scan.init()

process.run(command: str | List[str], cwd: str = None, env: Dict[str, Any] | None = None, mime: str = 'example', file: str = 'unknown')
Availability:

cluster implementation

See also

scan.run()

process.issue(mime: str)
Availability:

cluster implementation

See also

scan.issue()

exception utils.APIWarning
Bases:

Warning

Availability:

cluster implementation

See also

scan.APIWarning

exception utils.APIError
Bases:

Exception

Availability:

cluster implementation

See also

scan.APIError