CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/net/dns/rr/srv.rb
Views: 11784
1
# -*- coding: binary -*-
2
##
3
#
4
# Net::DNS::RR::SRV
5
#
6
# $Id$
7
#
8
##
9
10
11
module Net
12
module DNS
13
class RR
14
15
#------------------------------------------------------------
16
# RR type SRV
17
#------------------------------------------------------------
18
class SRV < RR
19
20
attr_reader :priority, :weight, :port, :host
21
22
private
23
24
def build_pack
25
str = ""
26
end
27
28
def set_type
29
@type = Net::DNS::RR::Types.new("SRV")
30
end
31
32
def subclass_new_from_binary(data,offset)
33
off_end = offset + @rdlength
34
@priority, @weight, @port = data.unpack("@#{offset} n n n")
35
offset+=6
36
37
@host=[]
38
while offset < off_end
39
len = data.unpack("@#{offset} C")[0]
40
offset += 1
41
str = data[offset..offset+len-1]
42
offset += len
43
@host << str
44
end
45
@host=@host.join(".")
46
offset
47
end
48
49
50
end # class SRV
51
end # class RR
52
53
54
end # module DNS
55
end # module Net
56
57