Module: Ronin::Network::Telnet
- Included in:
- Net, Mixins::Telnet, Support
- Defined in:
- lib/ronin/network/telnet.rb
Overview
Provides helper methods for communicating with Telnet services.
Constant Summary
- DEFAULT_PORT =
Default telnet port
23- DEFAULT_PROMPT =
The default prompt regular expression
/[$%#>] \z/n- DEFAULT_TIMEOUT =
The default timeout
10
Class Method Summary (collapse)
-
+ (Integer) default_port
The default Ronin Telnet port.
-
+ (Object) default_port=(port)
Sets the default Ronin Telnet port.
-
+ (Regexp) default_prompt
The default Ronin Telnet prompt pattern.
-
+ (Object) default_prompt=(prompt)
Sets the default Ronin Telnet prompt pattern.
-
+ (Integer) default_timeout
The default Ronin Telnet timeout.
-
+ (Object) default_timeout=(timeout)
Sets the default Ronin Telnet timeout.
-
+ (Telnet, ...) proxy
The Ronin Telnet proxy.
-
+ (Object) proxy=(new_proxy)
Sets the Ronin Telnet proxy.
Instance Method Summary (collapse)
-
- (Net::Telnet) telnet_connect(host, options = {}) {|session| ... }
Creates a new Telnet connection.
-
- (nil) telnet_session(host, options = {}) {|session| ... }
Starts a new Telnet session.
Class Method Details
+ (Integer) default_port
The default Ronin Telnet port.
43 44 45 |
# File 'lib/ronin/network/telnet.rb', line 43 def self.default_port @default_port ||= DEFAULT_PORT end |
+ (Object) default_port=(port)
Sets the default Ronin Telnet port.
55 56 57 |
# File 'lib/ronin/network/telnet.rb', line 55 def self.default_port=(port) @default_port = port end |
+ (Regexp) default_prompt
The default Ronin Telnet prompt pattern.
65 66 67 |
# File 'lib/ronin/network/telnet.rb', line 65 def self.default_prompt @default_prompt ||= DEFAULT_PROMPT end |
+ (Object) default_prompt=(prompt)
Sets the default Ronin Telnet prompt pattern.
77 78 79 |
# File 'lib/ronin/network/telnet.rb', line 77 def self.default_prompt=(prompt) @default_prompt = prompt end |
+ (Integer) default_timeout
The default Ronin Telnet timeout.
87 88 89 |
# File 'lib/ronin/network/telnet.rb', line 87 def self.default_timeout @default_timeout ||= DEFAULT_TIMEOUT end |
+ (Object) default_timeout=(timeout)
Sets the default Ronin Telnet timeout.
99 100 101 |
# File 'lib/ronin/network/telnet.rb', line 99 def self.default_timeout=(timeout) @default_timeout = timeout end |
+ (Telnet, ...) proxy
The Ronin Telnet proxy.
109 110 111 |
# File 'lib/ronin/network/telnet.rb', line 109 def self.proxy @proxy ||= nil end |
+ (Object) proxy=(new_proxy)
Sets the Ronin Telnet proxy.
121 122 123 |
# File 'lib/ronin/network/telnet.rb', line 121 def self.proxy=(new_proxy) @proxy = new_proxy end |
Instance Method Details
- (Net::Telnet) telnet_connect(host, options = {}) {|session| ... }
Creates a new Telnet connection.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/ronin/network/telnet.rb', line 193 def telnet_connect(host,={}) = { 'Host' => host.to_s, 'Port' => ([:port] || Telnet.default_port), 'Binmode' => ([:binmode] || false), 'Waittime' => ([:wait_time] || 0), 'Prompt' => ([:prompt] || Telnet.default_prompt), 'Timeout' => ([:timeout] || Telnet.default_timeout) } if ([:telnet] && ![:plain]) ['Telnetmode'] = true end if [:output_log] ['Output_log'] = [:output_log] end if [:dump_log] ['Dump_log'] = [:dump_log] end if (proxy = ([:proxy] || Telnet.proxy)) ['Proxy'] = proxy end session = Net::Telnet.new() session.login([:user],[:password]) if [:user] yield session if block_given? return session end |
- (nil) telnet_session(host, options = {}) {|session| ... }
Starts a new Telnet session.
254 255 256 257 258 259 260 261 |
# File 'lib/ronin/network/telnet.rb', line 254 def telnet_session(host,={}) session = telnet_connect(host,) yield session if block_given? session.close return nil end |