lib/ronin/sessions/telnet.rb in ronin-0.1.2 vs lib/ronin/sessions/telnet.rb in ronin-0.1.3

- old
+ new

@@ -1,11 +1,11 @@ # #-- # Ronin - A ruby development platform designed for information security # and data exploration tasks. # -# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com) +# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. @@ -28,14 +28,13 @@ module Sessions module TELNET include Session setup_session do - parameter :telnet_host, :description => 'Telnet host' - parameter :telnet_port, - :value => Network::Telnet.default_port, - :description => 'Telnet port' + parameter :host, :description => 'Telnet host' + parameter :port, :value => Network::Telnet.default_port, + :description => 'Telnet port' parameter :telnet_user, :description => 'Telnet user' parameter :telnet_password, :description => 'Telnet password' parameter :telnet_proxy, :description => 'Telnet proxy' @@ -43,21 +42,19 @@ end protected def telnet_connect(options={},&block) - unless @telnet_host - raise(ParamNotFound,"Missing parameter '#{describe_param(:telnet_host)}'",caller) - end + require_params :host - options[:port] ||= @telnet_port + options[:port] ||= @port options[:user] ||= @telnet_user options[:password] ||= @telnet_password options[:proxy] ||= @telnet_proxy options[:ssl] ||= @telnet_ssl - return ::Net.telnet_connect(@telnet_host,options,&block) + return ::Net.telnet_connect(@host,options,&block) end def telnet_session(options={},&block) return telnet_connect(options) do |sess| block.call(sess) if block