mirror of https://github.com/MISP/MISP
add: [stix2 import] Added organisation UUID parameter to be used when generating custom Galaxy Clusters UUID
parent
1163539038
commit
41b20f96d3
|
@ -6005,7 +6005,7 @@ class Event extends AppModel
|
|||
*/
|
||||
public function upload_stix(array $user, $file, $stixVersion, $originalFile, $publish, $distribution, $sharingGroupId, $galaxiesAsTags, $clusterDistribution, $clusterSharingGroupId, $debug = false)
|
||||
{
|
||||
$decoded = $this->convertStixToMisp($stixVersion, $file, $distribution, $sharingGroupId, $galaxiesAsTags, $clusterDistribution, $clusterSharingGroupId, $debug);
|
||||
$decoded = $this->convertStixToMisp($stixVersion, $file, $distribution, $sharingGroupId, $galaxiesAsTags, $clusterDistribution, $clusterSharingGroupId, $user['Organisation']['uuid'], $debug);
|
||||
|
||||
if (!empty($decoded['success'])) {
|
||||
$data = JsonTool::decodeArray($decoded['converted']);
|
||||
|
@ -6071,11 +6071,12 @@ class Event extends AppModel
|
|||
* @param bool $galaxiesAsTags
|
||||
* @param int $clusterDistribution
|
||||
* @param int|null $clusterSharingGroupId
|
||||
* @param string $orgUuid
|
||||
* @param bool $debug
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
private function convertStixToMisp($stixVersion, $file, $distribution, $sharingGroupId, $galaxiesAsTags, $clusterDistribution, $clusterSharingGroupId, $debug)
|
||||
private function convertStixToMisp($stixVersion, $file, $distribution, $sharingGroupId, $galaxiesAsTags, $clusterDistribution, $clusterSharingGroupId, $orgUuid, $debug)
|
||||
{
|
||||
$scriptDir = APP . 'files' . DS . 'scripts';
|
||||
if ($stixVersion === '2' || $stixVersion === '2.0' || $stixVersion === '2.1') {
|
||||
|
@ -6086,6 +6087,7 @@ class Event extends AppModel
|
|||
$scriptFile,
|
||||
'-i', $file,
|
||||
'--distribution', $distribution,
|
||||
'--org_uuid', $orgUuid
|
||||
];
|
||||
if ($distribution == 4) {
|
||||
array_push($shellCommand, '--sharing_group_id', $sharingGroupId);
|
||||
|
|
|
@ -29,7 +29,8 @@ sys.path.insert(2, str(_scripts_path / 'python-cybox'))
|
|||
sys.path.insert(3, str(_scripts_path / 'mixbox'))
|
||||
sys.path.insert(4, str(_scripts_path / 'misp-stix'))
|
||||
from misp_stix_converter import (
|
||||
ExternalSTIX2toMISPParser, InternalSTIX2toMISPParser, _from_misp)
|
||||
ExternalSTIX2toMISPParser, InternalSTIX2toMISPParser,
|
||||
MISP_org_uuid, _from_misp)
|
||||
from stix2.parsing import parse as stix2_parser
|
||||
|
||||
|
||||
|
@ -103,6 +104,10 @@ if __name__ == '__main__':
|
|||
'-i', '--input', required=True, type=Path,
|
||||
help='Input file containing STIX 2 content.'
|
||||
)
|
||||
argparser.add_argument(
|
||||
'--org_uuid', default=MISP_org_uuid,
|
||||
help='Organisation UUID to use when creating custom Galaxy clusters.'
|
||||
)
|
||||
argparser.add_argument(
|
||||
'--distribution', type=int, default=0,
|
||||
help='Distribution level for the resulting MISP Event.'
|
||||
|
|
Loading…
Reference in New Issue