Snmp Absenderfälschung

#!/bin/bash

# Idea from http://www.net-snmp.org/wiki/index.php/TUT:source_spoofing
TRAP_RECEIVER="192.168.140.211"
TRAP_FIXED_PARAMS="-v 1 -c public"
SRC=$1
STRING=$2
iptables -t nat -A POSTROUTING -d $TRAP_RECEIVER -p udp --dport 162 -j SNAT --to $SRC
snmptrap $TRAP_FIXED_PARAMS $TRAP_RECEIVER '.1.3.6.1.6.3.1.1.5.3' '0.0.0.0' 6 33 '55' .1.3.6.1.6.3.1.1.5.3 s "$STRING"
sleep 2
iptables -t nat -D POSTROUTING -d ${TRAP_RECEIVER} -p udp --dport 162 -j SNAT --to $SRC

Und dann von der Konsole abfeuern mit:

for i in {0..23}; do /tmp/spoof-snmp.sh 192.168.66.248 input$i:0; done