Compare commits

...

9 Commits

Author SHA1 Message Date
JustKiddingCode 8005eedbfc
Merge 159512a174 into 14106b811a 2024-04-26 13:55:28 +00:00
iglocska 14106b811a
fix: [freetext] ip-src/ip-dst meta-type didn't have a valid category list 2024-04-26 08:43:00 +02:00
iglocska ee196c1349
fix: [user registration] pgp key not saved from the registration 2024-04-26 08:32:39 +02:00
Konstantin Zangerle 159512a174 Fix missing ; in AppModel.php 2023-06-02 13:15:39 +02:00
Konstantin Zangerle 952b667db1 Postgres Database Changes 109 2023-05-25 15:13:10 +02:00
Konstantin Zangerle 2cd4e0b40b Postgresql dump; changes for postgres 2023-05-25 11:38:18 +02:00
Konstantin Zangerle 42b8d35ee4 More changes required for postgres 2023-05-25 11:38:18 +02:00
Konstantin Zangerle 882d57ff67 model changes for database 2023-05-25 11:38:18 +02:00
Konstantin Zangerle 7cb3ee6e3b Changes required to run misp with postgresql 2023-05-25 11:38:18 +02:00
11 changed files with 7154 additions and 5208 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

6273
INSTALL/POSTGRESQL.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3763,7 +3763,7 @@ class EventsController extends AppController
$result = $this->ShadowAttribute->find('column', [
'fields' => ['event_id'],
'conditions' => $conditions,
'unique' => true,
// 'unique' => true,
]);
$this->Event->recursive = -1;
@ -4160,7 +4160,13 @@ class EventsController extends AppController
}
}
$this->Event->Attribute->fetchRelated($this->Auth->user(), $resultArray);
$typeCategoryMapping = array();
$typeCategoryMapping = [
'ip-src/ip-dst' => [
'Network activity' => 'Network activity',
'Payload delivery' => 'Payload delivery',
'External analysis' => 'External analysis'
],
];
foreach ($this->Event->Attribute->categoryDefinitions as $k => $cat) {
foreach ($cat['types'] as $type) {
$typeCategoryMapping[$type][$k] = $k;

View File

@ -1987,8 +1987,12 @@ class ServersController extends AppController
$updateProgress['update_fail_number_reached'] = $this->Server->UpdateFailNumberReached();
$currentIndex = $updateProgress['current'];
$currentCommand = !isset($updateProgress['commands'][$currentIndex]) ? '' : $updateProgress['commands'][$currentIndex];
$lookupString = preg_replace('/\s{2,}/', '', substr($currentCommand, 0, -1));
$sqlInfo = $this->Server->query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;");
$lookupString = preg_replace('/\s{2,}/', '', substr($currentCommand, 0, -1));
if (empty($this->Server->query("SELECT * FROM version() WHERE version LIKE 'PostgreS%';"))) {
$sqlInfo = $this->Server->query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;");
} else {
$this->Server->query("SELECT * FROM pg_stat_activity WHERE datname = 'misp';");
}
if (empty($sqlInfo)) {
$updateProgress['process_list'] = array();
} else {

View File

@ -2603,6 +2603,7 @@ class UsersController extends AppController
'org_name',
'org_uuid',
'message',
'pgp',
'custom_perms',
'perm_sync',
'perm_publish',

File diff suppressed because it is too large Load Diff

View File

@ -1082,9 +1082,16 @@ class Correlation extends AppModel
$this->CorrelationExclusion = ClassRegistry::init('CorrelationExclusion');
$results['excluded_correlations'] = $this->CorrelationExclusion->find('count');
foreach ($results['db'] as &$result) {
foreach ($result['tables'] as $table_name => &$table_data) {
$size_metrics = $this->query(sprintf('show table status like \'%s\';', $table_name));
if (!empty($size_metrics)) {
foreach ($result['tables'] as $table_name => &$table_data) {
$row_count = 0;
if ($this->isMysql()){
$size_metrics = $this->query(sprintf('show table status like \'%s\';', $table_name));
$row_count = (empty($size_metrics)) ? 0 : $size_metrics[0]['TABLES']['Rows'];
} else {
$size_metrics = $this->query(sprintf("select reltuples as estimate from pg_class where relname='%s';", $table_name));
$row_count = (empty($size_metrics)) ? 0 : $size_metrics[0]['estimate'];
}
if ($row_count > 0) {
$table_data['size_on_disk'] = $this->query(
//'select FILE_SIZE from information_schema.innodb_sys_tablespaces where FILENAME like \'%/' . $table_name . '.ibd\';'
sprintf(
@ -1094,7 +1101,7 @@ class Correlation extends AppModel
)
)[0][0]['size'];
$last_id = $this->query(sprintf('select max(id) as max_id from %s;', $table_name));
$table_data['row_count'] = $size_metrics[0]['TABLES']['Rows'];
$table_data['row_count'] = $row_count;
$table_data['last_id'] = $last_id[0][0]['max_id'];
$table_data['id_saturation'] = round(100 * $table_data['last_id'] / $table_data['id_limit'], 2);
}

View File

@ -206,19 +206,19 @@ class EventTag extends AppModel
}
public function getSortedTagList($context = false)
{
{
$tag_counts = $this->find('all', array(
'recursive' => -1,
'fields' => array('tag_id', 'count(*)'),
'group' => array('tag_id'),
'fields' => array('tag_id', 'count(*) AS count'),
'group' => array('Tag.id', 'Tag.name', 'EventTag.tag_id'),
'contain' => array('Tag.name')
));
$temp = array();
$tags = array();
foreach ($tag_counts as $tag_count) {
foreach ($tag_counts as $tag_count) {
$temp[$tag_count['Tag']['name']] = array(
'tag_id' => $tag_count['Tag']['id'],
'eventCount' => $tag_count[0]['count(*)'],
'eventCount' => $tag_count[0]['count'],
'name' => $tag_count['Tag']['name'],
);
$tags[$tag_count['Tag']['name']] = $tag_count[0]['count(*)'];

View File

@ -26,7 +26,7 @@ class News extends AppModel
public function latestNewsTimestamp()
{
$data = $this->find('first', [
'order' => 'date_created DESC',
'order' => 'News.date_created DESC',
'fields' => ['date_created'],
]);
if (!$data) {

View File

@ -1714,7 +1714,7 @@ class User extends AppModel
'ShadowAttribute.event_org_id' => $user['org_id'],
'ShadowAttribute.deleted' => 0,
),
'fields' => 'distinct event_id'
'fields' => 'DISTINCT event_id'
]);
return $results;
}