It is used for searching log files.
Failed SSH connections
Accepted SSH connections
Websites accessed (successfully) though a squid proxy
Its a very basic script, and is based on the default locations of the log files.
Here it is:
#!/usr/bin/perl
#system commands
$cls = "clear";
$user = "whoami";
$cmd0 = "grep Failed /var/log/secure*";
$cmd1 = "grep Accepted /var/log/secure*";
$cmd2 = "grep 200 /var/log/squid/access.* | less";
system($cls);
print "Hello,";
system($user);
print "What would you like to do?\n";
print "1. See Failed SSH connections.\n";
print "2. See Accepted SSH connections\n";
print "3. See websites that were accessed\n";
$ans =
chomp($ans);
if ($ans eq "1")
{
system($cls);
print "Failed SSH connections\n";
system($cmd0);
}
if ($ans eq "2")
{
system($cls);
print "Accepted SSH connections\n";
system($cmd1);
}
if ($ans eq "3")
{
system($cls);
print "Web access\n";
system($cmd2);
}
What do you think?
What would you make different?
1 comment:
Hi,
I really liked your post, interesting perspective. I was looking out for the same kind of information. Thanks a lot for sharing it.
Perl Script
Post a Comment