mirror of https://github.com/MISP/MISP
chg: [internal] Use ProcessTool in Sighting
parent
acd88ade13
commit
bd9cecbc2c
|
@ -1948,11 +1948,6 @@ class AppModel extends Model
|
|||
return true;
|
||||
}
|
||||
|
||||
public function getPythonVersion()
|
||||
{
|
||||
return Configure::read('MISP.python_bin') ?: 'python3';
|
||||
}
|
||||
|
||||
public function validateAuthkey($value)
|
||||
{
|
||||
if (empty($value['authkey'])) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
App::uses('AppModel', 'Model');
|
||||
App::uses('TmpFileTool', 'Tools');
|
||||
App::uses('ServerSyncTool', 'Tools');
|
||||
App::uses('ProcessTool', 'Tools');
|
||||
|
||||
/**
|
||||
* @property Attribute $Attribute
|
||||
|
@ -744,7 +745,7 @@ class Sighting extends AppModel
|
|||
$tempFile->close();
|
||||
$scriptFile = APP . "files" . DS . "scripts" . DS . "stixsighting2misp.py";
|
||||
// Execute the python script and point it to the temporary filename
|
||||
$result = shell_exec($this->getPythonVersion() . ' ' . $scriptFile . ' ' . $randomFileName);
|
||||
$result = ProcessTool::execute([ProcessTool::pythonBin(), $scriptFile, $randomFileName]);
|
||||
// The result of the script will be a returned JSON object with 2 variables: success (boolean) and message
|
||||
// If success = 1 then the temporary output file was successfully written, otherwise an error message is passed along
|
||||
$result = json_decode($result, true);
|
||||
|
|
Loading…
Reference in New Issue