add: [stix2 import] Added parameters used by `misp-stix` to handle the distribution value

pull/9044/head
Christian Studer 2023-04-21 10:15:02 +02:00
parent 9a50d3324f
commit efeafeae5b
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 5 additions and 4 deletions

View File

@ -5837,7 +5837,7 @@ class Event extends AppModel
* @throws InvalidArgumentException
* @throws Exception
*/
public function upload_stix(array $user, $file, $stix_version, $original_file, $publish, $galaxiesAsTags, $debug = false)
public function upload_stix(array $user, $file, $stix_version, $original_file, $publish, $distribution, $galaxiesAsTags, $debug = false)
{
$scriptDir = APP . 'files' . DS . 'scripts';
if ($stix_version == '2' || $stix_version == '2.0' || $stix_version == '2.1') {
@ -5846,15 +5846,16 @@ class Event extends AppModel
$shell_command = [
ProcessTool::pythonBin(),
$scriptFile,
'-i', $file
'-i', $file,
'--distribution', $distribution
];
if ($galaxiesAsTags) {
$shell_command[] = '--galaxies_as_tags';
}
if ($debug) {
$shell_command[] = '-d';
$shell_command[] = '--debug';
}
$stix_version = "STIX 2.0";
$stix_version = "STIX 2.1";
} elseif ($stix_version == '1' || $stix_version == '1.1' || $stix_version == '1.2') {
$scriptFile = $scriptDir . DS . 'stix2misp.py';
$output_path = $file . '.json';