CodeQL CLI¶
CodeQL CLI module to make it easier to run CodeQL queries.
CodeQL¶
- class ghastoolkit.CodeQL(binary: str | None = None)¶
CodeQL CLI.
- CODEQL_BINARY: list[str] | None = None¶
CodeQL Binary
- CODEQL_EXTRACTOR_PATH: str = '/home/runner/.codeql/extractors'¶
CodeQL Extractor Path
- __init__(binary: str | None = None) None ¶
Initialise CodeQL CLI Class.
- __str__() str ¶
To String.
- createDatabase(database: CodeQLDatabase, output: str | None = None, source: str | None = None, command: str | None = None, display: bool = False) str ¶
Create a CodeQL Database.
- exists() bool ¶
Check codeql is present on the system.
- property extractor_path: str¶
Third-Party extractor path location. Automatically created if the path does not exist.
- getResults(database: CodeQLDatabase, path: str | None = None, save_sarif: bool = False) CodeQLResults ¶
Get the interpreted results from CodeQL.
- readBqrs(bqrsfile: str, display: bool = False) list[list[str]] ¶
Read a BQRS file to get the raw results.
- runCommand(*argvs, display: bool = False) str | None ¶
Run CodeQL command without the binary / path.
- runQuery(database: CodeQLDatabase, path: str | None = None, cpu: int | None = None, display: bool = False, xterm_progress: str = 'auto', save_sarif: bool = False) CodeQLResults ¶
Run a CodeQL Query on a CodeQL Database.
This function will use all CPU cores by default.
- runQueryWithParameters(database: CodeQLDatabase, path: str, **kwargs)¶
Run a CodeQL query with parameters.
- runRawQuery(path: str, database: CodeQLDatabase, display: bool = False, outputtype: str = 'sarif') list | CodeQLResults ¶
Run raw query on a CodeQL Database.
- property version: str¶
Get CodeQL Version from the CLI binary.