chg: [feed] Check if value is clean IP without doing expensive operations

pull/7181/head
Jakub Onderka 2021-03-15 10:51:48 +01:00
parent fc3924c8e8
commit b17ddeaf70
1 changed files with 10 additions and 0 deletions

View File

@ -246,6 +246,16 @@ class ComplexTypeTool
*/
private function __resolveType($raw_input)
{
// Check if value is clean IP without doing expensive operations.
if (filter_var($raw_input, FILTER_VALIDATE_IP)) {
return [
'types' => ['ip-dst', 'ip-src', 'ip-src/ip-dst'],
'to_ids' => true,
'default_type' => 'ip-dst',
'value' => $raw_input,
];
}
$input = array('raw' => $raw_input);
// Check hashes before refang and port extracting, it is not necessary for hashes. This speedups parsing