mirror of https://github.com/MISP/MISP
Merge branch 'badattch' into 2.4
commit
a724b69a12
|
@ -46,7 +46,7 @@ class AppController extends Controller {
|
|||
|
||||
public $helpers = array('Utility');
|
||||
|
||||
private $__queryVersion = '12';
|
||||
private $__queryVersion = '13';
|
||||
public $pyMispVersion = '2.4.71';
|
||||
public $phpmin = '5.6.5';
|
||||
public $phprec = '7.0.16';
|
||||
|
|
|
@ -2787,4 +2787,20 @@ class AttributesController extends AppController {
|
|||
$this->render('ajax/toggle_correlation');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkAttachments() {
|
||||
$attributes = $this->Attribute->find('all', array(
|
||||
'conditions' => array('Attribute.type' => array('attachment', 'malware-sample')),
|
||||
'recursive' => -1)
|
||||
);
|
||||
$counter = 0;
|
||||
foreach ($attributes as $attribute) {
|
||||
$path = APP . "files" . DS . $attribute['Attribute']['event_id'] . DS;
|
||||
$file = $attribute['Attribute']['id'];
|
||||
if (!file_exists($path . $file)) {
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
return new CakeResponse(array('body'=>$counter, 'status'=>200));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class ACLComponent extends Component {
|
|||
'attributeReplace' => array('perm_add'),
|
||||
'attributeStatistics' => array('*'),
|
||||
'bro' => array('*'),
|
||||
'checkAttachments' => array(),
|
||||
'checkComposites' => array('perm_admin'),
|
||||
'checkOrphanedAttributes' => array(),
|
||||
'delete' => array('perm_add'),
|
||||
|
|
|
@ -333,4 +333,13 @@
|
|||
</h3>
|
||||
<p>Click the following button to go to the legacy administrative tools page. There should in general be no need to do this unless you are upgrading a very old MISP instance (<2.4), all updates are done automatically with more current versions.</p>
|
||||
<span class="btn btn-inverse" style="padding-top:1px;padding-bottom:1px;" onClick="location.href = '<?php echo $baseurl; ?>/pages/display/administration';">Legacy Administrative Tools</span>
|
||||
<h3>
|
||||
Verify bad link on attachments
|
||||
</h3>
|
||||
<p>Verify each attachment referenced in database is accessible on filesystem.</p>
|
||||
<div style="background-color:#f7f7f9;width:400px;">
|
||||
Non existing attachments referenced in Database....<span id="orphanedFileCount"><span style="color:orange;">Run the test below</span></span>
|
||||
</div><br>
|
||||
<span class="btn btn-inverse" role="button" tabindex="0" aria-label="Check bad link on attachments" title="Check bad link on attachments" style="padding-top:1px;padding-bottom:1px;" onClick="checkAttachments();">Check bad link on attachments</span>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -2825,6 +2825,29 @@ function checkOrphanedAttributes() {
|
|||
});
|
||||
}
|
||||
|
||||
function checkAttachments() {
|
||||
$.ajax({
|
||||
beforeSend: function (XMLHttpRequest) {
|
||||
$(".loading").show();
|
||||
},
|
||||
success:function (data, textStatus) {
|
||||
var color = 'red';
|
||||
var text = ' (Bad links detected)';
|
||||
if (data !== undefined && data.trim() == '0') {
|
||||
color = 'green';
|
||||
text = ' (OK)';
|
||||
}
|
||||
$("#orphanedFileCount").html('<span class="' + color + '">' + data + text + '</span>');
|
||||
},
|
||||
complete:function() {
|
||||
$(".loading").hide();
|
||||
},
|
||||
type:"get",
|
||||
cache: false,
|
||||
url: "/attributes/checkAttachments/",
|
||||
});
|
||||
}
|
||||
|
||||
function loadTagTreemap() {
|
||||
$.ajax({
|
||||
async:true,
|
||||
|
|
Loading…
Reference in New Issue