Module: Ronin::Support::Network::POP3::Mixin
- Included in:
- Mixin
- Defined in:
- lib/ronin/support/network/pop3/mixin.rb
Overview
Provides helper methods for communicating with POP3 services.
Constant Summary collapse
- DEFAULT_PORT =
Default POP3 port
110
Instance Method Summary collapse
-
#pop3_connect(host, port: DEFAULT_PORT, ssl: nil, user:, password:) {|pop3| ... } ⇒ Net::POP3?
Creates a connection to the POP3 server.
Instance Method Details
#pop3_connect(host, port: DEFAULT_PORT, ssl: nil, user:, password:) {|pop3| ... } ⇒ Net::POP3?
Creates a connection to the POP3 server.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ronin/support/network/pop3/mixin.rb', line 77 def pop3_connect(host, port: DEFAULT_PORT, ssl: nil, user: , password: ) host = DNS::IDN.to_ascii(host) case ssl when Hash ssl = true ssl_certs = ssl[:certs] ssl_verify = SSL::VERIFY[ssl[:verify]] when TrueClass ssl = true ssl_certs = nil ssl_verify = nil else ssl = false ssl_certs = nil ssl_verify = false end pop3 = Net::POP3.new(host,port) pop3.enable_ssl(ssl_verify,ssl_certs) if ssl pop3.start(user,password) if block_given? yield pop3 pop3.finish else return pop3 end end |