Mini Shell
#!/usr/local/bin/perl
($filename) = @ARGV;
@patterns = `cat /opt/sharedrads/extras/ftp_clamscan_patterns`;
$found = "";
chomp ($filename);
foreach $pattern (@patterns) {
chomp ($pattern);
if ($pattern =~ /'/) {
$status = `grep "$pattern" $filename`;
} else {
$status = `grep '$pattern' $filename`;
}
if ($status) {
$found .= "$filename -- $pattern";
$notfound = "";
last;
} else {
$notfound = '$filename';
}
}
if ($notfound) {
`mail -v brandonf\@inmotionhosting.com -s 'New pattern to check' < $filename`;
} else {
print "Found:\n $found\n";
}
exit;
Zerion Mini Shell 1.0