Module: Ronin::Network::Mixins::POP3
- Includes:
- Mixin
- Defined in:
- lib/ronin/network/mixins/pop3.rb
Overview
Adds POP3 convenience methods and connection parameters to a class.
Defines the following parameters:
host
(String
) - POP3 host.port
(Integer
) - POP3 port.pop3_user
(String
) - POP3 user to login as.pop3_password
(String
) - POP3 password to login with.
Instance Method Summary collapse
-
#pop3_connect(options = {}) {|session| ... } ⇒ Net::POP3
protected
Creates a connection to the POP3 server.
-
#pop3_session(options = {}) {|session| ... } ⇒ Object
protected
Starts a session with the POP3 server.
Methods included from Mixin
Instance Method Details
#pop3_connect(options = {}) {|session| ... } ⇒ Net::POP3 (protected)
Creates a connection to the POP3 server. The host},
port,
pop3_userand
pop3_password` parameters will also be used
to connect to the server.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/ronin/network/mixins/pop3.rb', line 95 def pop3_connect(={},&block) [:port] ||= self.port [:user] ||= self.pop3_user [:password] ||= self.pop3_password if self.port print_info "Connecting to #{self.host}:#{self.port} ..." else print_info "Connecting to #{self.host} ..." end return ::Net.pop3_connect(self.host,,&block) end |
#pop3_session(options = {}) {|session| ... } ⇒ Object (protected)
Starts a session with the POP3 server. The host
, port
,
pop3_user
and pop3_password
parameters will also be used
to connect to the server.
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ronin/network/mixins/pop3.rb', line 126 def pop3_session(={}) pop3_connect() do |sess| yield sess if block_given? sess.finish if @port print_info "Disconnecting to #{self.host}:#{self.port}" else print_info "Disconnecting to #{self.host}" end end end |