redhound 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -2
- data/Dockerfile +1 -1
- data/README.md +10 -1
- data/Rakefile +12 -1
- data/Steepfile +4 -0
- data/lib/redhound/analyzer.rb +19 -15
- data/lib/redhound/builder/packet_mreq.rb +56 -0
- data/lib/redhound/builder/socket.rb +35 -0
- data/lib/redhound/builder.rb +4 -0
- data/lib/redhound/command.rb +8 -2
- data/lib/redhound/l2/ether.rb +68 -0
- data/lib/redhound/l2/protocol.rb +33 -0
- data/lib/redhound/l2.rb +4 -0
- data/lib/redhound/l3/arp.rb +114 -0
- data/lib/redhound/l3/base.rb +49 -0
- data/lib/redhound/{header → l3}/ipv4.rb +27 -44
- data/lib/redhound/l3/ipv6.rb +69 -0
- data/lib/redhound/l3/protocol.rb +173 -0
- data/lib/redhound/l3/resolver.rb +30 -0
- data/lib/redhound/l3.rb +8 -0
- data/lib/redhound/l4/base.rb +31 -0
- data/lib/redhound/{header → l4}/icmp.rb +20 -26
- data/lib/redhound/l4/resolver.rb +28 -0
- data/lib/redhound/{header → l4}/udp.rb +19 -19
- data/lib/redhound/l4.rb +6 -0
- data/lib/redhound/receiver.rb +26 -6
- data/lib/redhound/resolver.rb +22 -0
- data/lib/redhound/source/socket.rb +18 -0
- data/lib/redhound/source.rb +3 -0
- data/lib/redhound/version.rb +2 -1
- data/lib/redhound/writer.rb +53 -0
- data/lib/redhound.rb +7 -3
- data/rbs_collection.lock.yaml +20 -0
- data/rbs_collection.yaml +17 -0
- data/sig/generated/redhound/analyzer.rbs +14 -0
- data/sig/generated/redhound/builder/packet_mreq.rbs +39 -0
- data/sig/generated/redhound/builder/socket.rbs +24 -0
- data/sig/generated/redhound/command.rbs +19 -0
- data/sig/generated/redhound/l2/ether.rbs +41 -0
- data/sig/generated/redhound/l2/protocol.rbs +15 -0
- data/sig/generated/redhound/l3/arp.rbs +57 -0
- data/sig/generated/redhound/l3/base.rbs +28 -0
- data/sig/generated/redhound/l3/ipv4.rbs +53 -0
- data/sig/generated/redhound/l3/ipv6.rbs +38 -0
- data/sig/generated/redhound/l3/protocol.rbs +16 -0
- data/sig/generated/redhound/l3/resolver.rbs +16 -0
- data/sig/generated/redhound/l4/base.rbs +19 -0
- data/sig/generated/redhound/l4/icmp.rbs +33 -0
- data/sig/generated/redhound/l4/resolver.rbs +16 -0
- data/sig/generated/redhound/l4/udp.rbs +36 -0
- data/sig/generated/redhound/receiver.rbs +19 -0
- data/sig/generated/redhound/resolver.rbs +11 -0
- data/sig/generated/redhound/source/socket.rbs +13 -0
- data/sig/generated/redhound/version.rbs +5 -0
- data/sig/generated/redhound/writer.rbs +25 -0
- metadata +49 -11
- data/lib/redhound/header/ether.rb +0 -68
- data/lib/redhound/header.rb +0 -6
- data/lib/redhound/packet_mreq.rb +0 -46
- data/lib/redhound/socket_builder.rb +0 -30
- data/sig/redhound.rbs +0 -4
data/lib/redhound/receiver.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# rbs_inline: enabled
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'socket'
|
@@ -5,21 +6,40 @@ require 'socket'
|
|
5
6
|
module Redhound
|
6
7
|
class Receiver
|
7
8
|
class << self
|
8
|
-
|
9
|
-
|
9
|
+
# @rbs (ifname: String, filename: String) -> void
|
10
|
+
def run(ifname:, filename:)
|
11
|
+
new(ifname:, filename:).run
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
# @rbs (ifname: String, filename: String) -> void
|
16
|
+
def initialize(ifname:, filename:)
|
14
17
|
@ifname = ifname
|
15
|
-
@
|
18
|
+
@source = Resolver.resolve(ifname:)
|
19
|
+
if filename
|
20
|
+
@writer = Writer.new(filename:)
|
21
|
+
@writer.start
|
22
|
+
end
|
23
|
+
@count = 0
|
16
24
|
end
|
17
25
|
|
26
|
+
# @rbs () -> void
|
18
27
|
def run
|
19
28
|
loop do
|
20
|
-
msg, = @
|
21
|
-
Analyzer.analyze(msg:)
|
29
|
+
msg, = @source.next_packet
|
30
|
+
Analyzer.analyze(msg:, count: increment)
|
31
|
+
@writer&.write(msg:)
|
32
|
+
rescue Interrupt
|
33
|
+
@writer&.stop
|
34
|
+
break
|
22
35
|
end
|
23
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# @rbs () -> Integer
|
41
|
+
def increment
|
42
|
+
@count.tap { @count += 1 }
|
43
|
+
end
|
24
44
|
end
|
25
45
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# rbs_inline: enabled
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Redhound
|
5
|
+
class Resolver
|
6
|
+
class << self
|
7
|
+
# @rbs (ifname: String) -> void
|
8
|
+
def resolve(ifname:)
|
9
|
+
new.resolve(ifname:)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# @rbs (ifname: String) -> Redhound::Source::Socket
|
14
|
+
def resolve(ifname:)
|
15
|
+
if RUBY_PLATFORM =~ /darwin/
|
16
|
+
raise 'Not implemented yet'
|
17
|
+
else
|
18
|
+
Redhound::Builder::Socket.build(ifname:)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# rbs_inline: enabled
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Redhound
|
5
|
+
module Source
|
6
|
+
class Socket
|
7
|
+
# @rbs (socket: ::Socket) -> void
|
8
|
+
def initialize(socket:)
|
9
|
+
@socket = socket
|
10
|
+
end
|
11
|
+
|
12
|
+
# @rbs (Integer size) -> [String, Addrinfo]
|
13
|
+
def next_packet(size = 2048)
|
14
|
+
@socket.recvfrom(size)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/redhound/version.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
# rbs_inline: enabled
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Redhound
|
5
|
+
class Writer
|
6
|
+
# @rbs (filename: String) -> void
|
7
|
+
def initialize(filename:)
|
8
|
+
@filename = filename
|
9
|
+
end
|
10
|
+
|
11
|
+
# @rbs () -> void
|
12
|
+
def start
|
13
|
+
@file = File.open(@filename, 'wb')
|
14
|
+
@file.write(file_header)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @rbs (msg: String) -> void
|
18
|
+
def write(msg:)
|
19
|
+
@file.write(packet_record(Time.now, msg.bytesize, msg.bytesize))
|
20
|
+
@file.write(msg)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @rbs () -> void
|
24
|
+
def stop
|
25
|
+
@file.close
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
# @rbs () -> String
|
31
|
+
def file_header
|
32
|
+
[
|
33
|
+
0xa1b2c3d4, # Magic Number (little-endian)
|
34
|
+
2, # Version Major
|
35
|
+
4, # Version Minor
|
36
|
+
0, # Timezone offset (GMT)
|
37
|
+
0, # Timestamp accuracy
|
38
|
+
65535, # Snapshot length
|
39
|
+
1 # Link-layer header type (Ethernet)
|
40
|
+
].pack('VvvVVVV')
|
41
|
+
end
|
42
|
+
|
43
|
+
# @rbs (Time timestamp, Integer captured_length, Integer original_length) -> String
|
44
|
+
def packet_record(timestamp, captured_length, original_length)
|
45
|
+
[
|
46
|
+
timestamp.to_i, # Timestamp seconds
|
47
|
+
timestamp.usec || 0, # Timestamp microseconds
|
48
|
+
captured_length, # Captured packet length
|
49
|
+
original_length # Original packet length
|
50
|
+
].pack('VVVV')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/redhound.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'redhound/analyzer'
|
4
|
+
require_relative 'redhound/builder'
|
4
5
|
require_relative 'redhound/command'
|
5
|
-
require_relative 'redhound/
|
6
|
-
require_relative 'redhound/
|
6
|
+
require_relative 'redhound/l2'
|
7
|
+
require_relative 'redhound/l3'
|
8
|
+
require_relative 'redhound/l4'
|
7
9
|
require_relative 'redhound/receiver'
|
8
|
-
require_relative 'redhound/
|
10
|
+
require_relative 'redhound/resolver'
|
11
|
+
require_relative 'redhound/source'
|
9
12
|
require_relative 'redhound/version'
|
13
|
+
require_relative 'redhound/writer'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
path: ".gem_rbs_collection"
|
3
|
+
gems:
|
4
|
+
- name: fileutils
|
5
|
+
version: '0'
|
6
|
+
source:
|
7
|
+
type: stdlib
|
8
|
+
- name: rake
|
9
|
+
version: '13.0'
|
10
|
+
source:
|
11
|
+
type: git
|
12
|
+
name: ruby/gem_rbs_collection
|
13
|
+
revision: f83c613ed7d038c0031f25fcbcdf12603ba36e79
|
14
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
15
|
+
repo_dir: gems
|
16
|
+
- name: socket
|
17
|
+
version: '0'
|
18
|
+
source:
|
19
|
+
type: stdlib
|
20
|
+
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Download sources
|
2
|
+
sources:
|
3
|
+
- type: git
|
4
|
+
name: ruby/gem_rbs_collection
|
5
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
6
|
+
revision: main
|
7
|
+
repo_dir: gems
|
8
|
+
|
9
|
+
# You can specify local directories as sources also.
|
10
|
+
# - type: local
|
11
|
+
# path: path/to/your/local/repository
|
12
|
+
|
13
|
+
# A directory to install the downloaded RBSs
|
14
|
+
path: .gem_rbs_collection
|
15
|
+
|
16
|
+
gems:
|
17
|
+
- name: socket
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Generated from lib/redhound/analyzer.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class Analyzer
|
5
|
+
# @rbs (msg: String, count: Integer) -> void
|
6
|
+
def self.analyze: (msg: String, count: Integer) -> void
|
7
|
+
|
8
|
+
# @rbs (msg: String, count: Integer) -> void
|
9
|
+
def initialize: (msg: String, count: Integer) -> void
|
10
|
+
|
11
|
+
# @rbs () -> void
|
12
|
+
def analyze: () -> void
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Generated from lib/redhound/builder/packet_mreq.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
module Builder
|
5
|
+
class PacketMreq
|
6
|
+
PACKET_MR_PROMISC: ::Integer
|
7
|
+
|
8
|
+
# @rbs (ifname: String) -> void
|
9
|
+
def initialize: (ifname: String) -> void
|
10
|
+
|
11
|
+
# see: https://man7.org/linux/man-pages/man7/packet.7.html
|
12
|
+
# struct packet_mreq {
|
13
|
+
# int mr_ifindex; /* interface index */
|
14
|
+
# unsigned short mr_type; /* action */
|
15
|
+
# unsigned short mr_alen; /* address length */
|
16
|
+
# unsigned char mr_address[8]; /* physical-layer address */
|
17
|
+
# };
|
18
|
+
# @rbs () -> String
|
19
|
+
def build: () -> String
|
20
|
+
|
21
|
+
# @rbs () -> String
|
22
|
+
def mr_ifindex: () -> String
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# @rbs () -> Integer?
|
27
|
+
def index: () -> Integer?
|
28
|
+
|
29
|
+
# @rbs () -> String
|
30
|
+
def mr_type: () -> String
|
31
|
+
|
32
|
+
# @rbs () -> String
|
33
|
+
def mr_alen: () -> String
|
34
|
+
|
35
|
+
# @rbs () -> String
|
36
|
+
def mr_address: () -> String
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated from lib/redhound/builder/socket.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
module Builder
|
5
|
+
class Socket
|
6
|
+
SOL_PACKET: ::Integer
|
7
|
+
|
8
|
+
PACKET_ADD_MEMBERSHIP: ::Integer
|
9
|
+
|
10
|
+
ETH_P_ALL: ::Integer
|
11
|
+
|
12
|
+
PACKED_ETH_P_ALL: untyped
|
13
|
+
|
14
|
+
# @rbs (ifname: String) -> Redhound::Source::Socket
|
15
|
+
def self.build: (ifname: String) -> Redhound::Source::Socket
|
16
|
+
|
17
|
+
# @rbs (ifname: String) -> void
|
18
|
+
def initialize: (ifname: String) -> void
|
19
|
+
|
20
|
+
# @rbs () -> Redhound::Source::Socket
|
21
|
+
def build: () -> Redhound::Source::Socket
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated from lib/redhound/command.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class Command
|
5
|
+
# @rbs () -> void
|
6
|
+
def initialize: () -> void
|
7
|
+
|
8
|
+
# @rbs (Array[untyped] argv) -> void
|
9
|
+
def run: (Array[untyped] argv) -> void
|
10
|
+
|
11
|
+
# @rbs (Array[untyped] argv) -> void
|
12
|
+
def parse: (Array[untyped] argv) -> void
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# @rbs () -> void
|
17
|
+
def list_interfaces: () -> void
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated from lib/redhound/l2/ether.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L2
|
5
|
+
class Ether
|
6
|
+
attr_reader type: Protocol
|
7
|
+
|
8
|
+
# @rbs (bytes: Array[Integer], count: Integer) -> Redhound::L2::Ether
|
9
|
+
def self.generate: (bytes: Array[Integer], count: Integer) -> Redhound::L2::Ether
|
10
|
+
|
11
|
+
# @rbs (bytes: Array[Integer], count: Integer) -> void
|
12
|
+
def initialize: (bytes: Array[Integer], count: Integer) -> void
|
13
|
+
|
14
|
+
# @rbs () -> Integer
|
15
|
+
def size: () -> Integer
|
16
|
+
|
17
|
+
# @rbs () -> Redhound::L2::Ether
|
18
|
+
def generate: () -> Redhound::L2::Ether
|
19
|
+
|
20
|
+
# @rbs () -> void
|
21
|
+
def dump: () -> void
|
22
|
+
|
23
|
+
# @rbs () -> String
|
24
|
+
def to_s: () -> String
|
25
|
+
|
26
|
+
# @rbs () -> bool
|
27
|
+
def supported_type?: () -> bool
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# @rbs () -> String
|
32
|
+
def dhost: () -> String
|
33
|
+
|
34
|
+
# @rbs () -> String
|
35
|
+
def shost: () -> String
|
36
|
+
|
37
|
+
# @rbs (Array[Integer] type) -> Integer
|
38
|
+
def hex_type: (Array[Integer] type) -> Integer
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Generated from lib/redhound/l2/protocol.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L2
|
5
|
+
class Protocol
|
6
|
+
PROTO_TABLE: ::Hash[untyped, untyped]
|
7
|
+
|
8
|
+
# @rbs (protocol: Integer) -> void
|
9
|
+
def initialize: (protocol: Integer) -> void
|
10
|
+
|
11
|
+
# @rbs () -> String
|
12
|
+
def to_s: () -> String
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated from lib/redhound/l3/arp.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Arp < Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> Redhound::L3::Arp
|
7
|
+
def self.generate: (bytes: Array[Integer]) -> Redhound::L3::Arp
|
8
|
+
|
9
|
+
# @rbs (bytes: Array[Integer]) -> void
|
10
|
+
def initialize: (bytes: Array[Integer]) -> void
|
11
|
+
|
12
|
+
# @rbs () -> Redhound::L3::Arp
|
13
|
+
def generate: () -> Redhound::L3::Arp
|
14
|
+
|
15
|
+
# @rbs () -> Integer
|
16
|
+
def arp_size: () -> Integer
|
17
|
+
|
18
|
+
# @rbs () -> Integer
|
19
|
+
def size: () -> Integer
|
20
|
+
|
21
|
+
# @rbs () -> String
|
22
|
+
def to_s: () -> String
|
23
|
+
|
24
|
+
# @rbs () -> bool
|
25
|
+
def supported_protocol?: () -> bool
|
26
|
+
|
27
|
+
# @rbs () -> String?
|
28
|
+
def protocol: () -> String?
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# @rbs () -> Integer
|
33
|
+
def htype: () -> Integer
|
34
|
+
|
35
|
+
# @rbs () -> Integer
|
36
|
+
def ptype: () -> Integer
|
37
|
+
|
38
|
+
# @rbs () -> Integer
|
39
|
+
def oper: () -> Integer
|
40
|
+
|
41
|
+
# @rbs () -> String
|
42
|
+
def sha: () -> String
|
43
|
+
|
44
|
+
# @rbs () -> String
|
45
|
+
def spa: () -> String
|
46
|
+
|
47
|
+
# @rbs () -> String
|
48
|
+
def tha: () -> String
|
49
|
+
|
50
|
+
# @rbs () -> String
|
51
|
+
def tpa: () -> String
|
52
|
+
|
53
|
+
# @rbs () -> Redhound::L3::Base?
|
54
|
+
def generate_l3: () -> Redhound::L3::Base?
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated from lib/redhound/l3/base.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> Redhound::L3::Base
|
7
|
+
def self.generate: (bytes: Array[Integer]) -> Redhound::L3::Base
|
8
|
+
|
9
|
+
# @rbs (bytes: Array[Integer]) -> void
|
10
|
+
def initialize: (bytes: Array[Integer]) -> void
|
11
|
+
|
12
|
+
# @rbs () -> Redhound::L3::Base
|
13
|
+
def generate: () -> Redhound::L3::Base
|
14
|
+
|
15
|
+
# @rbs () -> void
|
16
|
+
def dump: () -> void
|
17
|
+
|
18
|
+
# @rbs () -> Integer
|
19
|
+
def size: () -> Integer
|
20
|
+
|
21
|
+
# @rbs () -> bool
|
22
|
+
def supported_protocol?: () -> bool
|
23
|
+
|
24
|
+
# @rbs () -> Protocol
|
25
|
+
def protocol: () -> Protocol
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Generated from lib/redhound/l3/ipv4.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Ipv4 < Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> Redhound::L3::Ipv4
|
7
|
+
def self.generate: (bytes: Array[Integer]) -> Redhound::L3::Ipv4
|
8
|
+
|
9
|
+
attr_reader protocol: Protocol
|
10
|
+
|
11
|
+
# @rbs (bytes: Array[Integer]) -> void
|
12
|
+
def initialize: (bytes: Array[Integer]) -> void
|
13
|
+
|
14
|
+
# @rbs () -> Redhound::L3::Ipv4
|
15
|
+
def generate: () -> Redhound::L3::Ipv4
|
16
|
+
|
17
|
+
# @rbs () -> Integer
|
18
|
+
def size: () -> Integer
|
19
|
+
|
20
|
+
# @rbs () -> String
|
21
|
+
def to_s: () -> String
|
22
|
+
|
23
|
+
# @rbs () -> bool
|
24
|
+
def supported_protocol?: () -> bool
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# @rbs () -> Integer
|
29
|
+
def version: () -> Integer
|
30
|
+
|
31
|
+
# @rbs () -> Integer
|
32
|
+
def ihl: () -> Integer
|
33
|
+
|
34
|
+
# @rbs () -> Integer
|
35
|
+
def tot_len: () -> Integer
|
36
|
+
|
37
|
+
# @rbs () -> Integer
|
38
|
+
def id: () -> Integer
|
39
|
+
|
40
|
+
# @rbs () -> Integer
|
41
|
+
def frag_off: () -> Integer
|
42
|
+
|
43
|
+
# @rbs () -> Integer
|
44
|
+
def check: () -> Integer
|
45
|
+
|
46
|
+
# @rbs () -> String
|
47
|
+
def saddr: () -> String
|
48
|
+
|
49
|
+
# @rbs () -> String
|
50
|
+
def daddr: () -> String
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Generated from lib/redhound/l3/ipv6.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Ipv6 < Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> Redhound::L3::Ipv6
|
7
|
+
def self.generate: (bytes: Array[Integer]) -> Redhound::L3::Ipv6
|
8
|
+
|
9
|
+
attr_reader protocol: Protocol
|
10
|
+
|
11
|
+
# @rbs (bytes: Array[Integer]) -> void
|
12
|
+
def initialize: (bytes: Array[Integer]) -> void
|
13
|
+
|
14
|
+
# @rbs () -> Integer
|
15
|
+
def size: () -> Integer
|
16
|
+
|
17
|
+
# @rbs () -> Redhound::L3::Ipv6
|
18
|
+
def generate: () -> Redhound::L3::Ipv6
|
19
|
+
|
20
|
+
# @rbs () -> String
|
21
|
+
def to_s: () -> String
|
22
|
+
|
23
|
+
# @rbs () -> bool
|
24
|
+
def supported_protocol?: () -> bool
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# @rbs () -> Integer
|
29
|
+
def payload_length: () -> Integer
|
30
|
+
|
31
|
+
# @rbs () -> Integer
|
32
|
+
def saddr: () -> Integer
|
33
|
+
|
34
|
+
# @rbs () -> Integer
|
35
|
+
def daddr: () -> Integer
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Generated from lib/redhound/l3/protocol.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Protocol
|
6
|
+
# refs: https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml#protocol-numbers-1
|
7
|
+
PROTO_TABLE: untyped
|
8
|
+
|
9
|
+
# @rbs (protocol: Integer) -> void
|
10
|
+
def initialize: (protocol: Integer) -> void
|
11
|
+
|
12
|
+
# @rbs () -> String
|
13
|
+
def to_s: () -> String
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Generated from lib/redhound/l3/resolver.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L3
|
5
|
+
class Resolver
|
6
|
+
# @rbs (bytes: Array[Integer], l2: Redhound::L2::Ether) -> Redhound::L3::Base?
|
7
|
+
def self.resolve: (bytes: Array[Integer], l2: Redhound::L2::Ether) -> Redhound::L3::Base?
|
8
|
+
|
9
|
+
# @rbs (bytes: Array[Integer], l2: Redhound::L2::Ether) -> void
|
10
|
+
def initialize: (bytes: Array[Integer], l2: Redhound::L2::Ether) -> void
|
11
|
+
|
12
|
+
# @rbs () -> Redhound::L3::Base?
|
13
|
+
def resolve: () -> Redhound::L3::Base?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated from lib/redhound/l4/base.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L4
|
5
|
+
class Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> Redhound::L4::Base
|
7
|
+
def self.generate: (bytes: Array[Integer]) -> Redhound::L4::Base
|
8
|
+
|
9
|
+
# @rbs (bytes: Array[Integer]) -> void
|
10
|
+
def initialize: (bytes: Array[Integer]) -> void
|
11
|
+
|
12
|
+
# @rbs () -> Redhound::L4::Base
|
13
|
+
def generate: () -> Redhound::L4::Base
|
14
|
+
|
15
|
+
# @rbs () -> void
|
16
|
+
def dump: () -> void
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Generated from lib/redhound/l4/icmp.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L4
|
5
|
+
class Icmp < Base
|
6
|
+
# @rbs (bytes: Array[Integer]) -> void
|
7
|
+
def initialize: (bytes: Array[Integer]) -> void
|
8
|
+
|
9
|
+
# @rbs () -> Redhound::L4::Icmp
|
10
|
+
def generate: () -> Redhound::L4::Icmp
|
11
|
+
|
12
|
+
# @rbs () -> Integer
|
13
|
+
def size: () -> Integer
|
14
|
+
|
15
|
+
# @rbs () -> String
|
16
|
+
def to_s: () -> String
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# @rbs () -> Integer
|
21
|
+
def check: () -> Integer
|
22
|
+
|
23
|
+
# @rbs () -> Integer
|
24
|
+
def id: () -> Integer
|
25
|
+
|
26
|
+
# @rbs () -> Integer
|
27
|
+
def seq: () -> Integer
|
28
|
+
|
29
|
+
# @rbs () -> String
|
30
|
+
def data: () -> String
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Generated from lib/redhound/l4/resolver.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Redhound
|
4
|
+
class L4
|
5
|
+
class Resolver
|
6
|
+
# @rbs (bytes: Array[Integer], l3: Redhound::L3::Base) -> Redhound::L4::Base?
|
7
|
+
def self.resolve: (bytes: Array[Integer], l3: Redhound::L3::Base) -> Redhound::L4::Base?
|
8
|
+
|
9
|
+
# @rbs (bytes: Array[Integer], l3: Redhound::L3::Base) -> void
|
10
|
+
def initialize: (bytes: Array[Integer], l3: Redhound::L3::Base) -> void
|
11
|
+
|
12
|
+
# @rbs () -> Redhound::L4::Base?
|
13
|
+
def resolve: () -> Redhound::L4::Base?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|