fix: [stix2 export] Stopped passing ORGs already parsed as argument of the python script

pull/3766/head
chrisr3d 2018-10-04 17:50:03 +02:00
parent 54b90cf8f5
commit d492c96efa
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 2 additions and 6 deletions

View File

@ -3792,7 +3792,6 @@ class Event extends AppModel
}
$i = 0;
$eventCount = count($event_ids);
$ORGs = ' ';
if ($event_ids) {
foreach ($event_ids as $event_id) {
$tempFile = new File($tmpDir . $randomFileName, true, 0644);
@ -3809,13 +3808,10 @@ class Event extends AppModel
$event = $converter->convert($event[0]);
$tempFile->write($event);
unset($event);
$scriptFile = APP . $scriptDir . "stix2/misp2stix2.py";
$result = shell_exec('python3 ' . $scriptFile . ' ' . $tempFile->path . $ORGs . '2>' . APP . 'tmp/logs/exec-errors.log');
$scriptFile = APP . $scriptDir . "stix2/misp2stix2.py ";
$result = shell_exec('python3 ' . $scriptFile . $tempFile->path . ' 2>' . APP . 'tmp/logs/exec-errors.log');
$decoded = json_decode($result, true);
if (isset($decoded['success']) && $decoded['success'] == 1) {
if (isset($decoded['org'])) {
$ORGs = $ORGs . $decoded['org'] . ' ';
}
$file = new File($tmpDir . $randomFileName . '.out', true, 0644);
$result = substr($file->read(), 1, -1);
$file->delete();