Module: Ronin::Network::Mixins::IMAP

Includes:
Mixin, IMAP
Defined in:
lib/ronin/network/mixins/imap.rb

Overview

Adds IMAP convenience methods and connection parameters to a class.

Defines the following parameters:

  • host (String) - IMAP host.
  • port (Integer) - IMAP port.
  • imap_auth (String) - IMAP authentication method.
  • imap_user (String) - IMAP user to login as.
  • imap_password (String) - IMAP password to login with.

Constant Summary

Constants included from IMAP

IMAP::DEFAULT_PORT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin

included

Methods included from IMAP

default_port, default_port=

Class Method Details

.hostObject

IMAP host



41
42
# File 'lib/ronin/network/mixins/imap.rb', line 41

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

.host=(value) ⇒ Object

IMAP host



41
42
# File 'lib/ronin/network/mixins/imap.rb', line 41

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

.imap_authObject

IMAP auth



49
50
# File 'lib/ronin/network/mixins/imap.rb', line 49

parameter :imap_auth, :type => String,
:description => 'IMAP authentication method'

.imap_auth=(value) ⇒ Object

IMAP auth



49
50
# File 'lib/ronin/network/mixins/imap.rb', line 49

parameter :imap_auth, :type => String,
:description => 'IMAP authentication method'

.imap_passwordObject

IMAP password to login with



57
58
# File 'lib/ronin/network/mixins/imap.rb', line 57

parameter :imap_password, :type => String,
:description => 'IMAP password to login with'

.imap_password=(value) ⇒ Object

IMAP password to login with



57
58
# File 'lib/ronin/network/mixins/imap.rb', line 57

parameter :imap_password, :type => String,
:description => 'IMAP password to login with'

.imap_userObject

IMAP user to login as



53
54
# File 'lib/ronin/network/mixins/imap.rb', line 53

parameter :imap_user, :type => String,
:description => 'IMAP user to login as'

.imap_user=(value) ⇒ Object

IMAP user to login as



53
54
# File 'lib/ronin/network/mixins/imap.rb', line 53

parameter :imap_user, :type => String,
:description => 'IMAP user to login as'

.portObject

IMAP port



45
46
# File 'lib/ronin/network/mixins/imap.rb', line 45

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

.port=(value) ⇒ Object

IMAP port



45
46
# File 'lib/ronin/network/mixins/imap.rb', line 45

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

Instance Method Details

#hostObject

IMAP host



41
42
# File 'lib/ronin/network/mixins/imap.rb', line 41

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

#host=(value) ⇒ Object

IMAP host



41
42
# File 'lib/ronin/network/mixins/imap.rb', line 41

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

#imap_authObject

IMAP auth



49
50
# File 'lib/ronin/network/mixins/imap.rb', line 49

parameter :imap_auth, :type => String,
:description => 'IMAP authentication method'

#imap_auth=(value) ⇒ Object

IMAP auth



49
50
# File 'lib/ronin/network/mixins/imap.rb', line 49

parameter :imap_auth, :type => String,
:description => 'IMAP authentication method'

#imap_connect(options = {}, &block) ⇒ Object (protected)

Creates a connection to the IMAP server. The host, port, imap_auth, imap_user and imap_password parameters will also be used to make the connection.

Parameters:

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

    Additional options.

Options Hash (options):

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

    The port the IMAP server is running on.

  • :certs (String)

    The path to the file containing CA certs of the server.

  • :auth (Symbol)

    The type of authentication to perform when connecting to the server. May be either :login or :cram_md5.

  • :user (String)

    The user to authenticate as when connecting to the server.

  • :password (String)

    The password to authenticate with when connecting to the server.

  • Indicates (Boolean)

    wether or not to use SSL when connecting to the server.

See Also:



95
96
97
98
99
# File 'lib/ronin/network/mixins/imap.rb', line 95

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

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

#imap_passwordObject

IMAP password to login with



57
58
# File 'lib/ronin/network/mixins/imap.rb', line 57

parameter :imap_password, :type => String,
:description => 'IMAP password to login with'

#imap_password=(value) ⇒ Object

IMAP password to login with



57
58
# File 'lib/ronin/network/mixins/imap.rb', line 57

parameter :imap_password, :type => String,
:description => 'IMAP password to login with'

#imap_session(options = {}) {|session| ... } ⇒ Object (protected)

Starts a session with the IMAP server. The host, port, imap_auth, imap_user and imap_password parameters will also be used to make the connection.

Yields:

  • (session)

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

Yield Parameters:

  • session (Net::IMAP)

    The newly created IMAP session object.

See Also:



118
119
120
121
122
123
124
125
126
127
# File 'lib/ronin/network/mixins/imap.rb', line 118

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

    print_info "Logging out ..."
  end

  print_info "Disconnected from #{host_port}"
  return il
end

#imap_userObject

IMAP user to login as



53
54
# File 'lib/ronin/network/mixins/imap.rb', line 53

parameter :imap_user, :type => String,
:description => 'IMAP user to login as'

#imap_user=(value) ⇒ Object

IMAP user to login as



53
54
# File 'lib/ronin/network/mixins/imap.rb', line 53

parameter :imap_user, :type => String,
:description => 'IMAP user to login as'

#portObject

IMAP port



45
46
# File 'lib/ronin/network/mixins/imap.rb', line 45

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

#port=(value) ⇒ Object

IMAP port



45
46
# File 'lib/ronin/network/mixins/imap.rb', line 45

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