mirror of https://github.com/MISP/MISP
new: Allow the new type "substring" to be used for warninglists
parent
0cbcffd5c9
commit
31b6ffd625
|
@ -164,6 +164,8 @@ class Warninglist extends AppModel{
|
|||
$result = $this->__evalCIDRList($listValues, $value[$component]);
|
||||
} else if ($listType === 'string') {
|
||||
$result = $this->__evalString($listValues, $value[$component]);
|
||||
} else if ($listType === 'substring') {
|
||||
$result = $this->__evalSubString($listValues, $value[$component]);
|
||||
}
|
||||
if ($result) return ($component + 1);
|
||||
}
|
||||
|
@ -242,6 +244,15 @@ class Warninglist extends AppModel{
|
|||
if (in_array($value, $listValues)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private function __evalSubString($listValues, $value) {
|
||||
foreach ($listValues as $listValue) {
|
||||
if (strpos($value, $listValue) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function fetchTLDLists() {
|
||||
$tldLists = $this->find('list', array('conditions' => array('Warninglist.name' => $this->__tlds, 'Warninglist.enabled' => 1), 'recursive' => -1, 'fields' => array('Warninglist.id', 'Warninglist.name')));
|
||||
|
|
Loading…
Reference in New Issue