mirror of https://github.com/MISP/MISP
fix: Added domain|ip to nids exports
parent
ccc1038e08
commit
7e75aafc22
|
@ -68,6 +68,9 @@ class NidsExport {
|
|||
case 'domain':
|
||||
$this->domainRule($ruleFormat, $item['Attribute'], $sid);
|
||||
break;
|
||||
case 'domain|ip':
|
||||
$this->domainIpRule($ruleFormat, $item['Attribute'], $sid);
|
||||
break;
|
||||
case 'hostname':
|
||||
$this->hostnameRule($ruleFormat, $item['Attribute'], $sid);
|
||||
break;
|
||||
|
@ -86,6 +89,18 @@ class NidsExport {
|
|||
}
|
||||
return $this->rules;
|
||||
}
|
||||
|
||||
public function domainIpRule($ruleFormat, $attribute, &$sid) {
|
||||
$values = explode('|', $attribute['value']);
|
||||
$attributeCopy = $attribute;
|
||||
$attributeCopy['value'] = $values[0];
|
||||
$this->domainRule($ruleFormat, $attributeCopy, $sid);
|
||||
$sid++;
|
||||
$attributeCopy['value'] = $values[1];
|
||||
$this->ipDstRule($ruleFormat, $attributeCopy, $sid);
|
||||
$sid++;
|
||||
$this->ipSrcRule($ruleFormat, $attributeCopy, $sid);
|
||||
}
|
||||
|
||||
public function ipDstRule($ruleFormat, $attribute, &$sid) {
|
||||
$overruled = $this->checkWhitelist($attribute['value']);
|
||||
|
@ -397,10 +412,8 @@ class NidsExport {
|
|||
$extraForRule .= $ruleFormatReference . ';';
|
||||
}
|
||||
$tmpRule = preg_replace('/;\s*\)/', '; ' . $extraForRule . ')', $tmpRule);
|
||||
|
||||
// finally the rule is cleaned up and can be outputed
|
||||
$this->rules[] = $tmpRule;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue