fix: Removed debug code, added cleanup for edits/deletes

pull/2962/head
iglocska 2018-02-15 01:07:29 +01:00
parent 67fe09c67f
commit 9cacfac6d7
1 changed files with 6 additions and 6 deletions

View File

@ -1501,6 +1501,12 @@ class Attribute extends AppModel {
'Correlation.attribute_id' => $a['id']))
);
}
if ($a['type'] == 'ssdeep') {
$this->FuzzyCorrelateSsdeep = ClassRegistry::init('FuzzyCorrelateSsdeep');
$this->FuzzyCorrelateSsdeep->deleteAll(
array('FuzzyCorrelateSsdeep.attribute_id' => $a['id'])
);
}
}
// using Alnitak's solution from http://stackoverflow.com/questions/594112/matching-an-ip-to-a-cidr-mask-in-php5
@ -1641,13 +1647,7 @@ class Attribute extends AppModel {
$extraConditions = array('Attribute.id' => array());
$threshold = !empty(Configure::read('MISP.ssdeep_correlation_threshold')) ? Configure::read('MISP.ssdeep_correlation_threshold') : 40;
foreach ($ssdeepIds as $k => $v) {
try {
$ssdeep_value = ssdeep_fuzzy_compare($a['value'], $v);
} catch (Exception $e) {
debug($e->message);
}
throw new Exception();
if ($ssdeep_value >= $threshold) {
$extraConditions['Attribute.id'][] = $k;
}