mirror of https://github.com/MISP/MISP
chg: [complextype] Support for uppercase hashes
parent
fd822ef0c5
commit
7f7b89edaf
|
@ -507,7 +507,7 @@ class ComplexTypeTool
|
|||
private function __resolveHash($value)
|
||||
{
|
||||
$strlen = strlen($value);
|
||||
if (isset($this->__hexHashTypes[$strlen]) && preg_match("#[0-9a-f]{" . $strlen . "}$#i", $value)) {
|
||||
if (isset($this->__hexHashTypes[$strlen]) && ctype_xdigit($value)) {
|
||||
return $this->__hexHashTypes[$strlen];
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -438,6 +438,15 @@ EOT;
|
|||
$this->assertEquals('md5', $results[0]['default_type']);
|
||||
}
|
||||
|
||||
public function testCheckFreeTextMd5Uppercase(): void
|
||||
{
|
||||
$complexTypeTool = new ComplexTypeTool();
|
||||
$results = $complexTypeTool->checkFreeText('9E107D9D372BB6826BD81D3542A419D6');
|
||||
$this->assertCount(1, $results);
|
||||
$this->assertEquals('9E107D9D372BB6826BD81D3542A419D6', $results[0]['value']);
|
||||
$this->assertEquals('md5', $results[0]['default_type']);
|
||||
}
|
||||
|
||||
public function testCheckFreeTextSha1(): void
|
||||
{
|
||||
$complexTypeTool = new ComplexTypeTool();
|
||||
|
|
Loading…
Reference in New Issue