lib/ronin/sessions/tcp.rb in ronin-0.2.2 vs lib/ronin/sessions/tcp.rb in ronin-0.2.3
- old
+ new
@@ -27,18 +27,10 @@
module Ronin
module Sessions
module TCP
include Session
- setup_session do
- parameter :local_host, :description => 'TCP local host'
- parameter :local_port, :description => 'TCP local port'
-
- parameter :host, :description => 'TCP remote host'
- parameter :port, :description => 'TCP remote port'
- end
-
protected
#
# Opens a TCP connection to the host and port specified by the
# +host+ and +port+ parameters. If the +local_host+ and +local_port+
@@ -46,22 +38,24 @@
# of the TCP connection. A TCPSocket object will be returned. If
# a _block_ is given, it will be passed the newly created TCPSocket
# object.
#
def tcp_connect(&block)
- require_params :host, :port
+ require_variable :host
+ require_variable :port
return ::Net.tcp_connect(@host,@port,@local_host,@local_port,&block)
end
#
# Connects to the host and port specified by the +host+ and +port+
# parameters, then sends the specified _data_. If a _block_ is given,
# it will be passed the newly created TCPSocket object.
#
def tcp_connect_and_send(data,&block)
- require_params :host, :port
+ require_variable :host
+ require_variable :port
return ::Net.tcp_connect_and_send(data,@host,@port,@local_host,@local_port,&block)
end
#
@@ -69,11 +63,12 @@
# +host+ and +port+ parameters. If a _block_ is given, it will be
# passed the temporary TCPSocket object. After the given _block_
# has returned, the TCPSocket object will be closed.
#
def tcp_session(&block)
- require_params :host, :port
+ require_variable :host
+ require_variable :port
return Net.tcp_session(@host,@port,@local_host,@local_port,&block)
end
#
@@ -81,21 +76,23 @@
# parameters, reads the banner then closes the connection, returning
# the banner String. If a _block_ is given, it will be passed the
# banner String.
#
def tcp_banner(&block)
- require_params :host, :port
+ require_variable :host
+ require_variable :port
return ::Net.tcp_banner(@host,@port,@local_host,@local_port,&block)
end
#
# Connects to the host and port specified by the +host+ and +port+
# parameters, sends the specified _data_ and then closes the
# connection. Returns +true+ if the data was successfully sent.
#
def tcp_send(data)
- require_params :host, :port
+ require_variable :host
+ require_variable :port
return ::Net.tcp_send(data,@host,@port,@local_host,@local_port)
end
end
end