Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: SSH bruteforce on its way... |
|---|---|
| Date: | 19 Oct 2005 20:47:39 -0000 |
Heres a perl script I made to help solve my problem. I have been seeing these
the past 2 years at least. This works on debian sarge (ssh 3.8). Can easily be
changed for other ssh versions. Run like this...
tail -n0 -F /var/log/auth.log |logflow.pl |awk -W interactive '{ print "sshd:
"$1 }' >> /etc/hosts.deny 2>&1 &
and here is the logflow.pl...
#!/usr/bin/perl
use Regexp::Common qw /net/;
# ips that shouldn't be banned
@safe = ('192.168.51.1','1.2.3.4');
# number of illegal users received in 1 minute that will trigger a ban
$thresh = 4;
while (<STDIN>) {
if ($_ !~ /Illegal user/) { next; }
@line = split(' ', $_);
@hourmin = split(':', @line[2]);
if ("@line[0] @line[1] @hourmin[0] @hourmin[1] @line[9]" eq $remember &&
grep(/^@line[9]$/, @bans) eq 0 && @line[9] =~ /^$RE{net}{IPv4}$/) {
$found++;
if ($found eq ($thresh - 1)) {
print "@line[9]\n";
$| = 1;
push(@bans, @line[9]);
}
} else {
$found=0;
}
$remember = "@line[0] @line[1] @hourmin[0] @hourmin[1] @line[9]";
}
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Memorias Conferencia Internacional sobre Seguridad Informática, Oscar Eduardo Ruiz Bermúdez |
|---|---|
| Next by Date: | Re: Strange attack question - seems udp, Christoph Gruber |
| Previous by Thread: | Re: [incidents] Re: SSH bruteforce on its way..., Tim Kennedy |
| Next by Thread: | Re: SSH bruteforce on its way..., jouser |
| Indexes: | [Date] [Thread] [Top] [All Lists] |