Merge pull request #7018 from JakubOnderka/yara-export-fix

fix: [export] YARA export
pull/7390/head
Jakub Onderka 2021-05-05 17:32:44 +02:00 committed by GitHub
commit 0b54c7955e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -1,9 +1,7 @@
<?php
App::uses('JsonExport', 'Export');
App::uses('AppModel', 'Model');
class YaraExport
{
private $__script_path = APP . 'files/scripts/yara/yaraexport.py';
@ -13,6 +11,7 @@ class YaraExport
private $__MAX_n_attributes = 15000;
private $__yara_file_gen = null;
private $__yara_file_asis = null;
/** @var null|File */
private $__curr_input_file = null;
private $__scope = false;
private $__curr_input_is_empty = true;
@ -73,7 +72,13 @@ class YaraExport
$this->separator(); // calling separator since returning '' will prevent it
}
$jsonData = $this->__JsonExporter->handler($data, $options);
$this->__curr_input_file->append($jsonData);
if ($jsonData instanceof Generator) {
foreach ($jsonData as $part) {
$this->__curr_input_file->append($part);
}
} else {
$this->__curr_input_file->append($jsonData);
}
$this->__curr_input_is_empty = false;
}
$this->__n_attributes += $attr_count;