Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
7fbdffa7d7 | |||
5563208160 | |||
58b5e86d5b | |||
772e83331d | |||
50ca517960 | |||
dfa164d699 | |||
59fab70b75 | |||
860344923c | |||
af5fb34c70 | |||
3a311113b2 | |||
8561ebc1e6 | |||
94f61fcdc6 |
|
@ -49,7 +49,7 @@ body {
|
|||
}
|
||||
|
||||
.cell {
|
||||
width: 10em;
|
||||
width: 12em;
|
||||
padding: 0.4em;
|
||||
display: table-cell;
|
||||
text-align: center;
|
||||
|
|
|
@ -4,31 +4,42 @@ action=$1
|
|||
ip=$2
|
||||
service=$3
|
||||
|
||||
curDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
||||
echo $curDir
|
||||
curDir=$(dirname $0)
|
||||
|
||||
source $curDir/bancount.cfg
|
||||
cd $curDir
|
||||
|
||||
source bancount.cfg
|
||||
|
||||
if [ -f "GeoIP.dat" ]
|
||||
then
|
||||
allInfoIp=`geoiplookup $ip`;
|
||||
else
|
||||
allInfoIp=`geoiplookup -f GeoIP.dat $ip`;
|
||||
fi
|
||||
|
||||
geoip () {
|
||||
geoiplookup $ip | awk -F, '{print $2}' | sed s/\ //
|
||||
echo $allInfoIp | awk -F, '{print $2}' | sed s/\ //
|
||||
}
|
||||
|
||||
countryCode () {
|
||||
echo $allInfoIp $ip | awk -F ": " '{ print $2 }' | awk -F "," '{ print $1 }' | head -n 1
|
||||
}
|
||||
|
||||
case $action in
|
||||
|
||||
ban)
|
||||
mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO bans (ip, service, ban_date, ban_time, country) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip $ip`');"
|
||||
|
||||
mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO bans (ip, service, ban_date, ban_time, country, countryCode) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip`', '`countryCode`');"
|
||||
;;
|
||||
|
||||
unban)
|
||||
mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO unbans (ip, service, unban_date, unban_time, country) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip $ip`');"
|
||||
mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO unbans (ip, service, unban_date, unban_time, country, countryCode) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip`', '`countryCode`');"
|
||||
;;
|
||||
|
||||
*)
|
||||
cat << EOF
|
||||
cat << EOF
|
||||
Fail2BanCount - by k6b - MySQL logger
|
||||
|
||||
$(basename $0) <ban/unban> <ip>
|
||||
$(basename $0) <ban/unban> <ip> <service>
|
||||
|
||||
Performs geoip lookup and stamps time
|
||||
and date into MySQL database.
|
||||
|
|
|
@ -29,6 +29,7 @@ CREATE TABLE `bans` (
|
|||
`ban_date` varchar(10) DEFAULT NULL,
|
||||
`ban_time` varchar(8) DEFAULT NULL,
|
||||
`country` char(50) NOT NULL DEFAULT 'Martians!',
|
||||
`countryCode` char(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -47,6 +48,7 @@ CREATE TABLE `unbans` (
|
|||
`unban_date` varchar(10) DEFAULT NULL,
|
||||
`unban_time` varchar(8) DEFAULT NULL,
|
||||
`country` char(50) DEFAULT NULL,
|
||||
`countryCode` char(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
|
BIN
img/flag/16/ad.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
img/flag/16/ae.png
Normal file
After Width: | Height: | Size: 455 B |
BIN
img/flag/16/af.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
img/flag/16/ag.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
img/flag/16/ai.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
img/flag/16/al.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
img/flag/16/am.png
Normal file
After Width: | Height: | Size: 335 B |
BIN
img/flag/16/an.png
Normal file
After Width: | Height: | Size: 484 B |
BIN
img/flag/16/ao.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
img/flag/16/aq.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
img/flag/16/ar.png
Normal file
After Width: | Height: | Size: 358 B |
BIN
img/flag/16/as.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
img/flag/16/at.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
img/flag/16/au.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
img/flag/16/aw.png
Normal file
After Width: | Height: | Size: 486 B |
BIN
img/flag/16/ax.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
img/flag/16/az.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
img/flag/16/ba.png
Normal file
After Width: | Height: | Size: 517 B |
BIN
img/flag/16/bb.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
img/flag/16/bd.png
Normal file
After Width: | Height: | Size: 527 B |
BIN
img/flag/16/be.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
img/flag/16/bf.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
img/flag/16/bg.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
img/flag/16/bh.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
img/flag/16/bi.png
Normal file
After Width: | Height: | Size: 542 B |
BIN
img/flag/16/bj.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
img/flag/16/bl.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
img/flag/16/bm.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
img/flag/16/bn.png
Normal file
After Width: | Height: | Size: 534 B |
BIN
img/flag/16/bo.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
img/flag/16/br.png
Normal file
After Width: | Height: | Size: 538 B |
BIN
img/flag/16/bs.png
Normal file
After Width: | Height: | Size: 459 B |
BIN
img/flag/16/bt.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
img/flag/16/bv.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
img/flag/16/bw.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
img/flag/16/by.png
Normal file
After Width: | Height: | Size: 427 B |
BIN
img/flag/16/bz.png
Normal file
After Width: | Height: | Size: 533 B |
BIN
img/flag/16/ca.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
img/flag/16/cc.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
img/flag/16/cd.png
Normal file
After Width: | Height: | Size: 547 B |
BIN
img/flag/16/cf.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
img/flag/16/cg.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
img/flag/16/ch.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
img/flag/16/ci.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
img/flag/16/ck.png
Normal file
After Width: | Height: | Size: 539 B |
BIN
img/flag/16/cl.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
img/flag/16/cm.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
img/flag/16/cn.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
img/flag/16/co.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
img/flag/16/cr.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
img/flag/16/cu.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
img/flag/16/cv.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
img/flag/16/cx.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
img/flag/16/cy.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
img/flag/16/cz.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
img/flag/16/de.png
Normal file
After Width: | Height: | Size: 388 B |
BIN
img/flag/16/dj.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
img/flag/16/dk.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
img/flag/16/dm.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
img/flag/16/do.png
Normal file
After Width: | Height: | Size: 543 B |
BIN
img/flag/16/dz.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
img/flag/16/ec.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
img/flag/16/ee.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
img/flag/16/eg.png
Normal file
After Width: | Height: | Size: 437 B |
BIN
img/flag/16/eh.png
Normal file
After Width: | Height: | Size: 505 B |
BIN
img/flag/16/er.png
Normal file
After Width: | Height: | Size: 533 B |
BIN
img/flag/16/es.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
img/flag/16/et.png
Normal file
After Width: | Height: | Size: 491 B |
BIN
img/flag/16/fi.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
img/flag/16/fj.png
Normal file
After Width: | Height: | Size: 527 B |
BIN
img/flag/16/fk.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
img/flag/16/fm.png
Normal file
After Width: | Height: | Size: 401 B |
BIN
img/flag/16/fo.png
Normal file
After Width: | Height: | Size: 470 B |
BIN
img/flag/16/fr.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
img/flag/16/ga.png
Normal file
After Width: | Height: | Size: 430 B |
BIN
img/flag/16/gb.png
Normal file
After Width: | Height: | Size: 547 B |
BIN
img/flag/16/gd.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
img/flag/16/ge.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
img/flag/16/gf.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
img/flag/16/gg.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
img/flag/16/gh.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
img/flag/16/gi.png
Normal file
After Width: | Height: | Size: 478 B |
BIN
img/flag/16/gl.png
Normal file
After Width: | Height: | Size: 536 B |
BIN
img/flag/16/gm.png
Normal file
After Width: | Height: | Size: 426 B |
BIN
img/flag/16/gn.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
img/flag/16/gp.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
img/flag/16/gq.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
img/flag/16/gr.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
img/flag/16/gs.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
img/flag/16/gt.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
img/flag/16/gu.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
img/flag/16/gw.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
img/flag/16/gy.png
Normal file
After Width: | Height: | Size: 499 B |
BIN
img/flag/16/hk.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
img/flag/16/hm.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
img/flag/16/hn.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
img/flag/16/hr.png
Normal file
After Width: | Height: | Size: 521 B |