Module: Ronin::Support::Network::Telnet::Mixin
- Defined in:
- lib/ronin/support/network/telnet/mixin.rb
Overview
Provides helper methods for using the Telnet protocol.
Instance Method Summary collapse
-
#telnet_connect(host, proxy: Telnet.proxy, port: Telnet::DEFAULT_PORT, binmode: false, wait_time: 0, prompt: Telnet::DEFAULT_PROMPT, timeout: Telnet.default_timeout, telnet: nil, plain: nil, user: nil, password: nil, output_log: nil, dump_log: nil) {|telnet| ... } ⇒ Net::Telnet
Creates a new Telnet connection.
Instance Method Details
#telnet_connect(host, proxy: Telnet.proxy, port: Telnet::DEFAULT_PORT, binmode: false, wait_time: 0, prompt: Telnet::DEFAULT_PROMPT, timeout: Telnet.default_timeout, telnet: nil, plain: nil, user: nil, password: nil, output_log: nil, dump_log: nil) {|telnet| ... } ⇒ Net::Telnet
Creates a new Telnet connection.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/ronin/support/network/telnet/mixin.rb', line 105 def telnet_connect(host, # connection options proxy: Telnet.proxy, port: Telnet::DEFAULT_PORT, binmode: false, wait_time: 0, prompt: Telnet::DEFAULT_PROMPT, timeout: Telnet.default_timeout, telnet: nil, plain: nil, # authentication options user: nil, password: nil, # log options output_log: nil, dump_log: nil) host = DNS::IDN.to_ascii(host) = { 'Host' => host, 'Port' => port, 'Binmode' => binmode, 'Waittime' => wait_time, 'Prompt' => prompt, 'Timeout' => timeout } ['Telnetmode'] = true if (telnet && !plain) ['Output_log'] = output_log if output_log ['Dump_log'] = dump_log if dump_log ['Proxy'] = proxy if proxy telnet = Net::Telnet.new() telnet.login(user,password) if user if block_given? yield telnet telnet.close else return telnet end end |