redhound 1.0.1 → 2.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -0
- data/README.md +97 -31
- data/docs/API.md +104 -0
- data/docs/FILTERS.md +37 -0
- data/docs/MIGRATION.md +23 -0
- data/docs/PROTOCOLS.md +54 -0
- data/docs/USAGE.md +86 -0
- data/docs/VALIDATION.md +175 -0
- data/docs/json-schema.json +64 -0
- data/exe/redhound +2 -1
- data/lib/redhound/analysis/flow_key.rb +59 -0
- data/lib/redhound/analysis/flow_table.rb +124 -0
- data/lib/redhound/analysis/ip_reassembler.rb +209 -0
- data/lib/redhound/analysis/stats.rb +150 -0
- data/lib/redhound/analysis/tcp_analysis.rb +43 -0
- data/lib/redhound/analysis/tcp_reassembler.rb +176 -0
- data/lib/redhound/analysis/tcp_stream.rb +156 -0
- data/lib/redhound/analysis.rb +157 -0
- data/lib/redhound/capture/bsd/bpf_device.rb +155 -0
- data/lib/redhound/capture/bsd/constants.rb +29 -0
- data/lib/redhound/capture/bsd/ifreq.rb +41 -0
- data/lib/redhound/capture/file_source.rb +214 -0
- data/lib/redhound/capture/interface.rb +70 -0
- data/lib/redhound/capture/linktype.rb +30 -0
- data/lib/redhound/capture/linux/constants.rb +37 -0
- data/lib/redhound/capture/linux/cooked.rb +18 -0
- data/lib/redhound/capture/linux/ifreq.rb +42 -0
- data/lib/redhound/capture/linux/packet_socket.rb +224 -0
- data/lib/redhound/capture/linux/sockaddr_ll.rb +33 -0
- data/lib/redhound/capture/linux/tpacket_v3.rb +137 -0
- data/lib/redhound/capture/source.rb +79 -0
- data/lib/redhound/capture/stats.rb +22 -0
- data/lib/redhound/capture.rb +70 -0
- data/lib/redhound/cli/command.rb +42 -0
- data/lib/redhound/cli/options.rb +133 -0
- data/lib/redhound/cli/privileges.rb +29 -0
- data/lib/redhound/cli/runner.rb +129 -0
- data/lib/redhound/context.rb +20 -0
- data/lib/redhound/cursor.rb +69 -0
- data/lib/redhound/diagnostic.rb +7 -0
- data/lib/redhound/dissector.rb +152 -0
- data/lib/redhound/engine.rb +69 -0
- data/lib/redhound/errors.rb +38 -0
- data/lib/redhound/field.rb +62 -0
- data/lib/redhound/file/format.rb +63 -0
- data/lib/redhound/file/pcap_reader.rb +43 -0
- data/lib/redhound/file/pcap_writer.rb +79 -0
- data/lib/redhound/file/pcapng_reader.rb +221 -0
- data/lib/redhound/file/pcapng_writer.rb +151 -0
- data/lib/redhound/file/rotating_writer.rb +98 -0
- data/lib/redhound/filter/analyzer.rb +197 -0
- data/lib/redhound/filter/bpf/assembler.rb +121 -0
- data/lib/redhound/filter/bpf/disassembler.rb +58 -0
- data/lib/redhound/filter/bpf/validator.rb +77 -0
- data/lib/redhound/filter/bpf/vm.rb +109 -0
- data/lib/redhound/filter/codegen.rb +413 -0
- data/lib/redhound/filter/lexer.rb +46 -0
- data/lib/redhound/filter/parser.rb +206 -0
- data/lib/redhound/filter/program.rb +55 -0
- data/lib/redhound/filter.rb +30 -0
- data/lib/redhound/layer.rb +75 -0
- data/lib/redhound/output/fields.rb +20 -0
- data/lib/redhound/output/follow.rb +64 -0
- data/lib/redhound/output/hexdump.rb +29 -0
- data/lib/redhound/output/json.rb +32 -0
- data/lib/redhound/output/summary.rb +84 -0
- data/lib/redhound/output/timestamp.rb +34 -0
- data/lib/redhound/output/tree.rb +25 -0
- data/lib/redhound/packet.rb +77 -0
- data/lib/redhound/protocols/arp.rb +39 -0
- data/lib/redhound/protocols/checksum.rb +38 -0
- data/lib/redhound/protocols/data.rb +23 -0
- data/lib/redhound/protocols/dhcp.rb +140 -0
- data/lib/redhound/protocols/dns.rb +268 -0
- data/lib/redhound/protocols/ethernet.rb +24 -0
- data/lib/redhound/protocols/http.rb +185 -0
- data/lib/redhound/protocols/icmp.rb +205 -0
- data/lib/redhound/protocols/ipv4.rb +56 -0
- data/lib/redhound/protocols/ipv6.rb +68 -0
- data/lib/redhound/protocols/link.rb +70 -0
- data/lib/redhound/protocols/llc.rb +37 -0
- data/lib/redhound/protocols/ntp.rb +45 -0
- data/lib/redhound/protocols/tcp.rb +88 -0
- data/lib/redhound/protocols/tls.rb +218 -0
- data/lib/redhound/protocols/tunnel.rb +48 -0
- data/lib/redhound/protocols/udp.rb +32 -0
- data/lib/redhound/protocols/vlan.rb +23 -0
- data/lib/redhound/reader.rb +8 -0
- data/lib/redhound/registry.rb +64 -0
- data/lib/redhound/stream_dissector.rb +168 -0
- data/lib/redhound/util/seq.rb +21 -0
- data/lib/redhound/version.rb +2 -1
- data/lib/redhound/writer.rb +25 -43
- data/lib/redhound.rb +81 -9
- data/sig/generated/redhound/analysis/flow_key.rbs +15 -0
- data/sig/generated/redhound/analysis/flow_table.rbs +102 -0
- data/sig/generated/redhound/analysis/ip_reassembler.rbs +52 -0
- data/sig/generated/redhound/analysis/stats.rbs +80 -0
- data/sig/generated/redhound/analysis/tcp_analysis.rbs +15 -0
- data/sig/generated/redhound/analysis/tcp_reassembler.rbs +39 -0
- data/sig/generated/redhound/analysis/tcp_stream.rbs +60 -0
- data/sig/generated/redhound/analysis.rbs +38 -0
- data/sig/generated/redhound/capture/bsd/bpf_device.rbs +39 -0
- data/sig/generated/redhound/capture/bsd/constants.rbs +40 -0
- data/sig/generated/redhound/capture/bsd/ifreq.rbs +15 -0
- data/sig/generated/redhound/capture/file_source.rbs +67 -0
- data/sig/generated/redhound/capture/interface.rbs +53 -0
- data/sig/generated/redhound/capture/linktype.rbs +20 -0
- data/sig/generated/redhound/capture/linux/constants.rbs +58 -0
- data/sig/generated/redhound/capture/linux/cooked.rbs +15 -0
- data/sig/generated/redhound/capture/linux/ifreq.rbs +18 -0
- data/sig/generated/redhound/capture/linux/packet_socket.rbs +64 -0
- data/sig/generated/redhound/capture/linux/sockaddr_ll.rbs +31 -0
- data/sig/generated/redhound/capture/linux/tpacket_v3.rbs +35 -0
- data/sig/generated/redhound/capture/source.rbs +44 -0
- data/sig/generated/redhound/capture/stats.rbs +25 -0
- data/sig/generated/redhound/capture.rbs +14 -0
- data/sig/generated/redhound/cli/command.rbs +12 -0
- data/sig/generated/redhound/cli/options.rbs +25 -0
- data/sig/generated/redhound/cli/privileges.rbs +12 -0
- data/sig/generated/redhound/cli/runner.rbs +27 -0
- data/sig/generated/redhound/context.rbs +27 -0
- data/sig/generated/redhound/cursor.rbs +59 -0
- data/sig/generated/redhound/diagnostic.rbs +21 -0
- data/sig/generated/redhound/dissector.rbs +117 -0
- data/sig/generated/redhound/engine.rbs +23 -0
- data/sig/generated/redhound/errors.rbs +56 -0
- data/sig/generated/redhound/field.rbs +74 -0
- data/sig/generated/redhound/file/format.rbs +39 -0
- data/sig/generated/redhound/file/pcap_reader.rbs +19 -0
- data/sig/generated/redhound/file/pcap_writer.rbs +38 -0
- data/sig/generated/redhound/file/pcapng_reader.rbs +54 -0
- data/sig/generated/redhound/file/pcapng_writer.rbs +50 -0
- data/sig/generated/redhound/file/rotating_writer.rbs +42 -0
- data/sig/generated/redhound/filter/analyzer.rbs +42 -0
- data/sig/generated/redhound/filter/bpf/assembler.rbs +39 -0
- data/sig/generated/redhound/filter/bpf/disassembler.rbs +18 -0
- data/sig/generated/redhound/filter/bpf/validator.rbs +30 -0
- data/sig/generated/redhound/filter/bpf/vm.rbs +28 -0
- data/sig/generated/redhound/filter/codegen.rbs +101 -0
- data/sig/generated/redhound/filter/lexer.rbs +15 -0
- data/sig/generated/redhound/filter/parser.rbs +65 -0
- data/sig/generated/redhound/filter/program.rbs +48 -0
- data/sig/generated/redhound/filter.rbs +10 -0
- data/sig/generated/redhound/layer.rbs +81 -0
- data/sig/generated/redhound/output/fields.rbs +15 -0
- data/sig/generated/redhound/output/follow.rbs +21 -0
- data/sig/generated/redhound/output/hexdump.rbs +15 -0
- data/sig/generated/redhound/output/json.rbs +18 -0
- data/sig/generated/redhound/output/summary.rbs +21 -0
- data/sig/generated/redhound/output/timestamp.rbs +21 -0
- data/sig/generated/redhound/output/tree.rbs +15 -0
- data/sig/generated/redhound/packet.rbs +82 -0
- data/sig/generated/redhound/protocols/arp.rbs +15 -0
- data/sig/generated/redhound/protocols/checksum.rbs +15 -0
- data/sig/generated/redhound/protocols/data.rbs +17 -0
- data/sig/generated/redhound/protocols/dhcp.rbs +31 -0
- data/sig/generated/redhound/protocols/dns.rbs +42 -0
- data/sig/generated/redhound/protocols/ethernet.rbs +15 -0
- data/sig/generated/redhound/protocols/http.rbs +36 -0
- data/sig/generated/redhound/protocols/icmp.rbs +41 -0
- data/sig/generated/redhound/protocols/ipv4.rbs +15 -0
- data/sig/generated/redhound/protocols/ipv6.rbs +24 -0
- data/sig/generated/redhound/protocols/link.rbs +33 -0
- data/sig/generated/redhound/protocols/llc.rbs +15 -0
- data/sig/generated/redhound/protocols/ntp.rbs +17 -0
- data/sig/generated/redhound/protocols/tcp.rbs +25 -0
- data/sig/generated/redhound/protocols/tls.rbs +51 -0
- data/sig/generated/redhound/protocols/tunnel.rbs +24 -0
- data/sig/generated/redhound/protocols/udp.rbs +18 -0
- data/sig/generated/redhound/protocols/vlan.rbs +12 -0
- data/sig/generated/redhound/reader.rbs +7 -0
- data/sig/generated/redhound/registry.rbs +45 -0
- data/sig/generated/redhound/stream_dissector.rbs +44 -0
- data/sig/generated/redhound/util/seq.rbs +20 -0
- data/sig/generated/redhound/version.rbs +1 -0
- data/sig/generated/redhound/writer.rbs +6 -19
- data/sig/generated/redhound.rbs +18 -0
- data/sig/shims/io.rbs +7 -0
- data/sig/shims/process.rbs +3 -0
- metadata +177 -55
- data/CODE_OF_CONDUCT.md +0 -132
- data/Dockerfile +0 -7
- data/Rakefile +0 -15
- data/Steepfile +0 -4
- data/docker-compose.yml +0 -9
- data/lib/redhound/analyzer.rb +0 -34
- data/lib/redhound/builder/packet_mreq.rb +0 -56
- data/lib/redhound/builder/socket.rb +0 -35
- data/lib/redhound/builder.rb +0 -4
- data/lib/redhound/command.rb +0 -67
- data/lib/redhound/l2/ether.rb +0 -68
- data/lib/redhound/l2/protocol.rb +0 -33
- data/lib/redhound/l2.rb +0 -4
- data/lib/redhound/l3/arp.rb +0 -114
- data/lib/redhound/l3/base.rb +0 -49
- data/lib/redhound/l3/ipv4.rb +0 -95
- data/lib/redhound/l3/ipv6.rb +0 -69
- data/lib/redhound/l3/protocol.rb +0 -173
- data/lib/redhound/l3/resolver.rb +0 -30
- data/lib/redhound/l3.rb +0 -9
- data/lib/redhound/l4/base.rb +0 -31
- data/lib/redhound/l4/icmp.rb +0 -71
- data/lib/redhound/l4/resolver.rb +0 -28
- data/lib/redhound/l4/udp.rb +0 -63
- data/lib/redhound/l4.rb +0 -6
- data/lib/redhound/receiver.rb +0 -45
- data/lib/redhound/resolver.rb +0 -22
- data/lib/redhound/source/socket.rb +0 -18
- data/lib/redhound/source.rb +0 -3
- data/rbs_collection.lock.yaml +0 -20
- data/rbs_collection.yaml +0 -17
- data/sig/generated/redhound/analyzer.rbs +0 -14
- data/sig/generated/redhound/builder/packet_mreq.rbs +0 -39
- data/sig/generated/redhound/builder/socket.rbs +0 -24
- data/sig/generated/redhound/command.rbs +0 -19
- data/sig/generated/redhound/l2/ether.rbs +0 -41
- data/sig/generated/redhound/l2/protocol.rbs +0 -15
- data/sig/generated/redhound/l3/arp.rbs +0 -57
- data/sig/generated/redhound/l3/base.rbs +0 -28
- data/sig/generated/redhound/l3/ipv4.rbs +0 -53
- data/sig/generated/redhound/l3/ipv6.rbs +0 -38
- data/sig/generated/redhound/l3/protocol.rbs +0 -16
- data/sig/generated/redhound/l3/resolver.rbs +0 -16
- data/sig/generated/redhound/l4/base.rbs +0 -19
- data/sig/generated/redhound/l4/icmp.rbs +0 -33
- data/sig/generated/redhound/l4/resolver.rbs +0 -16
- data/sig/generated/redhound/l4/udp.rbs +0 -36
- data/sig/generated/redhound/receiver.rbs +0 -19
- data/sig/generated/redhound/resolver.rbs +0 -11
- data/sig/generated/redhound/source/socket.rbs +0 -13
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/ethernet.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Ethernet < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/http.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Http < StreamDissector
|
|
8
|
+
HEADER_LIMIT: ::Integer
|
|
9
|
+
|
|
10
|
+
TOKEN: ::Regexp
|
|
11
|
+
|
|
12
|
+
HEADERS: untyped
|
|
13
|
+
|
|
14
|
+
# @rbs (Context ctx, Cursor cursor) -> bool
|
|
15
|
+
def self.heuristic?: (Context ctx, Cursor cursor) -> bool
|
|
16
|
+
|
|
17
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
18
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs (Layer layer, String line, Integer offset, bool response) -> Integer
|
|
21
|
+
def start_line: (Layer layer, String line, Integer offset, bool response) -> Integer
|
|
22
|
+
|
|
23
|
+
# @rbs (Layer layer, String bytes, Integer pos, Integer ending) -> Hash[String, Array[String]]
|
|
24
|
+
def parse_headers: (Layer layer, String bytes, Integer pos, Integer ending) -> Hash[String, Array[String]]
|
|
25
|
+
|
|
26
|
+
# @rbs (Layer layer, String bytes, Integer pos) -> [String, Integer]
|
|
27
|
+
def chunked: (Layer layer, String bytes, Integer pos) -> [ String, Integer ]
|
|
28
|
+
|
|
29
|
+
# @rbs (Layer layer, String name, untyped value, Symbol type, Integer offset, Integer length) -> void
|
|
30
|
+
def put: (Layer layer, String name, untyped value, Symbol type, Integer offset, Integer length) -> void
|
|
31
|
+
|
|
32
|
+
# @rbs (Layer layer) -> String
|
|
33
|
+
def summary: (Layer layer) -> String
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/icmp.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Icmp < Dissector
|
|
8
|
+
TYPES: untyped
|
|
9
|
+
|
|
10
|
+
CODES: untyped
|
|
11
|
+
|
|
12
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
13
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
14
|
+
|
|
15
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
16
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
17
|
+
|
|
18
|
+
# @rbs (Layer layer) -> String
|
|
19
|
+
def summary: (Layer layer) -> String
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @api private
|
|
23
|
+
class Icmpv6 < Dissector
|
|
24
|
+
TYPES: untyped
|
|
25
|
+
|
|
26
|
+
CODES: untyped
|
|
27
|
+
|
|
28
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
29
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
30
|
+
|
|
31
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
32
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @api private
|
|
36
|
+
class Igmp < Dissector
|
|
37
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
38
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/ipv4.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Ipv4 < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/ipv6.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Ipv6 < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @api private
|
|
16
|
+
class Ipv6Ext < Dissector
|
|
17
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
18
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
21
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/link.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Sll < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
9
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# @api private
|
|
13
|
+
class Sll2 < Dissector
|
|
14
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
15
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# @api private
|
|
19
|
+
class Null < Dissector
|
|
20
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
21
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
22
|
+
|
|
23
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
24
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @api private
|
|
28
|
+
class Raw < Dissector
|
|
29
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
30
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/llc.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Llc < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/ntp.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Ntp < Dissector
|
|
8
|
+
MODES: untyped
|
|
9
|
+
|
|
10
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
11
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
12
|
+
|
|
13
|
+
# @rbs (Layer layer) -> String
|
|
14
|
+
def summary: (Layer layer) -> String
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/tcp.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Tcp < Dissector
|
|
8
|
+
FLAGS: untyped
|
|
9
|
+
|
|
10
|
+
FLAG_FIELDS: untyped
|
|
11
|
+
|
|
12
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
13
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
14
|
+
|
|
15
|
+
# @rbs (Cursor cursor, Layer layer, Integer hlen) -> void
|
|
16
|
+
def options: (Cursor cursor, Layer layer, Integer hlen) -> void
|
|
17
|
+
|
|
18
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
19
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
20
|
+
|
|
21
|
+
# @rbs (Layer layer) -> String
|
|
22
|
+
def summary: (Layer layer) -> String
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/tls.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Tls < StreamDissector
|
|
8
|
+
# @type ivar @ranges: Array[untyped]
|
|
9
|
+
# @api private
|
|
10
|
+
class BadLength < StandardError
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
CONTENT_TYPES: untyped
|
|
14
|
+
|
|
15
|
+
HANDSHAKES: untyped
|
|
16
|
+
|
|
17
|
+
# @rbs (Context ctx, Cursor cursor) -> bool
|
|
18
|
+
def self.heuristic?: (Context ctx, Cursor cursor) -> bool
|
|
19
|
+
|
|
20
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
21
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
22
|
+
|
|
23
|
+
# @rbs (Layer layer, Cursor cursor) -> void
|
|
24
|
+
def handshakes: (Layer layer, Cursor cursor) -> void
|
|
25
|
+
|
|
26
|
+
# @rbs (Layer layer, Cursor cursor, Integer type) -> void
|
|
27
|
+
def hello: (Layer layer, Cursor cursor, Integer type) -> void
|
|
28
|
+
|
|
29
|
+
# @rbs (Layer layer, Cursor cursor, Integer pos, bool client) -> void
|
|
30
|
+
def extensions: (Layer layer, Cursor cursor, Integer pos, bool client) -> void
|
|
31
|
+
|
|
32
|
+
# @rbs (Layer layer, Cursor cursor) -> void
|
|
33
|
+
def server_names: (Layer layer, Cursor cursor) -> void
|
|
34
|
+
|
|
35
|
+
# @rbs (Layer layer, Cursor cursor) -> void
|
|
36
|
+
def alpn: (Layer layer, Cursor cursor) -> void
|
|
37
|
+
|
|
38
|
+
# @rbs (Layer layer, Cursor cursor, bool client) -> void
|
|
39
|
+
def versions: (Layer layer, Cursor cursor, bool client) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs (Integer logical) -> Integer
|
|
42
|
+
def wire_offset: (Integer logical) -> Integer
|
|
43
|
+
|
|
44
|
+
# @rbs (Layer layer, String name, untyped value, Symbol type, Integer offset, Integer length, ?bool handshake) -> void
|
|
45
|
+
def put: (Layer layer, String name, untyped value, Symbol type, Integer offset, Integer length, ?bool handshake) -> void
|
|
46
|
+
|
|
47
|
+
# @rbs (Layer layer) -> String
|
|
48
|
+
def summary: (Layer layer) -> String
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/tunnel.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Gre < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @api private
|
|
16
|
+
class Vxlan < Dissector
|
|
17
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
18
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
21
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/udp.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Udp < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> void
|
|
9
|
+
def dissect: (Context ctx, Layer layer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
12
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
13
|
+
|
|
14
|
+
# @rbs (Layer layer) -> String
|
|
15
|
+
def summary: (Layer layer) -> String
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Generated from lib/redhound/protocols/vlan.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Protocols
|
|
6
|
+
# @api private
|
|
7
|
+
class Vlan < Dissector
|
|
8
|
+
# @rbs (Context ctx, Layer layer) -> untyped
|
|
9
|
+
def next_dissector: (Context ctx, Layer layer) -> untyped
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Generated from lib/redhound/registry.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# Protocol dispatch and per-session decode-as rules.
|
|
5
|
+
class Registry
|
|
6
|
+
# @rbs () -> Registry
|
|
7
|
+
# Shared registry populated by built-in and custom dissectors.
|
|
8
|
+
def self.default: () -> Registry
|
|
9
|
+
|
|
10
|
+
# Registered protocol identities and dispatch tables.
|
|
11
|
+
attr_reader protocols: untyped
|
|
12
|
+
|
|
13
|
+
# @rbs () -> void
|
|
14
|
+
# Create empty protocol dispatch tables.
|
|
15
|
+
def initialize: () -> void
|
|
16
|
+
|
|
17
|
+
# @rbs (String key, Integer value, untyped klass) -> void
|
|
18
|
+
# Register a class under a dispatch key and value.
|
|
19
|
+
def register: (String key, Integer value, untyped klass) -> void
|
|
20
|
+
|
|
21
|
+
# @rbs (untyped klass) -> void
|
|
22
|
+
# Register a protocol class by its declared identity.
|
|
23
|
+
def register_protocol: (untyped klass) -> void
|
|
24
|
+
|
|
25
|
+
# @rbs (String key, Integer value) -> untyped
|
|
26
|
+
# Look up a protocol class for a dispatch key and value.
|
|
27
|
+
def lookup: (String key, Integer value) -> untyped
|
|
28
|
+
|
|
29
|
+
# @rbs (String key, Integer src, Integer dst) -> untyped
|
|
30
|
+
# Resolve decode-as rules before registered low/high port dispatch.
|
|
31
|
+
def by_port: (String key, Integer src, Integer dst) -> untyped
|
|
32
|
+
|
|
33
|
+
# @rbs (Symbol parent, Context ctx, Cursor cursor) -> untyped
|
|
34
|
+
# Run registered transport heuristics on the bounded payload.
|
|
35
|
+
def heuristic: (Symbol parent, Context ctx, Cursor cursor) -> untyped
|
|
36
|
+
|
|
37
|
+
# @rbs (String rule) -> void
|
|
38
|
+
# Apply a transport-port override such as udp.port==8443,dns.
|
|
39
|
+
def decode_as: (String rule) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs () -> Registry
|
|
42
|
+
# Copy tables and overrides for an independent analysis session.
|
|
43
|
+
def copy: () -> Registry
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Generated from lib/redhound/stream_dissector.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# A stateful TCP dissector. Instances belong to one bidirectional flow.
|
|
5
|
+
# Override on_data/on_gap for custom stream protocols; built-in framing is
|
|
6
|
+
# shared with the packet dissectors so validation has one implementation.
|
|
7
|
+
class StreamDissector < Dissector
|
|
8
|
+
# @rbs (?registry: Registry, ?max_bytes: Integer) -> void
|
|
9
|
+
def initialize: (?registry: Registry, ?max_bytes: Integer) -> void
|
|
10
|
+
|
|
11
|
+
# @rbs (untyped stream, Integer direction, String data, Integer frame) -> Array[Layer]
|
|
12
|
+
def on_data: (untyped stream, Integer direction, String data, Integer frame) -> Array[Layer]
|
|
13
|
+
|
|
14
|
+
# @rbs (untyped stream, Integer direction, Integer length) -> Array[Layer]
|
|
15
|
+
def on_gap: (untyped stream, Integer direction, Integer length) -> Array[Layer]
|
|
16
|
+
|
|
17
|
+
# @rbs (untyped stream, Integer direction) -> Array[Layer]
|
|
18
|
+
def on_close: (untyped stream, Integer direction) -> Array[Layer]
|
|
19
|
+
|
|
20
|
+
# @rbs () -> Integer
|
|
21
|
+
def bytesize: () -> Integer
|
|
22
|
+
|
|
23
|
+
# @rbs (Integer direction, Integer length) -> Array[Integer]
|
|
24
|
+
def consume_origins: (Integer direction, Integer length) -> Array[Integer]
|
|
25
|
+
|
|
26
|
+
# @rbs (String bytes, ?tls_encrypted: bool, ?head_response: bool) -> Layer
|
|
27
|
+
def parse_pdu: (String bytes, ?tls_encrypted: bool, ?head_response: bool) -> Layer
|
|
28
|
+
|
|
29
|
+
# @rbs (String buffer, ?Integer direction, ?head_response: bool) -> Integer?
|
|
30
|
+
def pdu_length: (String buffer, ?Integer direction, ?head_response: bool) -> Integer?
|
|
31
|
+
|
|
32
|
+
# @rbs (String buffer, ?head_response: bool) -> Integer?
|
|
33
|
+
def http_length: (String buffer, ?head_response: bool) -> Integer?
|
|
34
|
+
|
|
35
|
+
# @rbs (untyped stream, Integer direction, String buffer) -> bool
|
|
36
|
+
def head_response?: (untyped stream, Integer direction, String buffer) -> bool
|
|
37
|
+
|
|
38
|
+
# @rbs (untyped stream, Integer direction, Layer layer) -> void
|
|
39
|
+
def record_http: (untyped stream, Integer direction, Layer layer) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs (String buffer, Integer direction) -> Integer?
|
|
42
|
+
def tls_length: (String buffer, Integer direction) -> Integer?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generated from lib/redhound/util/seq.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Redhound
|
|
4
|
+
# @api private
|
|
5
|
+
module Util
|
|
6
|
+
# @api private
|
|
7
|
+
module Seq
|
|
8
|
+
MOD: ::Integer
|
|
9
|
+
|
|
10
|
+
# @rbs (Integer a, Integer b) -> Integer
|
|
11
|
+
def self.diff: (Integer a, Integer b) -> Integer
|
|
12
|
+
|
|
13
|
+
# @rbs (Integer a, Integer b) -> bool
|
|
14
|
+
def self.lt: (Integer a, Integer b) -> bool
|
|
15
|
+
|
|
16
|
+
# @rbs (Integer a, Integer b) -> Integer
|
|
17
|
+
def self.signed_diff: (Integer a, Integer b) -> Integer
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
# Generated from lib/redhound/writer.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Redhound
|
|
4
|
+
# Open pcap/pcapng outputs, optionally with bounded rotation.
|
|
4
5
|
class Writer
|
|
5
|
-
# @rbs (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# @rbs (msg: String) -> void
|
|
12
|
-
def write: (msg: String) -> void
|
|
13
|
-
|
|
14
|
-
# @rbs () -> void
|
|
15
|
-
def stop: () -> void
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
# @rbs () -> String
|
|
20
|
-
def file_header: () -> String
|
|
21
|
-
|
|
22
|
-
# @rbs (Time timestamp, Integer captured_length, Integer original_length) -> String
|
|
23
|
-
def packet_record: (Time timestamp, Integer captured_length, Integer original_length) -> String
|
|
6
|
+
# @rbs (untyped output, ?linktype: Integer | Symbol | String, ?format: Symbol | String | nil, ?snaplen: Integer, ?precision: Symbol, ?packet_buffered: bool, ?forbidden_input: String?, **untyped options) -> untyped
|
|
7
|
+
# @rbs [T] (untyped output, ?linktype: Integer | Symbol | String, ?format: Symbol | String | nil, ?snaplen: Integer, ?precision: Symbol, ?packet_buffered: bool, ?forbidden_input: String?, **untyped options) { (untyped) -> T } -> T
|
|
8
|
+
# Open a path or binary IO; close automatically with a block. See docs/API.md for options.
|
|
9
|
+
def self.open: (untyped output, ?linktype: Integer | Symbol | String, ?format: Symbol | String | nil, ?snaplen: Integer, ?precision: Symbol, ?packet_buffered: bool, ?forbidden_input: String?, **untyped options) -> untyped
|
|
10
|
+
| [T] (untyped output, ?linktype: Integer | Symbol | String, ?format: Symbol | String | nil, ?snaplen: Integer, ?precision: Symbol, ?packet_buffered: bool, ?forbidden_input: String?, **untyped options) { (untyped) -> T } -> T
|
|
24
11
|
end
|
|
25
12
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated from lib/redhound.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Capture, inspect and save network packets using Ruby standard libraries.
|
|
4
|
+
module Redhound
|
|
5
|
+
# @rbs (String bytes, ?linktype: (Integer | Symbol), **untyped metadata) -> Packet
|
|
6
|
+
# Create a packet with lazy, bounded protocol dissection. See docs/API.md.
|
|
7
|
+
def self.dissect: (String bytes, ?linktype: Integer | Symbol, **untyped metadata) -> Packet
|
|
8
|
+
|
|
9
|
+
# @rbs (untyped input, ?filter: String?) -> Reader
|
|
10
|
+
# @rbs [T] (untyped input, ?filter: String?) { (Reader) -> T } -> T
|
|
11
|
+
# Read a pcap/pcapng path or binary IO; a block closes the reader automatically.
|
|
12
|
+
def self.open: (untyped input, ?filter: String?) -> Reader
|
|
13
|
+
| [T] (untyped input, ?filter: String?) { (Reader) -> T } -> T
|
|
14
|
+
|
|
15
|
+
# @rbs (interface: String | Integer, ?count: Integer?, **untyped options) { (Packet) -> void } -> void
|
|
16
|
+
# Yield live packets until count is reached or capture stops; always close the source.
|
|
17
|
+
def self.capture: (interface: String | Integer, ?count: Integer?, **untyped options) { (Packet) -> void } -> void
|
|
18
|
+
end
|
data/sig/shims/io.rbs
ADDED