Mini Shell
#!/usr/local/bin/perl
($user) = @ARGV;
if ($user !~ /./) { print "no user\n"; exit; }
@files = `find /home/$user/public_html \\\( -iname "*.htm" -o -iname "*.html" -o -iname "*.php" -o -iname "*.js" \\\) -print`;
@patterns = `cat /opt/sharedrads/extras/ftp_clamscan_patterns`;
$found = "";
foreach (@files) {
chomp ($_);
print "file = $_\n";
foreach $pattern (@patterns) {
chomp ($pattern);
if ($pattern =~ /'/) {
$status = `grep "$pattern" $_`;
} else {
$stats = `grep '$pattern' $_`;
}
if ($status) {
$found .= "$_ -- $pattern\n";
last;
}
}
}
if ($found !~ /./) {
print "Nothing found\n";
} else {
print "\nFound:\n $found\n";
}
exit;
Zerion Mini Shell 1.0