Merge branch 'develop' of github.com:MISP/MISP into develop

pull/9432/head
iglocska 2023-11-15 07:38:38 +01:00
commit 103945382a
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
16 changed files with 93 additions and 50 deletions

View File

@ -203,6 +203,7 @@ class ACLComponent extends Component
'extractFromReport' => array('*'),
'replaceSuggestionInReport' => array('*'),
'importReportFromUrl' => array('*'),
'sendToLLM' => ['*'],
),
'events' => array(
'add' => array('perm_add'),
@ -617,6 +618,7 @@ class ACLComponent extends Component
'advanced' => array('perm_sighting'),
'delete' => ['AND' => ['perm_sighting', 'perm_modify_org']],
'index' => array('*'),
'view' => array('*'),
'listSightings' => array('*'),
'quickDelete' => ['AND' => ['perm_sighting', 'perm_modify_org']],
'viewSightings' => array('*'),

View File

@ -59,7 +59,8 @@ class RestSearchComponent extends Component
'event_ids',
'includeAllTags',
'includeAttributeUuid',
'includeGalaxy'
'includeGalaxy',
'order'
],
'Event' => [
'returnFormat',
@ -188,7 +189,8 @@ class RestSearchComponent extends Component
'minimal',
'list',
'first',
'count'
'count',
'order'
],
);

View File

