f1950c2fe1
Fixes #3289. This commit adds back the bit-struct library because in the end, it is useful for some modules, especially pello's. It's small and it has a nice license, so why not. After all, it /is/ useful for quicky application headers. Eventually, should be replaced by StructFu, but that requires some doc work on my part to get that transition in place. This also adds pello's DNS fuzzer module which makes use of BitStruct to create sometimes malformed-on-purpose DNS headers. Tested against 3 different DNS servers, caused one to reboot, so I'd say it works.
21 lines
553 B
Ruby
21 lines
553 B
Ruby
require 'bit-struct/char-field'
|
|
|
|
class BitStruct
|
|
# Class for char fields that can be accessed with values like
|
|
# "xx:xx:xx:xx", where each xx is up to 2 hex digits representing a
|
|
# single octet. The original string-based accessors are still available with
|
|
# the <tt>_chars</tt> suffix.
|
|
#
|
|
# Declared with BitStruct.hex_octets.
|
|
class HexOctetField < BitStruct::OctetField
|
|
# Used in describe.
|
|
def self.class_name
|
|
@class_name ||= "hex_octets"
|
|
end
|
|
|
|
SEPARATOR = ":"
|
|
FORMAT = "%02x"
|
|
BASE = 16
|
|
end
|
|
end
|