Skip to content

Commit

Permalink
Scan use filePath
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Aug 7, 2020
1 parent 278f046 commit f778b07
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions root/sbin/e-smith/nethserver-clamscan
Expand Up @@ -198,32 +198,38 @@ foreach my $test (@report)
my $t1 = $1;
my $t2 = $2;
$t1 =~ s/:$//g;
my $ID = $t1;
$ID =~ s/=//g;

#we don't want injection
my $protect = "[\'\(\)\<\>\"\|]";
next if ($t1 =~ /$protect/);
next if ($t2 =~ /$protect/);
$q->set_prop($t1,'ruleMatch',$t2,type => 'found');
$q->set_prop($ID,'ruleMatch',$t2,type => 'found');
$q->set_prop($ID,'filePath',$t1);
}
if ( $test =~ /(.*)(: moved to )(.*)/)
{
my $t3 = $3;
my $t1 = $1;
$t3 =~ s/^'//;
$t3 =~ s/'$//;
my $ID = $t1;
$ID =~ s/=//g;

#we don't want injection
my $protect = "[\'\(\)\<\>\"\|]";
next if ($t1 =~ /$protect/);
next if ($t3 =~ /$protect/);
# if we find it inside the db (most probable), we retrieve the matched rule
# and we store it again with quarantined type
if ($q->get($t1)) {
my $rule = $q->get_prop_and_delete ($t1, 'ruleMatch');
my $key = $q->get($t1);
if ($q->get_prop($ID,'filePath')) {
my $rule = $q->get_prop_and_delete ($ID, 'ruleMatch');
my $key = $q->get($ID);
$key->delete;
$q->set_prop($t1,'quarantine',$t3,type => 'quarantined');
$q->set_prop($t1,'ruleMatch',$rule);
$q->set_prop($ID,'quarantine',$t3,type => 'quarantined');
$q->set_prop($ID,'ruleMatch',$rule);
$q->set_prop($ID,'filePath',$t1);
}
}
}

0 comments on commit f778b07

Please sign in to comment.