#!/usr/bin/perl # # Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # $Id: packet.pl,v 1.2 2011-04-15 01:02:08 each Exp $ # This is a tool for sending an arbitrary packet via UDP or TCP to an # arbitrary address and port. The packet is specified in a file or on # the standard input, in the form of a series of bytes in hexidecimal. # Whitespace is ignored, as is anything following a '#' symbol. # # For example, the following input would generate normal query for # isc.org/NS/IN": # # # QID: # 0c d8 # # header: # 01 00 00 01 00 00 00 00 00 00 # # qname isc.org: # 03 69 73 63 03 6f 72 67 00 # # qtype NS: # 00 02 # # qclass IN: # 00 01 # # Note that we do not wait for a response for the server. This is simply # a way of injecting arbitrary packets to test server resposnes. # # Usage: packet.pl [-a
] [-p