sendip
sendip
a usefull Tool for sending IP Packets, good for scripting and manual packet building.

Sendip Help
sendip -p ntp
No hostname specified
Usage: sendip [-v] [-d data] [-h] [-f datafile] [-p module] [module options] hostname
 -d data        add this data as a string to the end of the packet
                Data can be:
                rN to generate N random(ish) data bytes;
                0x or 0X followed by hex digits;
                0 followed by octal digits;
                any other stream of bytes
 -f datafile    read packet data from file
 -h             print this message
 -p module      load the specified module (see below)
 -v             be verbose

Modules available at compile time:
        ipv4 ipv6 icmp tcp udp bgp rip ntp
	
Arguments for module ipv4:

   -is x        Source IP address (see README)
                  Default: 127.0.0.1
   -id x        Destination IP address
                  Default: Correct
   -ih x        IP header length (see README)
                  Default: Correct
   -iv x        IP version (you almost definately don't want to change this)
                  Default: 4
   -iy x        IP type of service
                  Default: 0
   -il x        Total IP packet length (see README)
                  Default: Correct
   -ii x        IP packet ID (see README)
                  Default: Random
   -ifr x       IP reservced flag (see README)
                  Default: 0 (options are 0,1,r)
   -ifd x       IP don't fragment flag (see README)
                  Default: 0 (options are 0,1,r)
   -ifm x       IP more fragments flag (see README)
                  Default: 0 (options are 0,1,r)
   -if x        IP fragment offset
                  Default: 0
   -it x        IP time to live
                  Default: 255
   -ip x        IP protcol
                  Default: 0, or set by underlying protocol
   -ic x        IP checksum (see README)
                  Default: Correct
   -ionum x     IP option as string of hex bytes (length is always correct)
                  Default: (no options)
   -ioeol       IP option: end of list
   -ionop       IP option: no-op
   -iorr x      IP option: record route. Format: pointer:addr1:addr2:...
   -iots x      IP option: timestamp. Format: pointer:overflow:flag:(ip1:)ts1:(ip2:)ts2:...
   -iolsr x     IP option: loose source route. Format: pointer:addr1:addr2:...
   -iosid x     IP option: stream identifier
   -iossr x     IP option: strict source route. Format: pointer:addr1:addr2:...


Arguments for module tcp:
   -ts x        TCP source port
                  Default: 0
   -td x        TCP destination port
                  Default: 0
   -tn x        TCP sequence number
                  Default: Random
   -ta x        TCP ack number
                  Default: 0
   -tt x        TCP data offset
                  Default: Correct
   -tr x        TCP header reserved field EXCLUDING ECN and CWR bits
                  Default: 0
   -tfe x       TCP ECN bit (rfc2481)
                  Default: 0 (options are 0,1,r)
   -tfc x       TCP CWR bit (rfc2481)
                  Default: 0 (options are 0,1,r)
   -tfu x       TCP URG bit
                  Default: 0, or 1 if -tu specified (options are 0,1,r)
   -tfa x       TCP ACK bit
                  Default: 0, or 1 if -ta specified (options are 0,1,r)
   -tfp x       TCP PSH bit
                  Default: 0 (options are 0,1,r)
   -tfr x       TCP RST bit
                  Default: 0 (options are 0,1,r)
   -tfs x       TCP SYN bit
                  Default: 1 (options are 0,1,r)
   -tff x       TCP FIN bit
                  Default: 0 (options are 0,1,r)
   -tw x        TCP window size
                  Default: 65535
   -tc x        TCP checksum
                  Default: Correct
   -tu x        TCP urgent pointer
                  Default: 0
   -tonum x     TCP option as string of hex bytes (length is always correct)
                  Default: (no options)
   -toeol       TCP option: end of list
   -tonop       TCP option: no op
   -tomss x     TCP option: maximum segment size
   -towscale x  TCP option: window scale (rfc1323)
   -tosackok    TCP option: allow selective ack (rfc2018)
   -tosack x    TCP option: selective ack (rfc2018), format is l_edge1:r_edge1,l_edge2:r_edge2...
   -tots x      TCP option: timestamp (rfc1323), format is tsval:tsecr

Arguments for module udp:
   -us x        UDP source port
                  Default: 0
   -ud x        UDP destination port
                  Default: 0
   -ul x        UDP packet legnth
                  Default: Correct
   -uc x        UDP checksum
                  Default: Correct

Arguments for module icmp:
   -ct x        ICMP message type
                  Default: ICMP_ECHO (8), or ICMP6_ECHO_REQUEST (128) if embedded in an IPv6 packet
   -cd x        ICMP code
                  Default: 0
   -cc x        ICMP checksum
                  Default: Correct

my sendip samples
	#
	# snmp get with sendip
	# snmpget -c private -v 1 192.168.2.X .1.3.6.1.2.1.1.5.0
	#
	#
	sendip -p ipv4 -is 192.168.2.100 -p udp -us 161 -ud 161 -d 0x302a020100040770726976617465a01c020430663cd4020100020100300e300c06082b060102010105000500 -v 192.168.2.150

other sendip samples
	sendip 192.168.1.21 -p ICMP -d "00000000c0a80115" -ct 0 -it 255 -iy 0x04 -ii 41101 –is 192.168.1.28
	
	sendip 192.168.1.0 -p ICMP -d "00000000c0a80100" –sb 1 -it 240 -iy 0xC0 -ii 1206 -ct 8 -is 192.168.1.28
	
	sendip 192.168.1.31 -p ICMP -d "00000000c0a8011F" -sb 1 -it 240 -iy 0xC0 -ii 1206 -ct 8 -is 192.168.1.28
	
	sendip 192.168.0.1 -p UDP -ud 500 -us 500 -d F35C1DEA6E81CF0A00000000000000000110020000000000000000B000000094000000010000000100000088000100040300002000010000 800B0001800C0E10800100058002000280030001800400020300002001010000800B0001800C0E10800100058002000180030001800400020300002002010000800B0001800C0E10800100058002000180030001800400010000002003010000800B0001800C0E1080010005800200028003000180040001
	
	sendip -v -p ipv4 -is 172.23.140.32 -p udp -us 34001 -ud 34002 212.126.24.130
	sendip -v -p ipv4 -is 212.126.24.129 -p udp -us 34002 -ud 34001 212.31.242.98
	
	sendip -p ipv4 -p tcp -is 10.1.17.1 -ts 1000 -td 1005 -tfs 1 -tn 17 10.1.17.90
	

(c) 2008 by packetlevel.ch / last update: 28.10.2008