Ensure we only have the last line from the shell command when exporting STIX2

Same as  e3b1e8c74a but for exporting STIX2
pull/5672/head
Patrizio Tufarolo 2020-02-27 12:59:12 +01:00 committed by GitHub
parent 57077f62ff
commit 44fef2903c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,8 @@ class Stix2Export extends StixExport
$scriptFile = $this->__scripts_dir . $this->__script_name;
$filename = $this->__scripts_dir . 'tmp/' . $filename;
$my_server = ClassRegistry::init('Server');
return shell_exec($my_server->getPythonVersion() . ' ' . $scriptFile . ' ' . $filename . $this->__end_of_cmd);
$result = shell_exec($my_server->getPythonVersion() . ' ' . $scriptFile . ' ' . $filename . $this->__end_of_cmd);
$result = end(preg_split("/\r\n|\n|\r/", trim($result)));
return $result;
}
}