@ -119,6 +119,23 @@ class SightingsController extends AppController
}
}
public function view($idOrUUID)
{
$sighting = $this->Sighting->find('first', array(
'conditions' => Validation::uuid($idOrUUID) ? ['Sighting.uuid' => $idOrUUID] : ['Sighting.id' => $idOrUUID],
'recursive' => -1,
'fields' => ['id', 'attribute_id'],
));
$sightings = [];
if (!empty($sighting)) {
$sightings = $this->Sighting->listSightings($this->Auth->user(), $sighting['Sighting']['attribute_id'], 'attribute');
}
if (empty($sightings)) {
throw new NotFoundException('Invalid sighting.');
}
return $this->RestResponse->viewData($sightings[0]);
}
public function advanced($id, $context = 'attribute')
{
if (empty($id)) {

View File

@ -1688,7 +1688,7 @@ class Attribute extends AppModel
}
$params['order'] = [];
if (!empty($options['order'])) {
$options['order'] = $this->findOrder(
$params['order'] = $this->findOrder(
$options['order'],
'Attribute',
['id', 'event_id', 'object_id', 'type', 'category', 'value', 'distribution', 'timestamp', 'object_relation']

View File

@ -2057,7 +2057,7 @@ class Event extends AppModel
$params['page'] = $options['page'];
}
if (!empty($options['order'])) {
$options['order'] = $this->findOrder(
$params['order'] = $this->findOrder(
$options['order'],
'Event',
['id', 'info', 'analysis', 'threat_level_id', 'distribution', 'timestamp', 'publish_timestamp']

View File

@ -1064,7 +1064,7 @@ class GalaxyCluster extends AppModel
$params['group'] = $options['group'];
}
if (!empty($options['order'])) {
$options['order'] = $this->findOrder(
$params['order'] = $this->findOrder(
$options['order'],
'GalaxyCluster',
['id', 'event_id', 'version', 'type', 'value', 'distribution', 'orgc_id', 'org_id', 'tag_name', 'galaxy_id']

View File

@ -1214,7 +1214,7 @@ class Workflow extends AppModel
$params['order'] = [];
if (!empty($options['order'])) {
$options['order'] = $this->findOrder(
$params['order'] = $this->findOrder(
$options['order'],
'Workflow',
['id', 'name', 'timestmap', 'trigger_id', 'counter']

View File

@ -181,7 +181,7 @@
},
{
"name": "BEAM SOC MISP Community",
"logo": "https://www.beamteknoloji.com/wp-content/uploads/2020/01/beamlogo.png",
"logo": "https://www.beamteknoloji.com/wp-content/uploads/beamBlueLogo.png",
"uuid": "45819403-49b9-438f-95bc-e0abb50ba03b",
"org_uuid": "",
"org_name": "",
@ -192,7 +192,7 @@
"type": "Vetted Information Sharing Community",
"email": "contact@beamteknoloji.com",
"pgp_key": null,
"misp_project_vetted": true,
"misp_project_vetted": false,
"scope_of_data_to_be_shared": "",
"self_registration": false
}

@ -1 +1 @@
Subproject commit c585caa4db3ea6dfb9fd5ba2099a9b648d3ef937
Subproject commit a0c8787f1c4c8333269c96f0abb13dba587bfe8b

@ -1 +1 @@
Subproject commit 5feb0527321ecfc5a7028df5db561c95d0fb4798
Subproject commit 0e4c819354e68ffe91fd58e9b75f2c7e056379a7

View File

@ -491,7 +491,9 @@ class StixParser():
elif properties.hostname:
type1 = "hostname"
value1 = properties.hostname.hostname_value.value
return "{}|port".format(type1), "{}|{}".format(value1, properties.port.port_value.value), ""
if properties.port:
return "{}|port".format(type1), "{}|{}".format(value1, properties.port.port_value.value), ""
return type1, value1, ''
# Parse a system object to extract a mac-address attribute
@staticmethod

View File

@ -5487,13 +5487,13 @@ components:
type: integer
format: int32
nullable: true
minimum: 0
minimum: 1
LimitSearchFilter:
type: integer
format: int32
nullable: true
minimum: 1
minimum: 0
SortSearchField:
description: Field to be used to sort the result

View File

@ -2527,11 +2527,11 @@
{
"column_name": "content",
"is_nullable": "YES",
"data_type": "text",
"character_maximum_length": "65535",
"data_type": "mediumtext",
"character_maximum_length": "16777215",
"numeric_precision": null,
"collation_name": "utf8mb4_general_ci",
"column_type": "text",
"column_type": "mediumtext",
"column_default": "NULL",
"extra": ""
},
@ -9560,5 +9560,5 @@
"uuid": false
}
},
"db_version": "115"
"db_version": "116"
}

View File

@ -6,7 +6,7 @@ set -o xtrace
python ./../app/files/scripts/mispzmq/mispzmqtest.py
# Check if all attachments handlers dependencies are correctly installed
python ./../app/files/scripts/generate_file_objects.py -c | python3 -c 'import sys, json; data = json.load(sys.stdin); print(data); sys.exit(0 if len([i for i in data.values() if i == True]) == 0 else 1)'
python ./../app/files/scripts/generate_file_objects.py -c | python3 -c 'import sys, json; data = json.load(sys.stdin); print(data); sys.exit(0 if len([i for i in data.values() if i is not False]) == 0 else 1)'
# Try to extract data from file
python ./../app/files/scripts/generate_file_objects.py -p /bin/ls

View File

@ -9,7 +9,7 @@ with open(requirements_file) as f:
req_version = re.findall('pymisp==(.*)', f.read())[0]
with open(app_controller) as f:
controler_version = re.findall('pyMispVersion = \'(.*)\'', f.read())[0]
controller_version = re.findall('pyMispVersion = \'(.*)\'', f.read())[0]
if not req_version == controler_version:
raise Exception(f'PyMISP in {requirements_file} ({req_version}) differs from the one in {app_controller} ({controler_version})')
if not req_version == controller_version:
raise Exception(f'PyMISP in {requirements_file} ({req_version}) differs from the one in {app_controller} ({controller_version})')

View File

@ -6,9 +6,12 @@ Takes the MISP communities metadata [1] and generates the website page [2]
'''
import json
import requests
import hashlib
code_communities_filename = '../app/files/community-metadata/defaults.json'
website_communities_filename = '../../misp-website/content/communities.md'
website_basepath = '../../misp-website'
website_communities_filename = f'{website_basepath}/content/communities.md'
communities_header = '''
@ -59,39 +62,56 @@ MISP URL location is [https://www.botvrij.eu/data/feed-osint](https://www.botvri
vetted_image = ' <i class="far fa-check-circle" style="color:green; "></i>\n'
with open(code_communities_filename, 'r') as f_in:
entries = json.load(f_in)
def gen_entry(f_out, entry):
f_out.write(f'### {entry["name"]}')
f_out.write(vetted_image if entry.get('misp_project_vetted') else '\n')
if entry.get('logo'):
# save logo to files with a unique name, and set the url to this unique name.
# Why? to host files locally and prevent companies to profile visitors of misp-project.org
logo_fname = f"/img/communities/{hashlib.md5(entry['name'].encode()).hexdigest()}.{entry['logo'].split('.')[-1]}"
with open(f"{website_basepath}/static{logo_fname}", 'wb') as logo_f:
r = requests.get(entry['logo'], allow_redirects=True)
logo_f.write(r.content)
f_out.write(f'![Logo]({logo_fname} "{{class=\'community_logo\'}}")\n')
if entry.get('url'):
f_out.write(f'- Website: {entry["url"]}\n')
# if entry.get('type'):
# f_out.write(f'- Type: {entry["type"]}\n')
if entry.get('sector'):
f_out.write(f'- Sector: {entry["sector"]}\n')
if entry.get('scope'):
f_out.write(f'- Scope of data to be shared: {entry["scope_of_data_to_be_shared"]}\n')
if entry.get('nationality'):
f_out.write(f'- Nationality: {entry["nationality"]}\n')
if entry.get('description'):
f_out.write(f'\n\n{entry["description"]}\n')
if entry.get('email') and entry.get('email') != 'undefined':
f_out.write(f'- Contact: {entry["email"]}')
if entry.get('pgp_key') and entry.get('pgp_key') != 'undefined':
f_out.write('\n<details><summary>GPG key</summary>\n\n```')
f_out.write(entry['pgp_key'])
f_out.write('```\n</details>\n')
f_out.write('\n')
f_out.write('\n')
with open(code_communities_filename, 'r') as f_in:
entries = sorted(json.load(f_in), key=lambda kv: kv['name'])
with open(website_communities_filename, 'w') as f_out:
f_out.write(communities_header)
for entry in sorted(entries, key=lambda kv: kv['name']):
f_out.write(f'### {entry["name"]}')
f_out.write(vetted_image if entry.get('misp_project_vetted') else '\n')
if entry.get('logo'):
f_out.write(f'![Logo]({entry["logo"]} "{{class=\'community_logo\'}}")\n')
if entry.get('url'):
f_out.write(f'- Website: {entry["url"]}\n')
# if entry.get('type'):
# f_out.write(f'- Type: {entry["type"]}\n')
if entry.get('sector'):
f_out.write(f'- Sector: {entry["sector"]}\n')
if entry.get('scope'):
f_out.write(f'- Scope of data to be shared: {entry["scope_of_data_to_be_shared"]}\n')
if entry.get('nationality'):
f_out.write(f'- Nationality: {entry["nationality"]}\n')
if entry.get('description'):
f_out.write(f'\n\n{entry["description"]}\n')
if entry.get('email') and entry.get('email') != 'undefined':
f_out.write(f'- Contact: {entry["email"]}')
if entry.get('pgp_key') and entry.get('pgp_key') != 'undefined':
f_out.write('\n<details><summary>GPG key</summary>\n\n```')
f_out.write(entry['pgp_key'])
f_out.write('```\n</details>\n')
f_out.write('\n')
f_out.write('\n')
for entry in [e for e in entries if e.get('misp_project_vetted')]:
gen_entry(f_out, entry)
for entry in [e for e in entries if not e.get('misp_project_vetted')]:
gen_entry(f_out, entry)
f_out.write(communities_footer)
print(f"The communities file has been generated. ({website_communities_filename}).\nPlease commit this in the misp-website repository, and publish the generated website.")
print(f"The communities markdown file has been generated. ({website_communities_filename}).\n"
f"Please: \n"
f"1. verify the newly generated logo, if any\n"
f"2. commit this in the misp-website repository\n"
f"3. publish the generated website online.")