Module: Arachni::Reactor::Connection::PeerInfo

Defined in:
lib/arachni/reactor/connection/peer_info.rb

Instance Method Summary collapse

Instance Method Details

#peer_addressString



66
67
68
# File 'lib/arachni/reactor/connection/peer_info.rb', line 66

def peer_address
    peer_ip_address || peer_address_info[:path]
end

#peer_address_info(resolve = false) ⇒ Hash



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/arachni/reactor/connection/peer_info.rb', line 46

def peer_address_info( resolve = false )
    if Arachni::Reactor.supports_unix_sockets? && to_io.is_a?( UNIXSocket )
        {
            protocol: to_io.peeraddr.first,
            path:     to_io.path
        }
    else
        protocol, port, hostname, ip_address = to_io.peeraddr( resolve )

        {
            protocol:   protocol,
            port:       port,
            hostname:   hostname,
            ip_address: ip_address
        }
    end
end

#peer_hostnameString



78
79
80
# File 'lib/arachni/reactor/connection/peer_info.rb', line 78

def peer_hostname
    peer_address_info(true)[:hostname]
end

#peer_ip_addressString



72
73
74
# File 'lib/arachni/reactor/connection/peer_info.rb', line 72

def peer_ip_address
    peer_address_info[:ip_address]
end

#peer_portString



84
85
86
# File 'lib/arachni/reactor/connection/peer_info.rb', line 84

def peer_port
    peer_address_info[:port]
end