mirror of https://github.com/MISP/MISP
fix: Trim strings of brackets before running the freetext detection on them
parent
053b0453cb
commit
576d58462d
|
@ -123,6 +123,7 @@ class ComplexTypeTool {
|
|||
}
|
||||
|
||||
public function checkFreeText($input, $settings = array()) {
|
||||
$charactersToTrim = array('\'', '"', ',', '(', ')');
|
||||
$iocArray = preg_split("/\r\n|\n|\r|\s|\s+|,|;/", $input);
|
||||
$quotedText = explode('"', $input);
|
||||
foreach ($quotedText as $k => $temp) {
|
||||
|
@ -138,8 +139,9 @@ class ComplexTypeTool {
|
|||
if (!empty($iocArray)) {
|
||||
foreach ($iocArray as $ioc) {
|
||||
$ioc = trim($ioc);
|
||||
$ioc = trim($ioc, '"');
|
||||
$ioc = trim($ioc, ',');
|
||||
foreach ($charactersToTrim as $c) {
|
||||
$ioc = trim($ioc, $c);
|
||||
}
|
||||
$ioc = preg_replace('/\p{C}+/u', '', $ioc);
|
||||
if (empty($ioc)) continue;
|
||||
$typeArray = $this->__resolveType($ioc);
|
||||
|
|
Loading…
Reference in New Issue