Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/wrapper/CxConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export enum CxConstants {
SUB_CMD_CREATE = "create",
CMD_TRIAGE = "triage",
SUB_CMD_UPDATE = "update",
CMD_RESULT = "result",
CMD_RESULT = "results",
SCAN_INFO_FORMAT = "--scan-info-format",
FORMAT = "--format",
FORMAT_JSON = "json",
Expand Down
10 changes: 5 additions & 5 deletions src/main/wrapper/CxWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class CxWrapper {
async getResultsList(scanId: string) {
const exec = new ExecutionService();
const fileName = new Date().getTime().toString();
const commands = this.createResultCommand(scanId, CxConstants.FORMAT_JSON, fileName, os.tmpdir())
const commands = this.resultsShow(scanId, CxConstants.FORMAT_JSON, fileName, os.tmpdir())
// Executes the command and creates a result file
await exec.executeResultsCommands(this.config.pathToExecutable, commands)
// Reads the result file and retrieves the results
Expand All @@ -182,21 +182,21 @@ export class CxWrapper {
async getResultsSummary(scanId: string): Promise<CxCommandOutput> {
const exec = new ExecutionService();
const fileName = new Date().getTime().toString();
const commands = this.createResultCommand(scanId, CxConstants.FORMAT_HTML_CLI, fileName, os.tmpdir());
const commands = this.resultsShow(scanId, CxConstants.FORMAT_HTML_CLI, fileName, os.tmpdir());
// Executes the command and creates a result file
await exec.executeResultsCommands(this.config.pathToExecutable, commands);
// Reads the result file and retrieves the results
return exec.executeResultsCommandsFile(scanId, CxConstants.FORMAT_HTML, CxConstants.FORMAT_HTML_FILE, commands,this.config.pathToExecutable,fileName);
}

async getResults(scanId: string, resultType:string, outputFileName: string, outputFilePath: string) {
const commands = this.createResultCommand(scanId, resultType, outputFileName, outputFilePath)
const commands = this.resultsShow(scanId, resultType, outputFileName, outputFilePath)
const exec = new ExecutionService();
return await exec.executeCommands(this.config.pathToExecutable, commands);
}

createResultCommand(scanId: string, reportFormat: string, outputFileName: string, outputPath: string): string[] {
const commands: string[] = [CxConstants.CMD_RESULT, CxConstants.SCAN_ID, scanId,CxConstants.REPORT_FORMAT , reportFormat];
resultsShow(scanId: string, reportFormat: string, outputFileName: string, outputPath: string): string[] {
const commands: string[] = [CxConstants.CMD_RESULT,CxConstants.SUB_CMD_SHOW, CxConstants.SCAN_ID, scanId,CxConstants.REPORT_FORMAT , reportFormat];
if (outputFileName) {
commands.push(CxConstants.OUTPUT_NAME);
commands.push(outputFileName);
Expand Down