mirror of https://github.com/MISP/MISP
new: Added a small diagnostic tool to debug the impact of a bug fixed in 2.4.89
parent
bdd5473c56
commit
ee018011a8
|
@ -346,4 +346,31 @@ class LogsController extends AppController {
|
|||
}
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
|
||||
public function testForStolenAttributes() {
|
||||
$logs = $this->Log->find('list', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => array(
|
||||
'Log.model' => 'Attribute',
|
||||
'Log.action' => 'edit'
|
||||
),
|
||||
'fields' => array('Log.title')
|
||||
));
|
||||
$ids = array();
|
||||
foreach ($logs as $log) {
|
||||
preg_match('/Attribute \(([0-9]+?)\)/', $log, $attribute_id);
|
||||
preg_match('/Event \(([0-9]+?)\)/', $log, $event_id);
|
||||
if (!isset($attribute_id[1])) continue;
|
||||
if (empty($ids[$attribute_id[1]]) || !in_array($event_id[1], $ids[$attribute_id[1]])) {
|
||||
$ids[$attribute_id[1]][] = $event_id[1];
|
||||
}
|
||||
}
|
||||
$issues = array();
|
||||
foreach ($ids as $aid => $eids) {
|
||||
if (count($eids) > 1) {
|
||||
$issues[$aid] = $eids;
|
||||
}
|
||||
}
|
||||
$this->set('issues', $issues);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<div class="index">
|
||||
<h3><?php echo __('Stolen attribute validation');?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
if (empty($issues)) {
|
||||
echo '<span class="blue bold">' . __('Nothing to see here, move along.') . '</span>';
|
||||
} else {
|
||||
foreach ($issues as $aid => $eids) {
|
||||
echo '<div>' . __('Attribute (%s) associated to events: %s', $aid, implode(', ', $eids)) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->element('side_menu', array('menuList' => 'admin', 'menuItem' => 'adminTools'));
|
||||
?>
|
Loading…
Reference in New Issue