fix: [stix 1&2 import] Fixed version attribute of the original filename

pull/3956/head
chrisr3d 2018-12-12 10:19:40 +01:00
parent 9d0c6fa8fe
commit dee614b4b8
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 4 additions and 2 deletions

View File

@ -5071,11 +5071,13 @@ class Event extends AppModel
$tempFilePath = APP . 'files/scripts/tmp/' . $filename;
$shell_command = $this->getPythonVersion() . ' ' . $scriptFile . ' ' . $tempFilePath;
$output_path = $tempFilePath . '.stix2';
$stix_version = "STIX 2.0";
} elseif ($stix_version == '1' || $stix_version == '1.1' || $stix_version == '1.2') {
$scriptFile = APP . 'files/scripts/stix2misp.py';
$tempFilePath = APP . 'files/scripts/tmp/' . $filename;
$shell_command = $this->getPythonVersion() . ' ' . $scriptFile . ' ' . $filename;
$output_path = $tempFilePath . '.json';
$stix_version = "STIX 1.1";
} else {
throw new MethodNotAllowedException('Invalid STIX version');
}
@ -5091,7 +5093,7 @@ class Event extends AppModel
$validationIssues = false;
$result = $this->_add($data, true, $user, '', null, false, null, $created_id, $validationIssues);
if ($result) {
$this->add_original_file($tempFile, $original_file, $created_id, 'STIX 1.1');
$this->add_original_file($tempFile, $original_file, $created_id, $stix_version);
return $created_id;
}
return $validationIssues;
@ -5685,7 +5687,7 @@ class Event extends AppModel
'distribution' => $distribution,
'object_id' => $object_id,
'object_relation' => 'format',
'value' => 'STIX 1.1'
'value' => $format
)
);
foreach ($attributes as $attribute) {