Module: Ronin::Exploits::Mixins::RemoteTCP
- Includes:
- Support::Network::TCP::Mixin
- Defined in:
- lib/ronin/exploits/mixins/remote_tcp.rb
Overview
Adds TCP helper methods for communicating with a remote host.
Class Method Summary collapse
-
.included(exploit) ⇒ Object
private
Includes Params::Host, Params::Port, Params::BindHost, and Params::BindPort into the exploit class that is including RemoteTCP.
Instance Method Summary collapse
-
#tcp_banner(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
-
#tcp_connect(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|socket| ... } ⇒ TCPSocket?
Creates a new TCPSocket object connected to a given host and port.
-
#tcp_connect_and_send(data, host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|socket| ... } ⇒ TCPSocket
Creates a new TCPSocket object, connected to a given host and port.
-
#tcp_open?(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port], **kwargs) ⇒ Boolean?
Tests whether a remote TCP port is open.
-
#tcp_send(data, host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
Class Method Details
.included(exploit) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Includes Params::Host, Params::Port, Params::BindHost, and Params::BindPort into the exploit class that is including Ronin::Exploits::Mixins::RemoteTCP.
53 54 55 56 57 58 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 53 def self.included(exploit) exploit.include Params::Host exploit.include Params::Port exploit.include Params::BindHost exploit.include Params::BindPort end |
Instance Method Details
#tcp_banner(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
229 230 231 232 233 234 235 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 229 def (host=params[:host],port=params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) if debug? print_debug "Fetching the banner for #{host}:#{port} ..." end super(host,port,bind_host: bind_host, bind_port: bind_port) end |
#tcp_connect(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|socket| ... } ⇒ TCPSocket?
Creates a new TCPSocket object connected to a given host and port.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 143 def tcp_connect(host=params[:host],port=params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port], &block) if debug? print_debug "Connecting to #{host}:#{port} ..." end super(host,port, bind_host: bind_host, bind_port: bind_port, &block) end |
#tcp_connect_and_send(data, host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) {|socket| ... } ⇒ TCPSocket
Creates a new TCPSocket object, connected to a given host and port. The given data will then be written to the newly created TCPSocket.
187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 187 def tcp_connect_and_send(data,host=params[:host],port=params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port], &block) if debug? print_debug "Connecting to #{host}:#{port} and sending #{data.inspect} ..." end super(data,host,port, bind_host: bind_host, bind_port: bind_port, &block) end |
#tcp_open?(host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port], **kwargs) ⇒ Boolean?
Tests whether a remote TCP port is open.
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 93 def tcp_open?(host=params[:host],port=params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port], **kwargs) if debug? print_debug "Testing if #{host}:#{port} is open ..." end super(host,port, bind_host: bind_host, bind_port: bind_port, **kwargs) end |
#tcp_send(data, host = params[:host], port = params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
265 266 267 268 269 270 271 |
# File 'lib/ronin/exploits/mixins/remote_tcp.rb', line 265 def tcp_send(data,host=params[:host],port=params[:port], bind_host: params[:bind_host], bind_port: params[:bind_port]) if debug? print_debug "Sending #{data.inspect} to #{host}:#{port} ..." end super(data,host,port, bind_host: bind_host, bind_port: bind_port) end |