Module: Ronin::Network::Mixins::POP3

Includes:
Mixin, POP3
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.

Constant Summary

Constants included from POP3

POP3::DEFAULT_PORT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin

included

Methods included from POP3

default_port, default_port=

Class Method Details

.hostObject

POP3 host



40
41
# File 'lib/ronin/network/mixins/pop3.rb', line 40

parameter :host, :type => String,
:description => 'POP3 host'

.host=(value) ⇒ Object

POP3 host



40
41
# File 'lib/ronin/network/mixins/pop3.rb', line 40

parameter :host, :type => String,
:description => 'POP3 host'

.pop3_passwordObject

POP3 password



52
53
# File 'lib/ronin/network/mixins/pop3.rb', line 52

parameter :pop3_password, :type => String,
:description => 'POP3 password to login with'

.pop3_password=(value) ⇒ Object

POP3 password



52
53
# File 'lib/ronin/network/mixins/pop3.rb', line 52

parameter :pop3_password, :type => String,
:description => 'POP3 password to login with'

.pop3_userObject

POP3 user



48
49
# File 'lib/ronin/network/mixins/pop3.rb', line 48

parameter :pop3_user, :type => String,
:description => 'POP3 user to login as'

.pop3_user=(value) ⇒ Object

POP3 user



48
49
# File 'lib/ronin/network/mixins/pop3.rb', line 48

parameter :pop3_user, :type => String,
:description => 'POP3 user to login as'

.portObject

POP3 port



44
45
# File 'lib/ronin/network/mixins/pop3.rb', line 44

parameter :port, :type => Integer,
:description => 'POP3 port'

.port=(value) ⇒ Object

POP3 port



44
45
# File 'lib/ronin/network/mixins/pop3.rb', line 44

parameter :port, :type => Integer,
:description => 'POP3 port'

Instance Method Details

#hostObject

POP3 host



40
41
# File 'lib/ronin/network/mixins/pop3.rb', line 40

parameter :host, :type => String,
:description => 'POP3 host'

#host=(value) ⇒ Object

POP3 host



40
41
# File 'lib/ronin/network/mixins/pop3.rb', line 40

parameter :host, :type => String,
:description => 'POP3 host'

#pop3_connect(options = {}) {|session| ... } ⇒ Net::POP3 (protected)

Creates a connection to the POP3 server. The host}, port, pop3_user and pop3_password` parameters will also be used to connect to the server.

Parameters:

  • options (Hash) (defaults to: {})

    Additional options.

Options Hash (options):

  • :port (Integer) — default: Ronin::Network::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.

Returns:

  • (Net::POP3)

    The newly created POP3 session.

See Also:



90
91
92
93
94
# File 'lib/ronin/network/mixins/pop3.rb', line 90

def pop3_connect(options={},&block)
  print_info "Connecting to #{host_port} ..."

  return super(self.host,pop3_merge_options(options),&block)
end

#pop3_passwordObject

POP3 password



52
53
# File 'lib/ronin/network/mixins/pop3.rb', line 52

parameter :pop3_password, :type => String,
:description => 'POP3 password to login with'

#pop3_password=(value) ⇒ Object

POP3 password



52
53
# File 'lib/ronin/network/mixins/pop3.rb', line 52

parameter :pop3_password, :type => String,
:description => 'POP3 password to login with'

#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.

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.

See Also:



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

def pop3_session(options={})
  super(options) do |sess|
    yield sess if block_given?

    print_info "Logging out ..."
  end

  print_info "Disconnected to #{host_port}"
end

#pop3_userObject

POP3 user



48
49
# File 'lib/ronin/network/mixins/pop3.rb', line 48

parameter :pop3_user, :type => String,
:description => 'POP3 user to login as'

#pop3_user=(value) ⇒ Object

POP3 user



48
49
# File 'lib/ronin/network/mixins/pop3.rb', line 48

parameter :pop3_user, :type => String,
:description => 'POP3 user to login as'

#portObject

POP3 port



44
45
# File 'lib/ronin/network/mixins/pop3.rb', line 44

parameter :port, :type => Integer,
:description => 'POP3 port'

#port=(value) ⇒ Object

POP3 port



44
45
# File 'lib/ronin/network/mixins/pop3.rb', line 44

parameter :port, :type => Integer,
:description => 'POP3 port'