new: Added warning about missing warninglists used for TLD resolution in the freetext import tool

- following the twitter feedback
pull/2586/merge
iglocska 2018-04-26 18:57:00 +02:00
parent b0e13b0faf
commit 5795b1974a
3 changed files with 24 additions and 0 deletions

View File

@ -3556,6 +3556,18 @@ class EventsController extends AppController {
$this->set('resultArray', $resultArray);
$this->set('importComment', '');
$this->set('title', 'Freetext Import Results');
$this->loadModel('Warninglist');
$tldLists = $this->Warninglist->getTldLists();
$missingTldLists = array();
foreach ($tldLists as $tldList) {
$temp = $this->Warninglist->find('first', array(
'recursive' => -1,
'conditions' => array('Warninglist.name' => $tldList),
'fields' => array('Warninglist.id')
));
if (empty($temp)) $missingTldLists[] = $tldList;
}
$this->set('missingTldLists', $missingTldLists);
$this->render('resolved_attributes');
}
}

View File

@ -40,6 +40,10 @@ class Warninglist extends AppModel{
return true;
}
public function getTldLists() {
return $this->__tlds;
}
public function update() {
$directories = glob(APP . 'files' . DS . 'warninglists' . DS . 'lists' . DS . '*', GLOB_ONLYDIR);
$updated = array();

View File

@ -2,6 +2,14 @@
<h2><?php echo h($title); ?></h2>
<?php $scope = !empty($proposals) ? 'proposals' : 'attributes'; ?>
<p><?php echo __('Below you can see the %s that are to be created. Make sure that the categories and the types are correct, often several options will be offered based on an inconclusive automatic resolution.', $scope);?></p>
<?php
if (!empty($missingTldLists)) {
$missingTldLists = implode(', ', $missingTldLists);
$missingTldLists = __('Warning: You are missing warninglist(s) that are used to recognise TLDs. Make sure your MISP has the warninglist submodule enabled and updated or else this tool might end up missing valid domains/hostnames/urls. The missing lists are: %s', $missingTldLists);
echo sprintf('<p class="bold red">%s</p>', $missingTldLists);
}
?>
<p></p>
<?php
$instanceDefault = 5;
if (!empty(Configure::read('MISP.default_attribute_distribution'))) {