Module: Rex::Socket::Tcp
- Includes:
- IO::Stream, Rex::Socket
- Defined in:
- lib/rex/socket/tcp.rb
Overview
This class provides methods for interacting with a TCP client connection.
Constant Summary
Constants included from Rex::Socket
LogSource, MATCH_DNS_NAME, MATCH_IPV4, MATCH_IPV4_PRIVATE, MATCH_IPV6, MATCH_MAC_ADDR, VERSION
Instance Attribute Summary
Attributes included from Rex::Socket
#context, #ipv, #localhost, #localport, #peerhost, #peerhostname, #peerport
Class Method Summary collapse
-
.create(hash = {}) ⇒ Object
Creates the client using the supplied hash.
-
.create_param(param) ⇒ Object
Wrapper around the base socket class’ creation method that automatically sets the parameter’s protocol to TCP.
Instance Method Summary collapse
-
#shutdown(how = ::Socket::SHUT_RDWR) ⇒ Object
Calls shutdown on the TCP connection.
-
#type? ⇒ Boolean
returns socket type.
Methods included from Rex::Socket
_install_global_resolver, addr_atoc, addr_atoi, addr_atoi_list, addr_aton, addr_ctoa, addr_itoa, addr_iton, addr_ntoa, addr_ntoi, bit2netmask, cidr_crack, compress_address, create_ip, create_tcp, create_tcp_server, create_udp, dotted_ip?, eth_aton, eth_ntoa, #fd, from_sockaddr, getaddress, getaddresses, gethostbyname, #getlocalname, #getpeername_as_array, getresources, #getsockname, #initsock, ipv6_link_address, ipv6_mac, is_internal?, is_ip_addr?, is_ipv4?, is_ipv6?, is_mac_addr?, is_name?, #localinfo, net2bitmask, #peerinfo, portlist_to_portspec, portspec_crack, portspec_to_portlist, resolv_nbo, resolv_nbo_i, resolv_nbo_i_list, resolv_nbo_list, resolv_to_dotted, source_address, support_ipv6?, tcp_socket_pair, to_authority, to_sockaddr, udp_socket_pair
Class Method Details
.create(hash = {}) ⇒ Object
Creates the client using the supplied hash.
26 27 28 29 |
# File 'lib/rex/socket/tcp.rb', line 26 def self.create(hash = {}) hash['Proto'] = 'tcp' self.create_param(Rex::Socket::Parameters.from_hash(hash)) end |
.create_param(param) ⇒ Object
Wrapper around the base socket class’ creation method that automatically sets the parameter’s protocol to TCP.
35 36 37 38 |
# File 'lib/rex/socket/tcp.rb', line 35 def self.create_param(param) param.proto = 'tcp' Rex::Socket.create_param(param) end |
Instance Method Details
#shutdown(how = ::Socket::SHUT_RDWR) ⇒ Object
Calls shutdown on the TCP connection.
49 50 51 52 53 54 |
# File 'lib/rex/socket/tcp.rb', line 49 def shutdown(how = ::Socket::SHUT_RDWR) begin return (super(how) == 0) rescue ::Exception end end |
#type? ⇒ Boolean
returns socket type
57 58 59 |
# File 'lib/rex/socket/tcp.rb', line 57 def type? return 'tcp' end |