metasploit-framework

https://github.com/rapid7/metasploit-framework

Ruby

Metasploit Framework

Net::DNS::Packet.parse

Create a new instance of Net::DNS::Packet class from binary data, taken
out by a network stream. For example:

  # udp_socket is an UDPSocket waiting for a response
  ans = udp_socket.recvfrom(1500)
  packet = Net::DNS::Packet::parse(ans)

An optional +from+ argument can be used to specify the information
of the sender. If data is passed as is from a Socket#recvfrom call,
the method will accept it.

Be sure that your network data is clean from any UDP/TCP header, 
expecially when using RAW sockets.

Source | Google | Stack overflow

Edit

git clone [email protected]:rapid7/metasploit-framework.git

cd metasploit-framework

open lib/net/dns/packet.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Net--DNS--Packet-parse-for-pr


# Commit to git

git add lib/net/dns/packet.rbgit commit -m "better docs for Net::DNS::Packet.parse"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Net--DNS--Packet-parse-for-pr

hub pull-request


# Celebrate!