Fix STIX XML and JSON exports

pull/1595/head
Richard van den Berg 2016-10-03 16:02:16 +02:00
parent fd959da341
commit c44cb036ae
2 changed files with 6 additions and 3 deletions

View File

@ -2498,7 +2498,9 @@ class Event extends AppModel {
return array('success' => 0, 'message' => 'There was an issue generating the STIX export.');
}
$stixFile->write(substr($stix_framing, 0, -1));
$stixFile->append(" <stix:Related_Packages>\n");
if ($returnType === 'xml') {
$stixFile->append(" <stix:Related_Packages>\n");
}
$result = array();
if ($jobId) {
$this->Job = ClassRegistry::init('Job');

View File

@ -87,12 +87,13 @@ SCHEMALOC_DICT = {
def main(args):
if len(sys.argv) < 4:
sys.exit("Invalid parameters")
namespace = [sys.argv[1], sys.argv[2]]
namespace = [sys.argv[1], sys.argv[2].replace(" ", "_")]
namespace[1] = re.sub('[\W]+', '', namespace[1])
NS_DICT[namespace[0]]=namespace[1]
stix.utils.idgen.set_id_namespace({namespace[0]: namespace[1]})
stix_package = STIXPackage()
stix_header = STIXHeader()
stix_header.title="Export from " + namespace[1] + " MISP"
stix_header.title="Export from " + sys.argv[2] + " MISP"
stix_header.package_intents="Threat Report"
stix_package.stix_header = stix_header
if sys.argv[3] == 'json':