File: kill_cmd

package info (click to toggle)
portsentry 1.2-11.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 464 kB
  • ctags: 157
  • sloc: ansic: 2,283; makefile: 196; sh: 186; perl: 94; csh: 31
file content (27 lines) | stat: -rw-r--r-- 728 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Example for a KILL_RUN_CMD in /etc/portsentry/portsentry.conf
# by  Peter Gerhardt <peter.gerhardt@uni-konstanz.de>
# and Guido Guenther <guido.guenther@uni-konstanz.de>
#
# $Id: kill_cmd,v 1.3 2001/07/19 21:02:34 agx Exp $

# grep into /etc/services to check which port was scanned
MODE=${3/[sa]/}		# get rid of s and a
SERVICEINFO=`grep "[[:space:]]$2/$MODE" /etc/services` 

# can we get some info about the attacker?
FINGERINFO=`/usr/sbin/safe_finger -l @$1 2>/dev/null`

cat <<EOF | mail root -s "PortSentry: $1 scanned $HOSTNAME:$2/$3"

Someone @$1 scanned on host $HOSTNAME

the service (from /etc/services): 
$SERVICEINFO

additional information (from reverse finger):
$FINGERINFO

Cheers,
	Portsentry
EOF