diff --git a/dist/index.js b/dist/index.js index 1c73120..cb44d9a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9867,12 +9867,18 @@ async function generateGithubReportFile(token) { reject(err); }); } +;// CONCATENATED MODULE: ./src/utils.js +function parseFlagsToArray(rawFlags) { + const re = /(?:(?:^|\s)-[-a-z]+)(?:(?:\s|=)(?:[^-][0-9a-z-\S]+))?/g; + return rawFlags.match(re).map(token => token.trim()).map(token => token.replace(' ', '=')); +} ;// CONCATENATED MODULE: ./src/index.js + const target = core.getInput('target', { required: false }); const urls = core.getInput('urls', { required: false }); const templates = core.getInput('templates', { required: false }); @@ -9925,11 +9931,12 @@ async function run() { if (reportConfig) params.push(`-rc=${reportConfig}`); if (config) params.push(`-config=${config}`); if (userAgent) params.push(`-H=${userAgent}`); - if (flags) params.push(flags); params.push(`-o=${ output ? output : 'nuclei.log' }`); if (src_json) params.push('-json'); if (includeRR) params.push('-irr'); + if (flags) params.push(...parseFlagsToArray(flags)); + // If everything is fine and github-report is set, generate the yaml config file. if (githubRepot) { await generateGithubReportFile(githubToken); diff --git a/src/index.js b/src/index.js index 1562f5e..eb2d1a0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ import * as core from '@actions/core'; import * as exec from '@actions/exec'; import * as installer from './installer'; import { generateGithubReportFile } from './yaml'; +import { parseFlagsToArray } from './utils'; const target = core.getInput('target', { required: false }); const urls = core.getInput('urls', { required: false }); @@ -55,11 +56,12 @@ async function run() { if (reportConfig) params.push(`-rc=${reportConfig}`); if (config) params.push(`-config=${config}`); if (userAgent) params.push(`-H=${userAgent}`); - if (flags) params.push(flags); params.push(`-o=${ output ? output : 'nuclei.log' }`); if (json) params.push('-json'); if (includeRR) params.push('-irr'); + if (flags) params.push(...parseFlagsToArray(flags)); + // If everything is fine and github-report is set, generate the yaml config file. if (githubRepot) { await generateGithubReportFile(githubToken); diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..78147b2 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,4 @@ +export function parseFlagsToArray(rawFlags) { + const re = /(?:(?:^|\s)-[-a-z]+)(?:(?:\s|=)(?:[^-][0-9a-z-\S]+))?/g; + return rawFlags.match(re).map(token => token.trim()).map(token => token.replace(' ', '=')); +} \ No newline at end of file