Other tools Custom Packets Generators

189 The -P option can be used to read the data for the packet from a file. For example, here is the syntax to send a DNS query. bsd2 nemesis-dns -v -S 172.16.2.236 -D 205.153.63.30 -q 1 -P data.dns DNS Packet Injection -=- The NEMESIS Project 1.1 c 1999, 2000 obecian obeciancelerity.bartoli.org [IP] 172.16.2.236 205.153.63.30 [Ports] 42069 53 [ Questions] 1 [ Answer RRs] 0 [ Authority RRs] 0 [ Additional RRs] 0 [IP ID] 420 [IP TTL] 254 [IP TOS] 0x18 [IP Frag] 0x4000 [IP Options] 00 01 01 00 00 01 00 00 00 00 00 00 03 77 77 .............ww 77 05 63 69 73 63 6F 03 63 6F 6D 00 00 01 00 w.cisco.com.... 01 . Wrote 40 bytes DNS Packet Injected Although it appears the data has been sent correctly, I have seen examples when the packets were not correctly sent despite appearances. So, be warned It is always a good idea to check the output of a packet generator with a packet sniffer just to make sure you are getting what you expect.

9.1.1.3 Other tools

There are a number of other choices. ipfilter is a suite of programs for creating firewalls. Supplied with some operating systems, including FreeBSD, ipfilter has been ported to a number of other platforms. One of the tools ipfilter includes is ipsend. Designed for testing firewalls, ipsend is yet another tool to construct packets. Here is an example: bsd2 ipsend -v -i ep0 -g 172.16.2.1 -d 205.153.63.30 Device: ep0 Source: 172.16.2.236 Dest: 205.153.63.30 Gateway: 172.16.2.1 mtu: 1500 ipsend is not the most versatile of tools, but depending on what system you are using, you may already have it installed. Yet another program worth considering is sock. sock is described in the first volume of Richard W. Stevens TCPIllustrated and is freely downloadable. While sock doesnt give the range of control some of these other programs give, it is a nice pedagogical tool for learning about TCPIP. Beware, there are other totally unrelated programs called sock. 190 Finally, some sniffers and analyzers support the capture and retransmission of packets. Look at the documentation for the sniffer you are using, particularly if it is a commercial product. If you decide to use this feature, proceed with care. Retransmission of traffic, if used indiscriminately, can create some severe problems. socket and netcat While they dont fit cleanly into this or the next category, netcat or nc and Juergen Nickelsens socket are worth mentioning. The netcat documentation identifies only the author as Hobbit. Both are programs that can be used to establish a connection between two machines. They are useful for debugging, moving files, and exploring and learning about TCPIP. Both can be used from scripts. Youll need to start one copy as a server in listen mode on one computer: bsd1 nc -l -p 2000 Then start another as a client on a second computer: bsd2 nc 172.16.2.231 2000 Here is the equivalent command for socket as a server: bsd1 socket -s 2000 Here is the equivalent command for a client: bsd2 socket 172.16.2.231 2000 In all examples 2000 is an arbitrarily selected port number. Here is a simple example using nc to copy a file from one system to another. The server is opened with output redirected to a file: bsd1 nc -l -p 2000 tmp Then the file is piped to the client: bsd2 cat README | nc 172.16.2.231 2000 C punt Finally, nc is terminated with a Ctrl-C. The contents of README on bsd1 have been copied to the file tmp on bsd2. These programs can be cleaner than telnet in some testing situations since, unlike telnet, they dont attempt any session negotiations when started. Play with them, and you are sure to find a number of other uses.

9.1.2 Load Generators