mirror of https://github.com/MISP/MISP
chg: [attribute] Better ssdeep validation
parent
5d70cc1588
commit
1c8056a66a
|
@ -639,14 +639,7 @@ class AttributeValidationTool
|
||||||
*/
|
*/
|
||||||
private static function isSsdeep($value)
|
private static function isSsdeep($value)
|
||||||
{
|
{
|
||||||
if (strpos($value, "\n") !== false) {
|
return preg_match('#^([0-9]+):([0-9a-zA-Z/+]*):([0-9a-zA-Z/+]*)$#', $value);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$parts = explode(':', $value);
|
|
||||||
if (count($parts) !== 3) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return self::isPositiveInteger($parts[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -598,7 +598,7 @@ class ComplexTypeTool
|
||||||
*/
|
*/
|
||||||
private function __resolveSsdeep($value)
|
private function __resolveSsdeep($value)
|
||||||
{
|
{
|
||||||
return preg_match('#^[0-9]+:[0-9a-zA-Z\/\+]+:[0-9a-zA-Z\/\+]+$#', $value) && !preg_match('#^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$#', $value);
|
return preg_match('#^[0-9]+:[0-9a-zA-Z/+]+:[0-9a-zA-Z/+]+$#', $value) && !preg_match('#^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$#', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue