metasploit-framework
https://github.com/rapid7/metasploit-framework
Ruby
Metasploit Framework
Net::DNS::RR#initialize
Create a new instance of Net::DNS::RR class, or an instance of
any of the subclass of the appropriate type.
Argument can be a string or an hash. With a sting, we can pass
a RR resource record in the canonical format:
a = Net::DNS::RR.new("foo.example.com. 86400 A 10.1.2.3")
mx = Net::DNS::RR.new("example.com. 7200 MX 10 mailhost.example.com.")
cname = Net::DNS::RR.new("www.example.com 300 IN CNAME www1.example.com")
txt = Net::DNS::RR.new('baz.example.com 3600 HS TXT "text record"')
Incidentally, +a+, +mx+, +cname+ and +txt+ objects will be instances of
respectively Net::DNS::RR::A, Net::DNS::RR::MX, Net::DNS::RR::CNAME and
Net::DNS::RR::TXT classes.
The name and RR data are required; all other informations are optional.
If omitted, the +TTL+ defaults to 10800, +type+ default to +A+ and the RR class
defaults to +IN+. Omitting the optional fields is useful for creating the
empty RDATA sections required for certain dynamic update operations.
All names must be fully qualified. The trailing dot (.) is optional.
The preferred method is however passing an hash with keys and values:
rr = Net::DNS::RR.new(
:name => "foo.example.com",
:ttl => 86400,
:cls => "IN",
:type => "A",
:address => "10.1.2.3"
)
rr = Net::DNS::RR.new(
:name => "foo.example.com",
:rdata => "10.1.2.3"
)
Name and data are required; all the others fields are optionals like
we've seen before. The data field can be specified either with the
right name of the resource (+:address+ in the example above) or with
the generic key +:rdata+. Consult documentation to find the exact name
for the resource in each subclass.Edit
git clone [email protected]:rapid7/metasploit-framework.git
cd metasploit-framework
open lib/net/dns/rr.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Net--DNS--RR-initialize-for-pr
# Commit to gitgit add lib/net/dns/rr.rbgit commit -m "better docs for Net::DNS::RR#initialize"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Net--DNS--RR-initialize-for-pr
hub pull-request
# Celebrate!