Class/Module Index [+]

Quicksearch

Rex::Proto::NATPMP

Public Class Methods

external_address_request() click to toggle source

Return a NAT-PMP request to get the external address.

# File lib/rex/proto/natpmp/packet.rb, line 14
def self.external_address_request
        [ 0, 0 ].pack('nn')
end
map_port_request(lport, rport, protocol, lifetime) click to toggle source

Return a NAT-PMP request to map remote port rport/protocol to local port lport for lifetime ms

# File lib/rex/proto/natpmp/packet.rb, line 26
def self.map_port_request(lport, rport, protocol, lifetime)
        [   Rex::Proto::NATPMP::Version, # version
                protocol, # opcode, which is now the protocol we are asking to forward
                0, # reserved
                lport,
                rport,
                lifetime
        ].pack("ccnnnN")
end
parse_external_address_response(resp) click to toggle source

Parse a NAT-PMP external address response resp. Returns the decoded parts of the response as an array.

# File lib/rex/proto/natpmp/packet.rb, line 20
def self.parse_external_address_response(resp)
        (ver, op, result, epoch, addr) = resp.unpack("CCSLN")
        [ ver, op, result, epoch, Rex::Socket::addr_itoa(addr) ]
end
parse_map_port_response(resp) click to toggle source

Parse a NAT-PMP mapping response resp. Returns the decoded parts as an array.

# File lib/rex/proto/natpmp/packet.rb, line 38
def self.parse_map_port_response(resp)
        resp.unpack("CCSLnnN")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.