234 |
tail --bytes=$[LogSize - OldLogSize] $SCANLOG | \ |
tail --bytes=$[LogSize - OldLogSize] $SCANLOG | \ |
235 |
while read LogFileLine; do |
while read LogFileLine; do |
236 |
|
|
237 |
|
DateTime=`echo "\$LogFileLine" | awk -F' ' '{ print $1 " " $2 " " $3 }'` |
238 |
|
LogFileMsg=`echo "\$LogFileLine" | awk -F' ' '{ $1=""; $2=""; $3=""; print $0 }'` |
239 |
|
|
240 |
case "$LogFileLine" in |
case "$LogFileLine" in |
241 |
|
|
242 |
($MatchP1) |
($MatchP1) |
243 |
IP=`echo "\$LogFileLine" | cut -d' ' -f11` |
Username=`echo "\$LogFileMsg" | cut -d' ' -f8` |
244 |
DateTime=`echo "\$LogFileLine" | cut -d' ' -f1-4` |
IP=`echo "\$LogFileMsg" | cut -d' ' -f10` |
|
Username=`echo "\$LogFileLine" | cut -d' ' -f9` |
|
245 |
logmessage "SSH: illegal login as '$Username' from '$IP' at '$DateTime'." |
logmessage "SSH: illegal login as '$Username' from '$IP' at '$DateTime'." |
246 |
[ "$DROP_SSH_ILLEGALUSER" == 1 ] && dropaddress $IP |
[ "$DROP_SSH_ILLEGALUSER" == 1 ] && dropaddress $IP |
247 |
;; |
;; |
250 |
;; |
;; |
251 |
|
|
252 |
($MatchP2) |
($MatchP2) |
253 |
IP=`echo "\$LogFileLine" | cut -d' ' -f12` |
Username=`echo "\$LogFileMsg" | cut -d' ' -f9` |
254 |
DateTime=`echo "\$LogFileLine" | cut -d' ' -f1-4` |
IP=`echo "\$LogFileMsg" | cut -d' ' -f11` |
|
Username=`echo "\$LogFileLine" | cut -d' ' -f10` |
|
255 |
logmessage "SSH: failed password for '$Username' from '$IP' at '$DateTime'." |
logmessage "SSH: failed password for '$Username' from '$IP' at '$DateTime'." |
256 |
dropaddress $IP |
dropaddress $IP |
257 |
;; |
;; |
260 |
;; |
;; |
261 |
|
|
262 |
($MatchP3) |
($MatchP3) |
263 |
IP=`echo "\$LogFileLine" | cut -d' ' -f14` |
Username=`echo "\$LogFileMsg" | cut -d' ' -f11` |
264 |
DateTime=`echo "\$LogFileLine" | cut -d' ' -f1-4` |
IP=`echo "\$LogFileMsg" | cut -d' ' -f13` |
|
Username=`echo "\$LogFileLine" | cut -d' ' -f12` |
|
265 |
logmessage "SSH: incorrect password for '$Username' from '$IP' at '$DateTime'." |
logmessage "SSH: incorrect password for '$Username' from '$IP' at '$DateTime'." |
266 |
dropaddress $IP |
dropaddress $IP |
267 |
;; |
;; |
268 |
|
|
269 |
($MatchFTP_P1) |
($MatchFTP_P1) |
270 |
Address=`echo "\$LogFileLine" | cut -d' ' -f11` |
Address=`echo "\$LogFileMsg" | cut -d' ' -f10` |
271 |
DateTime=`echo "\$LogFileLine" | cut -d' ' -f1-4` |
Username=`echo "\$LogFileMsg" | cut -d' ' -f11` |
|
Username=`echo "\$LogFileLine" | cut -d' ' -f12` |
|
272 |
Address=${Address/,} |
Address=${Address/,} |
273 |
IP=$(resolveip -s $Address) |
IP=$(resolveip -s $Address) |
274 |
logmessage "FTP: failed login as '$Username' from '$IP' at '$DateTime'." |
logmessage "FTP: failed login as '$Username' from '$IP' at '$DateTime'." |