DIY-pcap 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/pcap +2 -62
- data/bin/rpcap +2 -63
- data/lib/diy/command.rb +80 -0
- data/lib/diy/device_finder.rb +1 -1
- data/lib/diy/dig.rb +3 -1
- data/lib/diy/live.rb +5 -0
- data/lib/diy/parser/mu/fixnum_ext.rb +7 -0
- data/lib/diy/parser/mu/pcap/ethernet.rb +148 -0
- data/lib/diy/parser/mu/pcap/header.rb +75 -0
- data/lib/diy/parser/mu/pcap/io_pair.rb +67 -0
- data/lib/diy/parser/mu/pcap/io_wrapper.rb +76 -0
- data/lib/diy/parser/mu/pcap/ip.rb +61 -0
- data/lib/diy/parser/mu/pcap/ipv4.rb +257 -0
- data/lib/diy/parser/mu/pcap/ipv6.rb +148 -0
- data/lib/diy/parser/mu/pcap/packet.rb +104 -0
- data/lib/diy/parser/mu/pcap/pkthdr.rb +155 -0
- data/lib/diy/parser/mu/pcap/reader.rb +61 -0
- data/lib/diy/parser/mu/pcap/reader/http_family.rb +170 -0
- data/lib/diy/parser/mu/pcap/sctp.rb +367 -0
- data/lib/diy/parser/mu/pcap/sctp/chunk.rb +123 -0
- data/lib/diy/parser/mu/pcap/sctp/chunk/data.rb +134 -0
- data/lib/diy/parser/mu/pcap/sctp/chunk/init.rb +100 -0
- data/lib/diy/parser/mu/pcap/sctp/chunk/init_ack.rb +68 -0
- data/lib/diy/parser/mu/pcap/sctp/parameter.rb +110 -0
- data/lib/diy/parser/mu/pcap/sctp/parameter/ip_address.rb +48 -0
- data/lib/diy/parser/mu/pcap/stream_packetizer.rb +72 -0
- data/lib/diy/parser/mu/pcap/tcp.rb +505 -0
- data/lib/diy/parser/mu/pcap/udp.rb +69 -0
- data/lib/diy/parser/mu/scenario/pcap.rb +172 -0
- data/lib/diy/parser/mu/scenario/pcap/fields.rb +50 -0
- data/lib/diy/parser/mu/scenario/pcap/rtp.rb +71 -0
- data/lib/diy/parser/pcap.rb +113 -0
- data/lib/diy/parser/readme.md +72 -0
- data/lib/diy/utils.rb +9 -1
- data/lib/diy/version.rb +1 -1
- data/lib/diy/worker.rb +3 -2
- data/lib/diy/worker_keeper.rb +6 -0
- data/spec/helper/tcp.dat +0 -0
- data/spec/live_spec.rb +9 -0
- data/spec/mu_parser_spec.rb +12 -0
- data/spec/utils_spec.rb +1 -1
- metadata +34 -3
@@ -0,0 +1,123 @@
|
|
1
|
+
# http://www.mudynamics.com
|
2
|
+
# http://labs.mudynamics.com
|
3
|
+
# http://www.pcapr.net
|
4
|
+
|
5
|
+
module Mu
|
6
|
+
class Pcap
|
7
|
+
class SCTP
|
8
|
+
|
9
|
+
class Chunk < Packet
|
10
|
+
attr_accessor :type, :flags, :size
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
|
15
|
+
@type = 0
|
16
|
+
@flags = 0
|
17
|
+
@size = 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.from_bytes bytes
|
21
|
+
# Basic validation
|
22
|
+
Pcap.assert(bytes.length >= 4,
|
23
|
+
"Truncated chunk header: 4 > #{bytes.length}")
|
24
|
+
|
25
|
+
# Read chunk header
|
26
|
+
type, flags, size = bytes.unpack('CCn')
|
27
|
+
|
28
|
+
# Validate chunk size
|
29
|
+
Pcap.assert(bytes.length >= size,
|
30
|
+
"Truncated chunk: #{size} set, #{bytes.length} available")
|
31
|
+
|
32
|
+
# Create chunk based on type
|
33
|
+
case type
|
34
|
+
when CHUNK_DATA
|
35
|
+
chunk = Data.from_bytes(flags, size, bytes[4..-1])
|
36
|
+
when CHUNK_INIT
|
37
|
+
chunk = Init.from_bytes(flags, size, bytes[4..-1])
|
38
|
+
when CHUNK_INIT_ACK
|
39
|
+
chunk = InitAck.from_bytes(flags, size, bytes[4..-1])
|
40
|
+
when CHUNK_SACK
|
41
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
42
|
+
when CHUNK_HEARTBEAT
|
43
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
44
|
+
when CHUNK_HEARTBEAT_ACK
|
45
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
46
|
+
when CHUNK_ABORT
|
47
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
48
|
+
when CHUNK_SHUTDOWN
|
49
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
50
|
+
when CHUNK_SHUTDOWN_ACK
|
51
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
52
|
+
when CHUNK_ERROR
|
53
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
54
|
+
when CHUNK_COOKIE_ECHO
|
55
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
56
|
+
when CHUNK_COOKIE_ACK
|
57
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
58
|
+
when CHUNK_ECNE
|
59
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
60
|
+
when CHUNK_CWR
|
61
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
62
|
+
when CHUNK_SHUTDOWN_COMPLETE
|
63
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
64
|
+
when CHUNK_AUTH
|
65
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
66
|
+
when CHUNK_ASCONF_ACK
|
67
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
68
|
+
when CHUNK_PADDING
|
69
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
70
|
+
when CHUNK_FORWARD_TSN
|
71
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
72
|
+
when CHUNK_ASCONF
|
73
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
74
|
+
else
|
75
|
+
chunk = dummy_chunk(type, flags, size, bytes)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Return the result
|
79
|
+
return chunk
|
80
|
+
end
|
81
|
+
|
82
|
+
def write io, ip
|
83
|
+
header = [@type, @flags, @size].pack('CCn')
|
84
|
+
|
85
|
+
# Write Chunk header followed by the payload
|
86
|
+
io.write(header)
|
87
|
+
io.write(@payload_raw)
|
88
|
+
end
|
89
|
+
|
90
|
+
def padded_size
|
91
|
+
if 0 == @size % 4
|
92
|
+
return @size
|
93
|
+
else
|
94
|
+
return (@size + 4 - (@size % 4))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def to_s
|
99
|
+
return "chunk(%d, %d, %d)" % [@type, @flags, @size]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.dummy_chunk type, flags, size, bytes
|
103
|
+
# Create new dummy chunk
|
104
|
+
chunk = Chunk.new
|
105
|
+
chunk.type = type
|
106
|
+
chunk.flags = flags
|
107
|
+
chunk.size = size
|
108
|
+
|
109
|
+
# Save the payload
|
110
|
+
chunk.payload_raw = chunk.payload = bytes[4..chunk.padded_size]
|
111
|
+
|
112
|
+
# Return the result
|
113
|
+
return chunk
|
114
|
+
end
|
115
|
+
end # class Chunk
|
116
|
+
|
117
|
+
end # class SCTP
|
118
|
+
end # class Pcap
|
119
|
+
end # module Mu
|
120
|
+
|
121
|
+
require 'mu/pcap/sctp/chunk/data'
|
122
|
+
require 'mu/pcap/sctp/chunk/init'
|
123
|
+
require 'mu/pcap/sctp/chunk/init_ack'
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# http://www.mudynamics.com
|
2
|
+
# http://labs.mudynamics.com
|
3
|
+
# http://www.pcapr.net
|
4
|
+
|
5
|
+
module Mu
|
6
|
+
class Pcap
|
7
|
+
class SCTP
|
8
|
+
class Chunk
|
9
|
+
|
10
|
+
class Data < Chunk
|
11
|
+
FLAG_LAST_SEG = 0x01
|
12
|
+
FLAG_FIRST_SEG = 0x02
|
13
|
+
FLAG_UNORDERED = 0x04
|
14
|
+
|
15
|
+
attr_accessor :tsn, :sid, :ssn, :ppid
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super
|
19
|
+
|
20
|
+
@type = CHUNK_DATA
|
21
|
+
@tsn = 0
|
22
|
+
@sid = 0
|
23
|
+
@ssn = 0
|
24
|
+
@ppid = 0
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.from_bytes flags, size, bytes
|
28
|
+
# Basic validation
|
29
|
+
Pcap.assert(bytes.length >= 12,
|
30
|
+
"Truncated data chunk header: 12 > #{bytes.length}")
|
31
|
+
|
32
|
+
# Read init chunk header
|
33
|
+
tsn, sid, ssn, ppid = bytes.unpack('NnnN')
|
34
|
+
|
35
|
+
# Create data chunk
|
36
|
+
data = Data.new
|
37
|
+
data.flags = flags
|
38
|
+
data.size = size
|
39
|
+
data.tsn = tsn
|
40
|
+
data.sid = sid
|
41
|
+
data.ssn = ssn
|
42
|
+
data.ppid = ppid
|
43
|
+
|
44
|
+
# Save the payload
|
45
|
+
data.payload_raw = data.payload = bytes[12..size - 5]
|
46
|
+
|
47
|
+
# Return the result
|
48
|
+
return data
|
49
|
+
end
|
50
|
+
|
51
|
+
def write io, ip
|
52
|
+
chunk_header = [@type, @flags, @size].pack('CCn')
|
53
|
+
data_header = [@tsn, @sid, @ssn, @ppid].pack('NnnN')
|
54
|
+
|
55
|
+
# Write Chunk header followed by the Data chunk header and payload
|
56
|
+
io.write(chunk_header)
|
57
|
+
io.write(data_header)
|
58
|
+
io.write(@payload_raw)
|
59
|
+
|
60
|
+
# Write padding, if necessary
|
61
|
+
if size < padded_size
|
62
|
+
(padded_size - size).times do
|
63
|
+
io.write("\x00")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def ordered?
|
69
|
+
if 0 == @flags[2]
|
70
|
+
return true
|
71
|
+
else
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def first_segment?
|
77
|
+
if 1 == @flags[1] and 0 == @flags[0]
|
78
|
+
return true
|
79
|
+
else
|
80
|
+
return false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def last_segment?
|
85
|
+
if 0 == @flags[1] and 1 == @flags[0]
|
86
|
+
return true
|
87
|
+
else
|
88
|
+
return false
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def complete_segment?
|
93
|
+
if 1 == @flags[1] and 1 == @flags[0]
|
94
|
+
return true
|
95
|
+
else
|
96
|
+
return false
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def to_s
|
101
|
+
flags_s = '['
|
102
|
+
|
103
|
+
if ordered?
|
104
|
+
flags_s += 'ordered, '
|
105
|
+
else
|
106
|
+
flags_s += 'unordered, '
|
107
|
+
end
|
108
|
+
|
109
|
+
if complete_segment?
|
110
|
+
flags_s += 'complete segment'
|
111
|
+
elsif first_segment?
|
112
|
+
flags_s += 'first segment'
|
113
|
+
elsif last_segment?
|
114
|
+
flags_s += 'last segment'
|
115
|
+
else
|
116
|
+
flags_s += 'middle segment'
|
117
|
+
end
|
118
|
+
|
119
|
+
flags_s += ']'
|
120
|
+
|
121
|
+
return "data(%s, %d, %d, %d, %d, %d, %s)" % [flags_s,
|
122
|
+
@size,
|
123
|
+
@tsn,
|
124
|
+
@sid,
|
125
|
+
@ssn,
|
126
|
+
@ppid,
|
127
|
+
@payload.inspect]
|
128
|
+
end
|
129
|
+
end # class Data
|
130
|
+
|
131
|
+
end # class Chunk
|
132
|
+
end # class SCTP
|
133
|
+
end # class Pcap
|
134
|
+
end # module Mu
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# http://www.mudynamics.com
|
2
|
+
# http://labs.mudynamics.com
|
3
|
+
# http://www.pcapr.net
|
4
|
+
|
5
|
+
module Mu
|
6
|
+
class Pcap
|
7
|
+
class SCTP
|
8
|
+
class Chunk
|
9
|
+
|
10
|
+
class Init < Chunk
|
11
|
+
attr_accessor :init_tag, :a_rwnd, :o_streams, :i_streams, :init_tsn
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
super
|
15
|
+
|
16
|
+
@type = CHUNK_INIT
|
17
|
+
@init_tag = 0
|
18
|
+
@a_rwnd = 0
|
19
|
+
@o_streams = 0
|
20
|
+
@i_streams = 0
|
21
|
+
@init_tsn = 0
|
22
|
+
@payload = []
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.from_bytes flags, size, bytes
|
26
|
+
# Basic validation
|
27
|
+
Pcap.assert(bytes.length >= 16,
|
28
|
+
"Truncated init chunk header: 16 > #{bytes.length}")
|
29
|
+
|
30
|
+
# Read init chunk header
|
31
|
+
init_tag, a_rwnd, o_streams, i_streams, init_tsn = bytes.unpack('NNnnN')
|
32
|
+
|
33
|
+
# Create init chunk
|
34
|
+
init = Init.new
|
35
|
+
init.flags = flags
|
36
|
+
init.size = size
|
37
|
+
init.init_tag = init_tag
|
38
|
+
init.a_rwnd = a_rwnd
|
39
|
+
init.o_streams = o_streams
|
40
|
+
init.i_streams = i_streams
|
41
|
+
init.init_tsn = init_tsn
|
42
|
+
|
43
|
+
# Initialize the counter
|
44
|
+
length = 16
|
45
|
+
|
46
|
+
# Collect the chunks
|
47
|
+
while length < bytes.length
|
48
|
+
# Parse new parameter from the bytes
|
49
|
+
parameter = Parameter.from_bytes(bytes[length..-1])
|
50
|
+
|
51
|
+
# Get parameter size with padding
|
52
|
+
length += parameter.padded_size
|
53
|
+
|
54
|
+
# Add chunk to the list
|
55
|
+
init << parameter
|
56
|
+
end
|
57
|
+
|
58
|
+
# Return the result
|
59
|
+
return init
|
60
|
+
end
|
61
|
+
|
62
|
+
def write io, ip
|
63
|
+
chunk_header = [@type, @flags, @size].pack('CCn')
|
64
|
+
init_header = [@init_tag,
|
65
|
+
@a_rwnd,
|
66
|
+
@o_streams,
|
67
|
+
@i_streams,
|
68
|
+
@init_tsn].pack('NNnnN')
|
69
|
+
|
70
|
+
# Write Chunk header followed by the Init chunk header
|
71
|
+
io.write(chunk_header)
|
72
|
+
io.write(init_header)
|
73
|
+
|
74
|
+
# Write each parameter
|
75
|
+
@payload.each do |parameter|
|
76
|
+
parameter.write(io, ip)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def << parameter
|
81
|
+
@payload << parameter
|
82
|
+
end
|
83
|
+
|
84
|
+
def to_s
|
85
|
+
return "init(%d, %d, %d, %d, %d, %d, %s)" % [@size,
|
86
|
+
@init_tag,
|
87
|
+
@a_rwnd,
|
88
|
+
@o_streams,
|
89
|
+
@i_streams,
|
90
|
+
@init_tsn,
|
91
|
+
@payload.join(", ")]
|
92
|
+
end
|
93
|
+
end # class Init
|
94
|
+
|
95
|
+
end # class Chunk
|
96
|
+
end # class SCTP
|
97
|
+
end # class Pcap
|
98
|
+
end # module Mu
|
99
|
+
|
100
|
+
require 'mu/pcap/sctp/parameter'
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# http://www.mudynamics.com
|
2
|
+
# http://labs.mudynamics.com
|
3
|
+
# http://www.pcapr.net
|
4
|
+
|
5
|
+
module Mu
|
6
|
+
class Pcap
|
7
|
+
class SCTP
|
8
|
+
class Chunk
|
9
|
+
|
10
|
+
class InitAck < Init
|
11
|
+
def initialize
|
12
|
+
super
|
13
|
+
|
14
|
+
@type = CHUNK_INIT_ACK
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_bytes flags, size, bytes
|
18
|
+
# Basic validation
|
19
|
+
Pcap.assert(bytes.length >= 16,
|
20
|
+
"Truncated init_ack chunk header: 16 > #{bytes.length}")
|
21
|
+
|
22
|
+
# Read init_ack chunk header
|
23
|
+
init_tag, a_rwnd, o_streams, i_streams, init_tsn = bytes.unpack('NNnnN')
|
24
|
+
|
25
|
+
# Create init chunk
|
26
|
+
init_ack = InitAck.new
|
27
|
+
init_ack.flags = flags
|
28
|
+
init_ack.size = size
|
29
|
+
init_ack.init_tag = init_tag
|
30
|
+
init_ack.a_rwnd = a_rwnd
|
31
|
+
init_ack.o_streams = o_streams
|
32
|
+
init_ack.i_streams = i_streams
|
33
|
+
init_ack.init_tsn = init_tsn
|
34
|
+
|
35
|
+
# Initialize the counter
|
36
|
+
length = 16
|
37
|
+
|
38
|
+
# Collect the chunks
|
39
|
+
while length < bytes.length
|
40
|
+
# Parse new parameter from the bytes
|
41
|
+
parameter = Parameter.from_bytes(bytes[length..-1])
|
42
|
+
|
43
|
+
# Get parameter size with padding
|
44
|
+
length += parameter.padded_size
|
45
|
+
|
46
|
+
# Add chunk to the list
|
47
|
+
init_ack << parameter
|
48
|
+
end
|
49
|
+
|
50
|
+
# Return the result
|
51
|
+
return init_ack
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_s
|
55
|
+
return "init_ack(%d, %d, %d, %d, %d, %d, %s)" % [@size,
|
56
|
+
@init_tag,
|
57
|
+
@a_rwnd,
|
58
|
+
@o_streams,
|
59
|
+
@i_streams,
|
60
|
+
@init_tsn,
|
61
|
+
@payload.join(", ")]
|
62
|
+
end
|
63
|
+
end # class InitAck
|
64
|
+
|
65
|
+
end # class Chunk
|
66
|
+
end # class SCTP
|
67
|
+
end # class Pcap
|
68
|
+
end # module Mu
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# http://www.mudynamics.com
|
2
|
+
# http://labs.mudynamics.com
|
3
|
+
# http://www.pcapr.net
|
4
|
+
|
5
|
+
module Mu
|
6
|
+
class Pcap
|
7
|
+
class SCTP
|
8
|
+
|
9
|
+
class Parameter < Packet
|
10
|
+
attr_accessor :type, :size
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
|
15
|
+
@type = 0
|
16
|
+
@size = 0
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.from_bytes bytes
|
20
|
+
# Basic validation
|
21
|
+
Pcap.assert(bytes.length >= 4,
|
22
|
+
"Truncated parameter header: 4 > #{bytes.length}")
|
23
|
+
|
24
|
+
# Read chunk header
|
25
|
+
type, size = bytes.unpack('nn')
|
26
|
+
|
27
|
+
# Validate chunk size
|
28
|
+
Pcap.assert(bytes.length >= size,
|
29
|
+
"Truncated parameter: #{size} set, #{bytes.length} available")
|
30
|
+
|
31
|
+
# Create chunk based on type
|
32
|
+
case type
|
33
|
+
when PARAM_IPV4
|
34
|
+
parameter = IpAddress.from_bytes(type, size, bytes[4..-1])
|
35
|
+
when PARAM_IPV6
|
36
|
+
parameter = IpAddress.from_bytes(type, size, bytes[4..-1])
|
37
|
+
when PARAM_STATE_COOKIE
|
38
|
+
parameter = dummy_parameter(type, size, bytes)
|
39
|
+
when PARAM_COOKIE_PRESERVATIVE
|
40
|
+
parameter = dummy_parameter(type, size, bytes)
|
41
|
+
when PARAM_HOST_NAME_ADDR
|
42
|
+
parameter = dummy_parameter(type, size, bytes)
|
43
|
+
when PARAM_SUPPORTED_ADDR_TYPES
|
44
|
+
parameter = dummy_parameter(type, size, bytes)
|
45
|
+
when PARAM_ECN
|
46
|
+
parameter = dummy_parameter(type, size, bytes)
|
47
|
+
when PARAM_RANDOM
|
48
|
+
parameter = dummy_parameter(type, size, bytes)
|
49
|
+
when PARAM_CHUNK_LIST
|
50
|
+
parameter = dummy_parameter(type, size, bytes)
|
51
|
+
when PARAM_HMAC_ALGORITHM
|
52
|
+
parameter = dummy_parameter(type, size, bytes)
|
53
|
+
when PARAM_PADDING
|
54
|
+
parameter = dummy_parameter(type, size, bytes)
|
55
|
+
when PARAM_SUPPORTED_EXTENSIONS
|
56
|
+
parameter = dummy_parameter(type, size, bytes)
|
57
|
+
when PARAM_FORWARD_TSN
|
58
|
+
parameter = dummy_parameter(type, size, bytes)
|
59
|
+
when PARAM_SET_PRIMARY_ADDR
|
60
|
+
parameter = dummy_parameter(type, size, bytes)
|
61
|
+
when PARAM_ADAPTATION_LAYER_INDICATION
|
62
|
+
parameter = dummy_parameter(type, size, bytes)
|
63
|
+
else
|
64
|
+
parameter = dummy_parameter(type, size, bytes)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Return the result
|
68
|
+
return parameter
|
69
|
+
end
|
70
|
+
|
71
|
+
def write io, ip
|
72
|
+
header = [@type, @size].pack('nn')
|
73
|
+
|
74
|
+
# Write Parameter header followed by the payload
|
75
|
+
io.write(header)
|
76
|
+
io.write(@payload_raw)
|
77
|
+
end
|
78
|
+
|
79
|
+
def padded_size
|
80
|
+
if 0 == @size % 4
|
81
|
+
return @size
|
82
|
+
else
|
83
|
+
return (@size + 4 - (@size % 4))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_s
|
88
|
+
return "parameter(%d, %d)" % [@type, @size]
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.dummy_parameter type, size, bytes
|
92
|
+
# Create new dummy parameter
|
93
|
+
parameter = Parameter.new
|
94
|
+
parameter.type = type
|
95
|
+
parameter.size = size
|
96
|
+
|
97
|
+
# Save the payload
|
98
|
+
parameter.payload = bytes[4..parameter.padded_size - 1]
|
99
|
+
parameter.payload_raw = parameter.payload
|
100
|
+
|
101
|
+
# Return the result
|
102
|
+
return parameter
|
103
|
+
end
|
104
|
+
end # class Parameter
|
105
|
+
|
106
|
+
end # class SCTP
|
107
|
+
end # class Pcap
|
108
|
+
end # module Mu
|
109
|
+
|
110
|
+
require 'mu/pcap/sctp/parameter/ip_address'
|