# $Log: scapy.py,v $
# Revision 1.0.3.1  2006/01/28 14:32:55  pbi
# Release 1.0.3
#
# Revision 1.0.2.37  2006/01/28 13:14:25  pbi
# - tweaked ls() for add-on classes to appear in the listing
#
# Revision 1.0.2.36  2006/01/28 13:02:15  pbi
# - replaced remaining occurences of use of display() [deprecated, use show()]
# - removed URL from dummy IPv6 classes names
#
# Revision 1.0.2.35  2006/01/17 18:02:42  pbi
# - finished Packet.canvas_dup() escape() function. Every char is correctly translated into TeX
#
# Revision 1.0.2.34  2006/01/15 13:15:57  pbi
# -added information-request and information-response to ICMP types (J. Bowie)
#
# Revision 1.0.2.33  2006/01/15 13:15:16  pbi
# - fixed NetBIOSNameField incorrect length calculation (J. Bowie)
#
# Revision 1.0.2.32  2006/01/14 16:54:29  pbi
# - added missing _IPv6optionHearder dummy class
# - removed useless IPv6_instace() function
#
# Revision 1.0.2.31  2006/01/12 11:02:51  pbi
# - fixed 1.0.2.29 collision fix (s/mtu/mtu_present/)
#
# Revision 1.0.2.30  2006/01/11 17:45:45  pbi
# - fixed endianness problems in PcapReader()
# - fixed PcapReader.read_all()
# - added missing try/except to PcapReader.read_packet()
# - removed PcapReader.read_PacketList() (read_all() already returns a PacketList)
# - removed debug "print" from PcapWriter()
# - added endianness parameter in PcapWriter()
#
# Revision 1.0.2.29  2006/01/11 17:00:01  pbi
# - added Solaris support (wit help from S. Despret)
# - added Solaris missing IPPROTO_GRE
# - changed read_routes() to work with Solaris netstat
# - fixed read_route() local variable collision (mtu became mtu_present)
# - changed variable fl to flg
#
# Revision 1.0.2.28  2006/01/05 17:49:17  pbi
# - re-added indentation in Packet.show(). Can be tweaked with "indent" parameter
#
# Revision 1.0.2.27  2006/01/04 15:04:17  pbi
# - added missing try/except arround dissection in rdpcap()
#
# Revision 1.0.2.26  2005/12/23 00:51:51  pbi
# - strengthened DNS disassembly
#
# Revision 1.0.2.25  2005/12/23 00:11:09  pbi
# - have scapy work if Python IPv6 support is not compiled in socketmodule
#
# Revision 1.0.2.24  2005/12/23 00:08:50  pbi
# - aliased socket.inet_ntoa into local namespace for consistency with other ?to?
#
# Revision 1.0.2.23  2005/12/22 17:58:08  pbi
# - fixed and enhanced autorun_commands()
#
# Revision 1.0.2.22  2005/12/21 23:00:16  pbi
# - fixed bug introduced by fix 1.0.2.19 on _
#
# Revision 1.0.2.21  2005/12/21 22:58:45  pbi
# - added Packet.get_field() to get a field instance from its name
# - modified some fields to use Packet.get_field() instead of a complex operation
#
# Revision 1.0.2.20  2005/12/19 12:43:52  pbi
# - added FieldListField to create arrays of fields whose number is given in a FieldLenField
#
# Revision 1.0.2.19  2005/12/18 22:46:35  pbi
# - fixed uninitialized _ in autorun_commands()
#
# Revision 1.0.2.18  2005/12/17 11:27:05  pbi
# - Changed ColorTheme class be usable
# - Added NoTheme class
# - added autorun_get_text_interactive_session()
# - added autorun_get_ansi_interactive_session()
# - added autorun_get_latex_interactive_session() (miss some special chars filtering)
#
# Revision 1.0.2.17  2005/12/15 15:13:58  pbi
# - IPv6 migration step 1: integrate some IPv6 routing stuff for IPv6 fork to work
#   as an add-on
#
# Revision 1.0.2.16  2005/12/07 18:02:26  pbi
# - added fallbacks if tcpdump can't be run and libpcap is not used
#
# Revision 1.0.2.15  2005/12/07 17:44:11  pbi
# - fixed socket filter pushing for x86_64 arch. (W. Robinet)
#
# Revision 1.0.2.14  2005/12/06 16:41:30  pbi
# - added conf.check_TCPerror_seqack (default 0) to relax ICMP error matching for TCP
#   packets (some broken PIX play with sequence numbers and forget to tidy them up)
#
# Revision 1.0.2.13  2005/11/27 00:09:30  pbi
# - added code to run interactive sessions automatically
#
# Revision 1.0.2.12  2005/11/26 11:33:55  pbi
# - catch exceptions in ColorPrompt from bad color theme to avoid
#   program termination
#
# Revision 1.0.2.11  2005/11/26 11:10:44  pbi
# - added class HTMLTheme2 with trigram instead of '<' and '>' to easily convert others into &lt; and &gt;
#
# Revision 1.0.2.10  2005/11/20 16:23:01  pbi
# - improved a bit error handling of import dnet/pcap
# - made INFO messages for missing files a bit more clear
#
# Revision 1.0.2.9  2005/11/19 08:39:09  pbi
# - handle API change between pylibpcap 0.4 and 0.5
#
# Revision 1.0.2.8  2005/11/17 11:05:56  pbi
# - changed Packet.sprintf() format string specificator to accept only the
#   field name and take the currend layer
#
# Revision 1.0.2.7  2005/11/17 10:24:53  pbi
# - added onlyasc parameter to linehexdump()
# - added onlyasc parameter to fragleak() and fragleak2()
#
# Revision 1.0.2.6  2005/11/15 04:55:11  pbi
# - added Packet.command() to go from a packet instance to the Scapy command to generate it
#
# Revision 1.0.2.5  2005/11/15 03:04:51  pbi
# - write history in an atexit registered function
#
# Revision 1.0.2.4  2005/11/15 02:58:44  pbi
# - fixed Enum fields for them to work with lists of values
#
# Revision 1.0.2.3  2005/11/09 19:56:42  pbi
# - added a ColorTheme.__repr__() to fix objects that used it, like conf object!
#
# Revision 1.0.2.2  2005/11/09 18:26:57  pbi
# - fixed itom() to return positive values even for big endian platforms
# - fixed RandIP default __init__ parameter to be 0.0.0.0/0 instead of 0/0
#
# Revision 1.0.2.1  2005/11/07 14:04:39  pbi
# release 1.0.2
#
# Revision 1.0.1.13  2005/11/07 14:00:54  pbi
# - fixed Dot11Auth.seqnum to be little endian
# - added Dot11Auth.answers()
#
# Revision 1.0.1.12  2005/11/07 13:39:31  pbi
# - fixed some stuff in the LaTeX color theme
#
# Revision 1.0.1.11  2005/11/07 13:38:36  pbi
# - added timeout parameter to fragleak()
# - created fragleak2()
#
# Revision 1.0.1.10  2005/11/07 13:37:20  pbi
# - fixed LLC/SNAP binding to overload LLC.ctrl with 3
#
# Revision 1.0.1.9  2005/11/07 13:35:12  pbi
# - changed Dot11.summary() to show src > dst
# - added Dot11.answers()
#
# Revision 1.0.1.8  2005/11/07 13:33:43  pbi
# - added DNS.answsers()
#
# Revision 1.0.1.7  2005/11/07 13:33:19  pbi
# - added SignedIntField() and LESignedIntField
# - converted PrismHeader's "signal" field to signed
#
# Revision 1.0.1.6  2005/11/01 12:22:02  pbi
# - added hint_iface parameter to sendp()
# - used hint_iface in arpcachepoison()
#
# Revision 1.0.1.5  2005/10/31 12:29:09  pbi
# - added ConditionalField to wrap a field and apply a condition to its presense
# - added NewDefaultValues metaclass to create new Packet classes from old ones
#   with new default default values
# - added GRE protocol from rfc2784. (need more work for rfc1701)
#
# Revision 1.0.1.4  2005/10/27 15:12:32  pbi
# - created VolatileValue class to handle volatile values like RandomField
# - redesigned inheritence of random fields arround VolatileValue
# - added DelayedEval() volatile value
#
# Revision 1.0.1.3  2005/10/27 14:59:11  pbi
# - Changed color themes handling. Now LatexTheme and HTMLTheme are not ugly hacks anymore.
#
# Revision 1.0.1.2  2005/10/26 16:15:06  pbi
# - added CharEnumField()
# - declared s2i and i2s in EnumField before calling superclass' contructor
#
# Revision 1.0.1.1  2005/10/25 07:49:35  pbi
# Release 1.0.1
#
# Revision 1.0.0.61  2005/10/25 07:48:48  pbi
# - added rebuild option to Packet.p{s|df}dump() to dump a packet as-is
#
# Revision 1.0.0.60  2005/10/23 18:20:30  pbi
# - PacketList.sr() return ( (matched couples), (unmatched packets) ) from the packet list
#
# Revision 1.0.0.59  2005/10/23 17:15:34  pbi
# - added layer_shift option to every p{s|df}dump() method to explode hexa dump by layers
#
# Revision 1.0.0.58  2005/10/23 17:09:29  pbi
# - return a loopback route when no default route is present. XXX: linux specific!
#
# Revision 1.0.0.57  2005/10/23 17:07:59  pbi
# - split bind_layers() into bind_top_down() and bind_bottom_up()
#
# Revision 1.0.0.56  2005/10/23 16:57:26  pbi
# - fixed dissection errors exception management when conf.debug_dissector is true
#
# Revision 1.0.0.55  2005/10/23 16:56:00  pbi
# - made MACField's default value to be "00:00:00:00:00:00"
# - fixed DestMACField's default value to be "ff:ff:ff:ff:ff:ff"
#
# Revision 1.0.0.54  2005/10/23 16:54:00  pbi
# - fixed Field.randval() to work with string formats and modifiers
# - fixed fuzz() not to overload default value if field's proposed randval is None
#
# Revision 1.0.0.53  2005/10/17 16:03:36  pbi
# - uniformized to "lfilter" the paramter name for lambda expressions used as filters
# - removed a superfluous line in crc32()
#
# Revision 1.0.0.52  2005/10/15 13:17:18  pbi
# - AutoTime() and IntAutoTime() classes that give a field a time dependant value
# - PacketList.timeskew_graph() should work on SndRcvList()
#
# Revision 1.0.0.51  2005/10/08 20:52:45  pbi
# - added StreamSocket supersocket to emulate a datagram socket on a stream
#   socket that supports MSG_PEEK and whose base layer class knows its own size
#   and put the remaining in Padding()
#
# Revision 1.0.0.50  2005/10/08 12:46:56  pbi
# - remove useless routes in netstat -rn output (P. Lalet)
#
# Revision 1.0.0.49  2005/10/08 12:41:23  pbi
# - fixed netmask calculations (P. Lalet)
#
# Revision 1.0.0.48  2005/10/08 11:21:28  pbi
# - use color for packet numbering in nsummary() et al.
#
# Revision 1.0.0.47  2005/10/06 12:57:25  pbi
# - fixed MAC addresses calculation when IP is a Gen() instance (G. Valadon)
#
# Revision 1.0.0.46  2005/10/06 12:44:51  pbi
# - added route.get_if_bcast() to get interface's broadcast address (F. Raynal)
# - added a check in getmacbyip() to give a broadcast MAC for a broadcast IP
# - added sndrcv() (thus sr*() family)  "multi" parameter to accept many answers
#   from one stimulus. (If stimulus uses a broadcast dst address, you'll need
#   to set conf.checkIPaddr=0)
#
# Revision 1.0.0.45  2005/10/06 12:03:46  pbi
# - changed sys.exit() into os._exit() in sndrcv() to prevent children to flush files buffers
#   that would be written a second time by the parent (SJ Murdoch)
#
# Revision 1.0.0.44  2005/10/06 11:44:48  pbi
# - worked arround (I hope) all FreeBSD/MacOS/pcap issues (look at pcap_get_selectable_fd() note of pcap8 manpage).
#   Thus no more active waits or unseen packets. Still problems to interrupt a capture with ^C on some FreeBSD kernels :(
#
# Revision 1.0.0.43  2005/10/05 11:51:33  pbi
# - added nofilter option to supersockets to handle ethertype filtering for non-linux stuff
#   and for ARP resolution to bypass conf.except_filter
#
# Revision 1.0.0.42  2005/10/05 11:28:14  pbi
# - added RandMAC()
# - added early support for fuzzing
# - added fuzz()
#
# Revision 1.0.0.41  2005/10/05 11:14:57  pbi
# - modified Packet.__iter__ to also evaluate random defaults fields
#
# Revision 1.0.0.40  2005/10/05 11:11:56  pbi
# - filtered more characters for LaTeX in ps/pdf dump
# - removed character that has magically appeared in DHCP_am
#
# Revision 1.0.0.39  2005/10/05 11:08:32  pbi
# - fixed StrFixedLenField.addfield()
#
# Revision 1.0.0.38  2005/10/05 11:06:51  pbi
# - overloaded RandFields repr() to give the class name
# - added RandLong()
# - added RandBin() to be RandString() for all chars
# - added RandTermString()
# - added RandIP default template to be "0/0"
#
# Revision 1.0.0.37  2005/10/05 11:01:20  pbi
# - more tests in DHCP_am.make_reply() to handle garbage in
#
# Revision 1.0.0.36  2005/09/24 14:37:51  pbi
# - added a "padding" option to TracerouteResult.graph() to show routers that pad
#
# Revision 1.0.0.35  2005/09/24 14:32:40  pbi
# - added Packet.psdump() and Packet.pdfdump()
# - added PacketList.psdump() and PacketList.pdfdump()
#
# Revision 1.0.0.34  2005/09/24 14:30:15  pbi
# - ability to change the BPF filter in traceroute()
#
# Revision 1.0.0.33  2005/09/24 14:29:30  pbi
# - completed PrismHeader layer
#
# Revision 1.0.0.32  2005/09/24 14:27:27  pbi
# - deprecated "packet.haslayer(l)" by "l in Packet"
# - deprecated "Packet.getlayer(l)" by "Packet[l]"
#
# Revision 1.0.0.31  2005/09/24 14:25:01  pbi
# - better error message if gnuplot wrapper is missing
# - fixed subclass test in dissection error treatment
# - fixed Dot11Elt summary
# - fixed __sr_loop() to prevent stats calc if no packet have been received
# - fixed sniff() to break loop at the end of reading a file (offline optoin)
#
# Revision 1.0.0.30  2005/09/13 16:03:47  pbi
# - added Dot11Elt.mysummary() for SSID displaying
# - fixed Enum*.i2repr()
#
# Revision 1.0.0.29  2005/09/13 16:02:35  pbi
# - fix build of packets with more than one padding
#
# Revision 1.0.0.28  2005/09/12 16:14:41  pbi
# - new hexdump() which displays offsets
#
# Revision 1.0.0.27  2005/09/12 14:56:31  pbi
# - new summary() and mysummary() semantic (backward compatible!) to enable more than one class to be expanded.
#   The higher gives its dependances along with its own summary
#
# Revision 1.0.0.26  2005/09/12 14:03:10  pbi
# - added ip.dst in ICMP summary()
#
# Revision 1.0.0.25  2005/09/12 13:25:22  pbi
# - added post_dissection() method, called at the end of the dissection, when the packet is ready
# - added default_payload_class() called when layer bonds are not sufficient
# - improved/fixed conf.debug_dissector() which failed when guess_payload_class() returned None
#
# Revision 1.0.0.24  2005/09/08 14:13:36  pbi
# - added RandIP()
#
# Revision 1.0.0.23  2005/09/08 05:29:23  pbi
# - added conf.debug_dissecto checks where it was missing in SuperSockets
# - Slice pcap object only once we know its not None ! (N. Peterson)
#
# Revision 1.0.0.22  2005/09/06 17:08:47  pbi
# - made AnsweringMachine() callable instead of using the run() method
#
# Revision 1.0.0.21  2005/09/06 17:05:19  pbi
# - new logging/warning facility using the logging module
#
# Revision 1.0.0.20  2005/08/28 18:01:12  pbi
# - 802.11 tweaks
#
# Revision 1.0.0.19  2005/08/28 18:00:14  pbi
# - added Packet.decode_payload_as()
#
# Revision 1.0.0.18  2005/08/28 17:51:05  pbi
# - Added XShortEnumField()
#
# Revision 1.0.0.17  2005/08/17 18:11:13  pbi
# - fixed crc32() computation for big endian systems
#
# Revision 1.0.0.16  2005/08/17 12:54:47  pbi
# - fix regression introduced in 1.0.0.4 (netstat parsing)
#
# Revision 1.0.0.15  2005/08/16 17:00:35  pbi
# - fixed socket creation/attach filter race condition for L2Socket and L3PacketSocket.
#   No more packets shoud go through the filter.
#
# Revision 1.0.0.14  2005/08/16 16:58:59  pbi
# - don't return outgoing packets in L2Socket and L3PacketSocket
# - L2Socket and L3PacketSocket don't catch the exception if conf.dissector=1
#
# Revision 1.0.0.13  2005/08/16 16:56:09  pbi
# - enhanced Packet.summary() code
#
# Revision 1.0.0.12  2005/08/16 16:53:31  pbi
# - keep tcp/udp ports numeric in traceroute result
#
# Revision 1.0.0.11  2005/08/15 09:27:45  pbi
# - added NTP.mysummary()
#
# Revision 1.0.0.10  2005/08/15 09:18:56  pbi
# - fixed Ether.summary() (P. Lalet)
#
# Revision 1.0.0.9  2005/08/10 22:18:25  pbi
# - moved code to build answering machines' functions into a metaclass
#
# Revision 1.0.0.8  2005/08/10 20:05:45  pbi
# - added MobileIP protocol (rfc3344 and friends) (B. Andersson)
#
# Revision 1.0.0.7  2005/08/10 20:01:56  pbi
# - changed Ether.mysummary() (P. Lalet)
# - Update of Sebek protocols (P. Lalet)
#
# Revision 1.0.0.6  2005/08/10 19:53:19  pbi
# - fix problem in declaraion of answering machine functions
#
# Revision 1.0.0.5  2005/08/10 15:43:03  pbi
# - added resolution of numbers from /etc/ethertypes, /etc/protocols and
#   /etc/services (P. Lalet)
# - tweaked some mysummary() accordingly
#
# Revision 1.0.0.4  2005/08/10 14:48:06  pbi
# - Better netstat parsing for OpenBSD (P. Lalet)
#
# Revision 1.0.0.3  2005/08/10 14:41:21  pbi
# - fixed regression introduced by previous patch : Gen and Packet are not
#   classes anymore but types.
#
# Revision 1.0.0.2  2005/08/09 21:40:57  pbi
# - added ChangeDefaultValues metaclass to easily make a variant of a protocol
#
# Revision 1.0.0.1  2005/08/09 18:30:10  pbi
# Release 1.0.0
#
# Revision 1.0  2005/08/09 18:26:09  pbi
# 1.0 release
#
# Revision 0.9.17.110  2005/08/09 18:19:17  pbi
# - nothing
#
# Revision 0.9.17.109  2005/08/08 13:57:16  pbi
# - replaced use of __builtins__ by globals()
# - promiscuous mode is now default mode
# - added HTML color theme
#
# Revision 0.9.17.108  2005/08/05 14:12:48  pbi
# - fix: IP fragmentation offset needs to be 0 for payload to be decoded
#   (actually fixed in 0.9.17.106)
#
# Revision 0.9.17.107  2005/08/05 14:04:03  pbi
# - added 'filter' parameter to PacketList.padding()
# - added PacketList.nzpadding() method
# - added 'lfilter' parameter to sniff()
#
# Revision 0.9.17.106  2005/08/05 14:02:19  pbi
# - removed scapy module reloading to prepare interactive mode
# - tweaked interact() function, now fully functionnal
#
# Revision 0.9.17.105  2005/07/20 16:24:06  pbi
# - small fix nmap database class
#
# Revision 0.9.17.104  2005/07/20 16:22:51  pbi
# - modified Packet.guess_payload_class() semantic : added the payload as parameter
# - fixed TCP.answers() to take in account length of payload
# - added timeout arg to arping()
#
# Revision 0.9.17.103  2005/06/07 10:18:27  pbi
# - added a try/catch for get_if_hw_addr
# - fixed the netstat parsing for OpenBSD
# - changed Dot11WEP's key ID field from "key" to "keyid"
#
# Revision 0.9.17.102  2005/06/07 09:54:51  pbi
# - added LEShortEnumField
# - added L2CAP layer
# - added Bluetooth supersocket
# - added srbt() and srbt1()
#
# Revision 0.9.17.101  2005/05/30 17:21:48  pbi
# - Fixes for 0.9.17.100
#
# Revision 0.9.17.100  2005/05/30 17:08:41  pbi
# - added NetBIOS, SMB & Co support (Sebastien Chenevot & Sylvain Sarmejeanne)
#
# Revision 0.9.17.99  2005/05/28 14:28:40  pbi
# - WEP support and ICV computation
#
# Revision 0.9.17.98  2005/05/27 23:05:35  pbi
# -fixed a smlal bug in graphic traceroute
#
# Revision 0.9.17.97  2005/05/27 19:53:04  pbi
# - added WEP ciphering to Dot11WEP
#
# Revision 0.9.17.96  2005/05/25 15:15:10  pbi
# - ability to give a WEP key as an argument to unwep()
#
# Revision 0.9.17.95  2005/05/25 15:05:03  pbi
# - fixed pcap supersockets warnings
#
# Revision 0.9.17.94  2005/05/25 15:01:24  pbi
# - fixed/cleaned ISAKMP
#
# Revision 0.9.17.93  2005/05/25 15:00:34  pbi
# - fixed Packet.remove_underlayer() args
# - fixed FieldLenField
# - added Atheros Prism Header linktype
#
# Revision 0.9.17.92  2005/05/18 16:59:32  pbi
# - some voip_play() stuff
#
# Revision 0.9.17.91  2005/05/18 16:59:01  pbi
# - added BIOCIMMEDIATE option to fix BSD's BPF/pcap/select() behaviour issues
# - made PCAP/DNET the default mode, even for Linux (it seems quicker)
#
# Revision 0.9.17.90  2005/05/18 16:57:07  pbi
# - purge ARP cache when changing IP address of an interface
# - fixed loopback interface detection get_if_raw_hwaddr() for dnet
# - changed a bit Dot11PacketList behaviour
# - fixed build() overload by EAP class
# - fixed close()/recv() mix up in L2pcapListenSocket
#
# Revision 0.9.17.89  2005/05/03 19:18:22  pbi
# - DNET/PCAP stuff reordering
#
# Revision 0.9.17.88  2005/05/03 00:10:12  pbi
# - made Padding not be seen as a payload
#
# Revision 0.9.17.87  2005/04/29 22:37:39  pbi
# - added L2 recognition for L2pcapListenSocket
# - workarround for a bug in libpcap/wrapper?. .next() sometimes returns None
# - added consistant get_if_addr() and get_if_raw_addr()
# - added ifadd(), ifdel() and ifchange() methods to Route class
#
# Revision 0.9.17.86  2005/04/27 21:14:24  pbi
# - small code cleaning
#
# Revision 0.9.17.85  2005/04/27 13:53:32  pbi
# - early BSD port with libdnet and libpcap wrappers
#
# Revision 0.9.17.84  2005/04/24 14:57:45  pbi
# - added a usable geolocation database from GeoIP.
#
# Revision 0.9.17.83  2005/04/24 10:34:57  pbi
# - fixed fragment() (Peter Hardy)
#
# Revision 0.9.17.82  2005/04/23 15:29:21  pbi
# - fixed sndrcv() when given an empty set of packets
#
# Revision 0.9.17.81  2005/04/23 13:55:32  pbi
# - Some Sebek layers fixes (Pierre Lalet)
#
# Revision 0.9.17.80  2005/04/23 13:43:16  pbi
# - Early IrDA support (Pierre Lalet)
#
# Revision 0.9.17.79  2005/04/23 13:42:34  pbi
# - fixed SebekV1 and SebekV2 (Pierre Lalet)
#
# Revision 0.9.17.78  2005/04/23 13:41:33  pbi
# - fixed BitField (Pierre Lalet)
#
# Revision 0.9.17.77  2005/04/23 13:36:15  pbi
# - added threshold for warnings
#
# Revision 0.9.17.76  2005/04/23 11:27:51  pbi
# - Renamed SndRcvAns into SndRcvList
#
# Revision 0.9.17.75  2005/04/23 11:26:12  pbi
# - added color display in srloop()
#
# Revision 0.9.17.74  2005/04/22 13:30:10  pbi
# - fixed dhcp_request()
# - changed make_table semantic : take one lambda instead of 3
# - fixed import_hexcap()
# - fixed StrLenField
# - changed traceroute() and arping() to also return unanswered packets
# - ls() now sorts its output alphabetically
# - LaTeX color theme for straight copy/paste into your doc.
#
# Revision 0.9.17.73  2005/04/15 15:56:08  pbi
# - fixed ARP.answers()' return value
# - made TracerouteResult.graph() use both ASN information source
#
# Revision 0.9.17.72  2005/04/09 22:25:23  pbi
# - fix route.route() to handle extended IP sets (ex. 192.168.*.1-5)
# - generalised statistics in packet lists
# - added Dot11PacketList()
# - added some DHCP options
# - fixes in DHCP options building
# - modified unwep() to decrypt a WEP packet if it was not already done
#
# Revision 0.9.17.71  2005/04/06 10:49:11  pbi
# - forgotten debug msg in Net()
#
# Revision 0.9.17.70  2005/04/04 17:58:15  pbi
# - modified Net() to recognize things like 172.16.*.1-10
#
# Revision 0.9.17.69  2005/04/04 14:24:00  pbi
# - fix DHCP
# - added dhcp_request()
#
# Revision 0.9.17.68  2005/03/28 22:18:04  pbi
# - first attempt with time skew graphing
#
# Revision 0.9.17.67  2005/03/28 22:17:44  pbi
# - use gzip compression for load_object/save_object
# - made RandNum() and Emph() pickable
# - changed prompt color in default color theme
#
# Revision 0.9.17.66  2005/03/28 14:30:01  pbi
# - more DHCP work
#
# Revision 0.9.17.65  2005/03/28 14:29:03  pbi
# - first attempt to generate libnet C code from a packet
#
# Revision 0.9.17.64  2005/03/28 14:28:20  pbi
# - forgot to delete temporary variables in scapy's global scope
#
# Revision 0.9.17.63  2005/03/28 14:22:38  pbi
# - added colors, color themes, colored prompt
#
# Revision 0.9.17.62  2005/03/24 16:19:33  pbi
# - made it possible to use a PacketList as a parameter for send* or sr*
#
# Revision 0.9.17.61  2005/03/23 18:27:06  pbi
# - used init_cookie for ISAKMP.answers()
# - raised an exception in route.make_route if parameters are incomplete
#
# Revision 0.9.17.60  2005/03/23 17:07:56  pbi
# - fixed session loading with -s
# - prevented save_session() to trash current session
# - changed AnsweringMachine to make send_reply() a bit more generic
#
# Revision 0.9.17.59  2005/03/22 16:52:44  pbi
# - added _elt2show() to PacketList
# - changed PacketList.show() to use _elt2show()
#
# Revision 0.9.17.58  2005/03/22 16:21:39  pbi
# - added conversation() to PacketList
# - added padding() to PacketList
# - fixed StrNullField
# - added haslayer_str() to Packet
# - changed Packet.sprintf() to use haslayer_str
# - changed answers() to ask payload if same class as other
# - add count parameter to rdpcap
#
# Revision 0.9.17.57  2005/03/16 14:18:28  pbi
# - added StrNullField
#
# Revision 0.9.17.56  2005/03/14 18:14:28  pbi
# - LLNumTypes fix
# - Added linktype recognition to PcapWriter class
#
# Revision 0.9.17.55  2005/03/14 17:59:23  pbi
# - indentation cosmetic fix
#
# Revision 0.9.17.54  2005/03/14 17:53:56  pbi
# - wrpcap() now writes the correct linktype in the pcap file
#
# Revision 0.9.17.53  2005/03/14 17:22:23  pbi
# - added ISAKMP transforms decoding
#
# Revision 0.9.17.52  2005/03/14 16:40:58  pbi
# - added ikescan()
# - added ISAKMPTransformField
# - fixed PacketList's private methods names do begin only with one "_"
#
# Revision 0.9.17.51  2005/03/14 13:03:11  pbi
# - added a prn parameter to PacketList's summary() and nsummary()
#
# Revision 0.9.17.50  2005/03/14 12:56:24  pbi
# - make internal methods of PacketResult begins with __
#
# Revision 0.9.17.49  2005/03/14 12:52:41  pbi
# - Deprecated display() method (for all objects). Use show() instead.
#
# Revision 0.9.17.48  2005/03/14 12:48:29  pbi
# - Modified PacketField to stop at Padding instead of Raw
# - Added PacketLenField
# - More ISAKMP rework. Almost working.
#
# Revision 0.9.17.47  2005/03/14 10:20:49  pbi
# - added unwep() method to Dot11 packets
# - fixed 4 missing bytes in Dot11WEP
#
# Revision 0.9.17.46  2005/03/08 17:56:49  pbi
# - added a possibility to give a hint for srp() to choose the intended interface
# - added is_promisc() to find boxes in promisc mode (will not always work) (Javier Merino)
#
# Revision 0.9.17.45  2005/03/08 17:21:14  pbi
# - added PacketField
# - ISAKMP work
#
# Revision 0.9.17.44  2005/03/06 17:50:06  pbi
# - changed PCAP and DNET defaults
#
# Revision 0.9.17.43  2005/03/03 17:15:26  pbi
# - ISAKMP work
#
# Revision 0.9.17.42  2005/03/02 18:09:00  pbi
# - added make_world_trace() method to TracerouteResult for a xtraceroute-like
#
# Revision 0.9.17.41  2005/02/20 22:33:55  pbi
# - Sebek protocol definitions enhancements (Pierre Lalet)
#
# Revision 0.9.17.40  2005/02/20 22:31:49  pbi
# - added ARP answering machine (farpd) (Pierre Lalet)
#
# Revision 0.9.17.39  2005/02/20 22:22:23  pbi
# - Graphic traceroute enhanced to cope with TCP, UDP, ICMP or other traceroutes
# - ASN clustering in graphic traceroute can be controlled with the "ASN" parameter
#
# Revision 0.9.17.38  2005/02/18 21:03:26  pbi
# - MGCP  early support
# - RandString()
#
# Revision 0.9.17.37  2005/02/10 22:33:13  pbi
# - export_object()/import_object() to copy/paste base64 gzipped pickled objects
# - prevent save_session from deleting unpicklable objects
# - added hexdump() and hexraw() methods to PacketList object
# - Raw packet answers any Raw packet
# - added conf.checkIPaddr to recognize broadcast replies (BOOTP/DHCP)
#
# Revision 0.9.17.36  2005/02/02 22:39:48  pbi
# - added GPRS dummy packet class
#
# Revision 0.9.17.35  2005/01/29 00:29:25  pbi
# - added l4 parameter to traceroute() for UDP, ICMP and other layer 4 traceroutes
# - tweaked TracerouteResult display()
#
# Revision 0.9.17.34  2005/01/26 23:43:19  pbi
# - removed some outdated functions
#
# Revision 0.9.17.33  2005/01/26 23:41:58  pbi
# - small simplification of TracerouteResult display() thanks to new sprintf()
#   conditionnal statement
#
# Revision 0.9.17.32  2005/01/26 23:12:59  pbi
# - added conditionnal statements in format strings
#
# Revision 0.9.17.31  2005/01/26 22:30:36  pbi
# - removed an uneeded "else" in  sprintf()
#
# Revision 0.9.17.30  2005/01/22 22:25:24  pbi
# - re-added node coloring lost code line in traceroute graphing code
#
# Revision 0.9.17.29  2005/01/22 21:48:55  pbi
# - fixed need for warning() before it was declared
#
# Revision 0.9.17.28  2005/01/22 21:47:11  pbi
# - added ARPingResult to handle arping() results
# - moved ARPing displaying logic to ARPing object
#
# Revision 0.9.17.27  2005/01/22 21:42:59  pbi
# - added args todo_graph()
# - added TracerouteResults object to handle traceroute results
# - moved traceroute displaying logic to TracerouteResult object
# - moved traceroute graphing logic to TracerouteResult object
#
# Revision 0.9.17.26  2005/01/20 22:59:07  pbi
# - graph_traceroute : added AS clustering, colors, tweaks
#
# Revision 0.9.17.25  2005/01/17 22:10:58  pbi
# - added do_graph() to draw GraphViz graphs using SVG output, displayed with ImageMagick
# - added graph_traceroute() to make a graph from multiple traceroutes
# - added timeout parameter to traceroute()
#
# Revision 0.9.17.24  2005/01/13 14:25:00  pbi
# - added Sebek v1 and v2 protocols (Pierre Lalet)
#
# Revision 0.9.17.23  2005/01/10 21:55:14  pbi
# - addded promisc and iface parameters to L3RawSocket
#
# Revision 0.9.17.22  2004/12/26 18:07:43  pbi
# - Improved PacketList with stability by addition and slicing
# - Added plot() to PacketList using Gnuplot
# - Added StrStopField
# - Added conf.debug_disssector to prevent dissector's exception from being catched
# - Added CookedLinux packet type
# - Show linktype number when it is unknown
#
# Revision 0.9.17.21  2004/12/26 16:04:57  pbi
# - removed strace in soxmix command line
# - DHCP support (from Mattias Wadman)
# - added missing make_table to PacketList class
# - have UDP class asks its payload for answers()
#
# Revision 0.9.17.20  2004/12/01 17:13:28  pbi
# - Early WEP support
# - voip_play() tweaks
# - Added LEShortField for Dot11 SC field
#
# Revision 0.9.17.19  2004/10/18 13:42:50  pbi
# - HSRP early support
# - Cisco CSSP Skinny early support
# - added Little Endian IntEnumField
# - added filter() method to PacketList
# - some voip_play() work
# - loop parameter value in send*() is used as the time to sleep between 2 loops
#
# Revision 0.9.17.18  2004/09/21 21:45:20  pbi
# - added recv() method to PcapReader to emulate a SuperSocket
# - added "offline" parameter to sniff() to use sniff on pcap files
# - removed voip_play_offline() and renamed voip_play_sniff() to voip_play()
#   which is now available to play offline
#
# Revision 0.9.17.17  2004/09/21 21:32:41  pbi
# - added early PPPoE support (Ralf Ertzinger)
# - fixed DNS summary() to handle empty queries or answers
#
# Revision 0.9.17.16  2004/09/21 14:58:15  pbi
# - added VOIP playing functions (not tested)
#
# Revision 0.9.17.15  2004/09/17 22:00:47  pbi
# - transfert traceroute() and arping() options to sndrcv() ("retry", etc.)
# - fixed retry option in sndrcv()
# - tweaked AnweringMachine class
# - rewrited airpwn to use AnsweringMachine
#
# Revision 0.9.17.14  2004/09/13 16:57:01  pbi
# - added loopback routing
#
# Revision 0.9.17.13  2004/09/12 21:44:45  pbi
# - AnsweringMachine working as I wanted!
#
# Revision 0.9.17.12  2004/09/10 16:54:46  pbi
# - AnsweringMachine twaking
# - added DNS spoofing answering machine
#
# Revision 0.9.17.11  2004/09/08 13:42:38  pbi
# - renamed  ScapyPcapWriter class to PcapWriter
# - added linktype parameter to PcapWriter (William McVey)
# - added PcapReader class (William McVey)
#
# Revision 0.9.17.10  2004/09/08 13:06:01  pbi
# - added some text correspondances to Radius code field
#
# Revision 0.9.17.9  2004/09/06 14:28:02  pbi
# - early radius support
#
# Revision 0.9.17.8  2004/09/06 14:17:11  pbi
# - added "store" parameter to sniff()
# - added AnsweringMachine class to handle request/response protocols
# - replaced bootpd by a AnsweringMachine subclass
# - created DHCP answering machine draft
#
# Revision 0.9.17.7  2004/09/03 22:11:35  pbi
# - finished airpwn()
#
# Revision 0.9.17.6  2004/08/13 16:49:51  pbi
# - added first version of airpwn() clone
#
# Revision 0.9.17.5  2004/08/11 15:25:08  pbi
# - added RIP protocol
#
# Revision 0.9.17.4  2004/08/09 14:00:20  pbi
# - added gzip support to sessions saving
# - can force pickle protocol to inferior values for pickle backward compatility
#
# Revision 0.9.17.3  2004/08/07 10:59:34  pbi
# - fixed self reloading when launched from a different directory
# - fixed session reloading problems with PacketList() and SndRcvAns()
# - added load_session(), save_session(), update_session()
#
# Revision 0.9.17.2  2004/07/28 21:16:12  pbi
# - added nsummary() method to SndRcvList() class
#
# Revision 0.9.17.1  2004/07/26 19:52:55  pbi
# Release 0.9.17
#
# Revision 0.9.16.18  2004/07/26 19:50:16  pbi
# - added ScapyPcapWriter class (William McVey)
#
# Revision 0.9.16.17  2004/07/26 19:24:48  pbi
# - do not need to be named 'scapy.py' anymore
# - use of PacketList() for rdpcap() and sniff()
# - fixed a bug in StrFixedLenField
# - early IKE and ISAKMP support
#
# Revision 0.9.16.16  2004/07/16 15:39:37  pbi
# - small fix on bootpd
#
# Revision 0.9.16.15  2004/07/10 13:13:25  pbi
# - finished testing ethertype in supersockets to decide wether or not to apply BPF filters
#
# Revision 0.9.16.14  2004/07/10 13:06:38  pbi
# - do not apply any BPF filter if ethertype is given to a supersocket (so that ARP requests will work
#   whatever the conf.except_filter value is)
#
# Revision 0.9.16.13  2004/07/09 09:11:15  pbi
# - changed the header and blocked the licence to GPLv2 only
#
# Revision 0.9.16.12  2004/07/09 09:07:41  pbi
# - added an independant routing table (conf.route) and methods to manipulate it
# - tweaked results stats
#
# Revision 0.9.16.11  2004/07/05 22:43:49  pbi
# - wrapper classes for results presentations and manipulation
# - sndrcv() retry auto adjustment when giving a negative value
#
# Revision 0.9.16.10  2004/07/05 08:53:41  pbi
# - added retry option to sndrcv()
# - improved debug class
# - added ottl() and hops() methods for IPTools class
# - improved UDP and ICMP summary()
#
# Revision 0.9.16.9  2004/06/07 16:09:21  pbi
# - fix again TCP.answers() and TCPerror.answers()
#
# Revision 0.9.16.8  2004/06/07 16:06:27  pbi
# - fixed conf.checkIPsrc behaviour of answers() and hashret() for TCP/UDP/TCPerror/UDPerror
# - added conf.debug_match to keep track of unanswered packets in debug.sent and debug.recv
#
# Revision 0.9.16.7  2004/06/07 09:20:43  pbi
# - added LEIntField and StrFixedLenField
# - added partial PrismHeader support
#
# Revision 0.9.16.6  2004/04/29 15:46:19  pbi
# - fixed fragment()
#
# Revision 0.9.16.5  2004/03/31 09:24:43  pbi
# - fix nmap fingerprint db parsing to handle the new format (Jochen Bartl)
#
# Revision 0.9.16.4  2004/03/23 08:45:10  pbi
# - Support for reading big endian pcap files (Pekka Pietikainen)
#
# Revision 0.9.16.3  2004/02/28 11:12:12  pbi
# - got rid of some future warnings (N. Bareil <nbareil@mouarf.org>)
# - improved BitField() for arbitrary length bit fields (N. Bareil <nbareil@mouarf.org>)
# - NTP protocol (N. Bareil <nbareil@mouarf.org>)
#
# Revision 0.9.16.2  2004/02/22 17:49:51  pbi
# added first sketch of a bootp daemon: bootpd()
#
# Revision 0.9.16.1  2004/01/26 18:01:00  pbi
# Release 0.9.16
#
# Revision 0.9.15.15  2004/01/26 18:00:08  pbi
# - added more text for DNS codes
#
# Revision 0.9.15.14  2004/01/15 13:24:48  pbi
# - fixed the case where IP field is a list of nets
# - randomize IPID in traceroute() to work better with conf.checkIPsrc=0
# - added make_tex_table() and make_lined_table()
# - added IPID_count() to identify machines with their IPID
# - added sport and dport args to fragleak()
#
# Revision 0.9.15.13  2004/01/11 11:47:07  pbi
# - srploop() and srloop() improvements
#
# Revision 0.9.15.12  2004/01/11 01:28:21  pbi
# - srloop() and srploop() improvements
#
# Revision 0.9.15.11  2004/01/11 01:07:05  pbi
# - srloop() and srploop() improvements
#
# Revision 0.9.15.10  2004/01/10 23:42:58  pbi
# - added srloop() and srploop() functions
#
# Revision 0.9.15.9  2004/01/10 23:40:51  pbi
# - added
#
# Revision 0.9.15.8  2004/01/09 16:42:42  pbi
# - improved send() and sendp() with parameters loop and verbose
#
# Revision 0.9.15.7  2004/01/09 16:04:07  pbi
# - fixed ARP opcodes values
#
# Revision 0.9.15.6  2004/01/09 15:53:46  pbi
# - added RARP and IARP req/resp description in ARP operation Enum field
#
# Revision 0.9.15.5  2003/12/19 15:54:30  pbi
# - added checkIPID and checkIPsrc options in conf to recognize IP in ICMP errors from broken IP stacks (see conf.__doc__)
# - changed default TCP source port to 20 (Muahahahah!)
# - tweaked TCP summary
# - changed default UDP source and destination ports to 53
# - created import_hexcap() to copy-paste an hexcap from tcpdump -xX, and get a string to feed IP() or ARP() or whatever
# - created make_table() to present results in a table from a list, and functions that map the list to x,y and z=f(x,y).
#
# Revision 0.9.15.4  2003/10/30 16:11:41  pbi
# - little enhancements to the DNS packets
# - added dyndns_add() and dyndns_del() (rfc2136)
# - fixed a format string error (3 times)
#
# Revision 0.9.15.3  2003/10/16 10:41:42  biondi
# - redesign summary() method
# - fixed Dot11 addresses fields
#
# Revision 0.9.15.2  2003/10/15 14:41:09  biondi
# - caching format size (calcsize()) in Field main class
# - allow first packet desassembly to fail in SuperSockets, falling back to Raw
#
# Revision 0.9.15.1  2003/10/02 15:24:29  pbi
# Release 0.9.15
#
# Revision 0.9.14.8  2003/10/02 15:16:26  pbi
# - small fix for p0f_base
# - lazy loading for p0f, queso and nmap knowledge databases
#
# Revision 0.9.14.7  2003/10/02 14:14:17  pbi
# - added a LongField
# - added classes and bonds for 802.11
# - added error handling and magic checks for rdpcap()
#
# Revision 0.9.14.6  2003/09/12 14:45:35  pbi
# - had Dot11 working
#
# Revision 0.9.14.5  2003/09/12 10:04:05  pbi
# - added summary() method to Packet objects
#
# Revision 0.9.14.4  2003/09/12 09:28:28  pbi
# - added SNAP protocol
# - catched broken pipe exception when shild die in sndrcv()
# - fixed default L2socket type in srp() and srp1() (ETH_P_ALL)
# - fixed format string in attach_filter()
#
# Revision 0.9.14.3  2003/09/10 08:47:41  pbi
# - fixed the fact that bpf filters were generated in cooked mode, and thus did
#   not work
# - filter on socket type ETH_P_ARP instead of using a bpf filter for ARP replies
# - fixed the way of handling the SuperSocket close.
# - uniformised the naming for interface parameter : iface instead of iff
# - fixed the FutureWarning for long integers
# - fixed a typo in 3 format strings (%*i instead of %i)
#
# Revision 0.9.14.2  2003/07/20 00:12:04  pbi
# -added "-i any" for tcpdump to compile filters even if they don't work on main interface
# - put PPP special case before layer 2 general case in a super socket
# - added th filter parameter to L3RawSocket
# - added a special case in getmacbyip() when loopback interface is concernet
# - added value for RAWIP linktype in pcap capture files
#
# Revision 0.9.14.1  2003/06/25 13:18:23  pbi
# Release 0.9.14, from 0.9.13.4
#
# Revision 0.9.13.4  2003/06/25 12:35:57  pbi
# - fixed a regression in L3PacketSocket for ppp links
#
# Revision 0.9.13.3  2003/05/31 14:01:12  biondi
# - more tweaks on Packet.sprintf(). Added __doc__.
#
# Revision 0.9.13.2  2003/05/31 13:17:42  biondi
# - small tweaks in Packet.sprintf()
#
# Revision 0.9.13.1  2003/05/16 13:34:30  pbi
# Release 0.9.13
#
# Revision 0.9.12.9  2003/05/16 13:32:38  pbi
# - fixed verbose parameter in nmap_fp()
#
# Revision 0.9.12.8  2003/05/16 13:28:49  pbi
# - small enhancements in self-documentation
# - added early experiemental support for BOOTP and 802.11
#
# Revision 0.9.12.7  2003/05/16 11:25:48  pbi
# - added workarroung python bug 643005 (socket.inet_aton("255.255.255.255"))
# - use answers() method instead of operator
# - added hashret() method : returns a hash that is invariant for a packet and its reply
# - use hashret() in sndrcv() for dramatic improvements for matching replies on big set of packets
# - change report_ports() to return a string instead of printing
#
# Revision 0.9.12.6  2003/05/16 09:28:40  pbi
# - improved the __repr__() method of Packet class
#
# Revision 0.9.12.5  2003/05/12 15:15:02  pbi
# - added minttl parameter to traceroute()
#
# Revision 0.9.12.4  2003/05/06 13:39:21  pbi
# - Improved random number object (thanks to O. Poyen)
#
# Revision 0.9.12.3  2003/05/06 10:45:27  pbi
# - fixed a name overlap on "type" in L2ListenSocket and L3PacketSocket (thanks to E. M. Hopper)
#
# Revision 0.9.12.2  2003/05/06 10:41:58  pbi
# - externalized conversion from probes to signature with nmap_probes2sig() use probe results from, say, a pcap file
#
# Revision 0.9.12.1  2003/04/27 10:07:30  pbi
# Release 0.9.12
#
# Revision 0.9.11.5  2003/04/27 10:04:03  pbi
# - Fixed long int conversion in attach_filter()
#
# Revision 0.9.11.4  2003/04/27 10:00:57  pbi
# - rectification in SetGen to unroll Gen instances in lists
# - Completed DNS types and qtypes names
# - Small tuning in nmap_match_one_sig()
# - Parallelized nmap_sig()
#
# Revision 0.9.11.3  2003/04/24 12:47:49  pbi
# - removed 4 byte IP string autorecognition. Never used and broken for 4 byte names
# - added "islist" flag to fields to distinguish a list value from a list of values
# - changed TCP options from dict to list to preserve order and redundancy
# - added conf.except_filter, to have every command ignore your own traffic (BPF filter)
# - worked in progress for nmap OS fingerprint. Added PU test. Fixed other tests.
# - added nmap_sig2txt() to transform a signature to its text form, suitable for nmap base
#
# Revision 0.9.11.2  2003/04/23 21:23:30  pbi
# - small fixes in init_queso()
# - experimental support of nmap fingerprinting (not complete yet)
#
# Revision 0.9.11.1  2003/04/22 14:38:16  pbi
# Release 0.9.11
#
# Revision 0.9.10.8  2003/04/22 14:37:32  pbi
# - fixed bug in getmacbyip() using dnet module
# - deactivated getmacbyip() using dnet module because it did not resolve unknown IPs
# - added some commands listed by lsc()
#
# Revision 0.9.10.7  2003/04/22 13:55:01  pbi
# - some getattr/setattr/delattr enhancements
#
# Revision 0.9.10.6  2003/04/22 13:52:00  pbi
# - added experimental support for QueSO OS fingerprinting. Has someone a *recent* database ?
#
# Revision 0.9.10.5  2003/04/18 17:45:15  pbi
# - improved the completer to complete with protocol fields
# - small fix in get_working_if()
#
# Revision 0.9.10.4  2003/04/16 14:53:36  pbi
# - added option to include padding or not
#
# Revision 0.9.10.3  2003/04/16 14:35:32  pbi
# - added L2dnetSocket()
# - improved arping()
#
# Revision 0.9.10.2  2003/04/16 12:40:40  pbi
# - fixed the case when the history file does not exist
#
# Revision 0.9.10.1  2003/04/14 15:43:45  pbi
# Release 0.9.10
#
# Revision 0.9.9.15  2003/04/14 15:42:47  pbi
# - added L3pcapListenSocket
# - fixed L3ListenSocket to use ETH_P_ALL instead of ETH_P_IP by default
#
# Revision 0.9.9.14  2003/04/14 14:57:53  pbi
# - reworked L3dnetSocket
#
# Revision 0.9.9.13  2003/04/14 13:53:28  pbi
# - added completion (rlcompleter) and history support
#
# Revision 0.9.9.12  2003/04/14 10:05:42  pbi
# - bugfixed the close() method of some supersockets
#
# Revision 0.9.9.11  2003/04/13 21:41:01  biondi
# - added get_working_if()
# - use get_working_if() for default interface
#
# Revision 0.9.9.10  2003/04/12 23:33:42  biondi
# - add DNS layer (do not compress when assemble, answers() is missing)
#
# Revision 0.9.9.9  2003/04/12 22:15:40  biondi
# - added EnumField
# - used EnumField for ARP(), ICMP(), IP(), EAPOL(), EAP(),...
#
# Revision 0.9.9.8  2003/04/11 16:52:29  pbi
# - better integration of libpcap and libdnet, if available
#
# Revision 0.9.9.7  2003/04/11 15:49:31  pbi
# - some tweaks about supersockets close() and __del__() (not satisfied)
# - added L3dnetSocket, that use libdnet and libpcap if available
#
# Revision 0.9.9.6  2003/04/11 13:46:49  pbi
# - fixed a regression in bitfield dissection
# - tweaked and fixed a lot of small things arround supersockets
#
# Revision 0.9.9.5  2003/04/10 14:50:22  pbi
# - clean session only if it is to be saved
# - forgot to give its name to Padding class
# - fixed the NoPayload comparison tests so that they work on reloaded sessions
#
# Revision 0.9.9.4  2003/04/10 13:45:22  pbi
# - Prepared the configuration of L2/L3 supersockets
#
# Revision 0.9.9.3  2003/04/08 18:34:48  pbi
# - little fix in L2ListenSocket.__del__()
# - added doc and options in Conf class
# - added promisc support for L3PacketSocket, so that you can get answers to spoofed packets
#
# Revision 0.9.9.2  2003/04/08 17:42:19  pbi
# - added extract_padding() method to UDP
#
# Revision 0.9.9.1  2003/04/08 17:23:33  pbi
# Release 0.9.9
#
# Revision 0.9.8.9  2003/04/08 17:22:25  pbi
# - use cPickle instead of pickle (quicker and works with __getattr__() recursion)
# - small fixes on send() and sendp()
#
# Revision 0.9.8.8  2003/04/08 16:48:04  pbi
# - EAPOL overload Ether dst with PAE_GROUP_ADDR
# - tuning in ports_report()
# - tuning in fragleak
#
# Revision 0.9.8.7  2003/04/07 15:32:10  pbi
# - uses /usr/bin/env invocation
#
# Revision 0.9.8.6  2003/04/07 14:57:12  pbi
# - catch error during payload dissection and consider payload as raw data
#
# Revision 0.9.8.5  2003/04/07 14:43:13  pbi
# - srp() becomes srp1() and sr() equivalent for L2 is called srp()
# - hastype() Packet methods renamed to haslayer()
# - added getlayer() Packet method
# - added padding detection for layers that have a length field
# - added fragment() that fragment an IP packet
# - added report_ports() to scan a machine and output LaTeX report
#
# Revision 0.9.8.4  2003/04/01 11:19:06  pbi
# - added FlagsField(), used for TCP and IP
# - rfc3514 compliance
#
# Revision 0.9.8.3  2003/03/28 14:55:18  pbi
# Added pkt2uptime() : uses TCP timestamp to predict when the machine was booted
#
# Revision 0.9.8.2  2003/03/27 15:58:54  pbi
# - fixed sprintf() regression to use attributes from a packet that are not fields (eg: payload)
#
# Revision 0.9.8.1  2003/03/27 15:43:20  pbi
# Release 0.9.8
#
# Revision 0.9.7.9  2003/03/27 15:07:42  pbi
# - add filter support for sr(), sr1() and srp()
# - use filters for getmacbyip() and traceroute() for better reliability under heavy load
#
# Revision 0.9.7.8  2003/03/27 14:45:11  pbi
# - better timeout management in sndrcv
# - bugfixed sys.exit() imbrication issues
# - some self documentation
# - added lsc()command
#
# Revision 0.9.7.7  2003/03/26 17:51:33  pbi
# - Added IPTool class, to add commands like whois() to IP layer.
# - Have unknown class attributes be asked to payload before raising an exception.
#
# Revision 0.9.7.6  2003/03/26 17:35:36  pbi
# More powerful sprintf format string : %[fmt[r],][cls[:nb].]field% where fmt is a classic one, r can be
# appended for raw substitution (ex: IP.flags=0x18 instead of SA), nb is the number of the layer we want
# (ex: for IP/IP packets, IP:2.src is the src of the upper IP layer). Special case : "%.time" is the creation time.
# Ex : p.sprintf("%.time% %-15s,IP.src% -> %-15s,IP.dst% %IP.chksum% %03xr,IP.proto% %r,TCP.flags%")
#
# Revision 0.9.7.5  2003/03/26 14:47:39  pbi
# Added creation time packet. Supported by read/write pcap.
#
# Revision 0.9.7.4  2003/03/26 14:25:09  pbi
# Added the NoPayload terminal class
#
# Revision 0.9.7.3  2003/03/26 13:31:11  pbi
# Fixed RCS Id
#
# Revision 0.9.7.2  2003/03/26 13:30:05  pbi
# Adding RCS Id
#
#

