Module: Ronin::Network::POP3

Included in:
Net, Mixins::POP3, Support
Defined in:
lib/ronin/network/pop3.rb

Overview

Provides helper methods for communicating with POP3 services.

Constant Summary

DEFAULT_PORT =

Default POP3 port

110

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Integer) default_port

Returns The default Ronin POP3 port.



37
38
39
# File 'lib/ronin/network/pop3.rb', line 37

def self.default_port
  @default_port ||= DEFAULT_PORT
end

+ (Object) default_port=(port)

Sets the default Ronin POP3 port.



49
50
51
# File 'lib/ronin/network/pop3.rb', line 49

def self.default_port=(port)
  @default_port = port
end

Instance Method Details

- (Net::POP3) pop3_connect(host, options = {}) {|session| ... }

Creates a connection to the POP3 server.

Options Hash (options):

  • :port (Integer) — default: POP3.default_port

    The port the POP3 server is running on.

  • :user (String)

    The user to authenticate with when connecting to the POP3 server.

  • :password (String)

    The password to authenticate with when connecting to the POP3 server.

Yields:

  • (session)

    If a block is given, it will be passed the newly created POP3 session.

Yield Parameters:

  • session (Net::POP3)

    The newly created POP3 session.



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/ronin/network/pop3.rb', line 82

def pop3_connect(host,options={})
  host     = host.to_s
  port     = (options[:port] || POP3.default_port)
  user     = options[:user]
  password = options[:password]

  session = Net::POP3.start(host,port,user,password)

  yield session if block_given?
  return session
end

- (nil) pop3_session(host, options = {}) {|session| ... }

Starts a session with the POP3 server.

Yields:

  • (session)

    If a block is given, it will be passed the newly created POP3 session. After the block has returned, the session will be closed.

Yield Parameters:

  • session (Net::POP3)

    The newly created POP3 session.



114
115
116
117
118
119
120
121
# File 'lib/ronin/network/pop3.rb', line 114

def pop3_session(host,options={})
  session = pop3_connect(host,options)

  yield session if block_given?

  session.finish
  return nil
end