Wednesday, April 27, 2011

Cisco IOS capture lazy dog

# create a buffer
monitor capture buffer buffer1 size 512 max-size 512 circular

# create a capture point
monitor capture point ip cef capture1 FastEthernet 0/1/3 both

# associate capture with the buffer 'buffer1'
monitor capture point associate capture1 buffer1

# Start monitor the capture
monitor capture point start capture1

# Show the buffer
show monitor capture buffer buffer1 dump

# Stop the capture
monitor capture point stop capture1

Tuesday, April 12, 2011

dns blacklist bash script

LISTS="sbl-xbl.spamhaus.org zen.spamhaus.org bl.spamcop.net dnsbl.njabl.org b.barracudacentral.org dnsbl.sorbs.net pbl.spamhaus.org"
HOSTS="1.2.3.4 127.0.0.1"

for list in $LISTS
do
for host in $HOSTS
do
W=$( echo ${host} | cut -d. -f1 )
X=$( echo ${host} | cut -d. -f2 )
Y=$( echo ${host} | cut -d. -f3 )
Z=$( echo ${host} | cut -d. -f4 )
result=`dig +short $Z.$Y.$X.$W.$list`
if [ "$result" != "" ]; then
echo "$host listed in $list"
fi
done
done