ronin 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING.txt +339 -0
- data/History.txt +34 -0
- data/Manifest.txt +157 -0
- data/README.txt +131 -0
- data/Rakefile +23 -0
- data/TODO.txt +6 -0
- data/bin/ronin +12 -0
- data/lib/ronin.rb +35 -0
- data/lib/ronin/arch.rb +86 -0
- data/lib/ronin/author.rb +88 -0
- data/lib/ronin/cache.rb +27 -0
- data/lib/ronin/cache/config.rb +34 -0
- data/lib/ronin/cache/exceptions.rb +25 -0
- data/lib/ronin/cache/exceptions/extension_not_found.rb +29 -0
- data/lib/ronin/cache/exceptions/overlay_cached.rb +29 -0
- data/lib/ronin/cache/exceptions/overlay_not_found.rb +29 -0
- data/lib/ronin/cache/extension.rb +706 -0
- data/lib/ronin/cache/extension_cache.rb +108 -0
- data/lib/ronin/cache/overlay.rb +418 -0
- data/lib/ronin/cache/overlay_cache.rb +228 -0
- data/lib/ronin/cache/ronin.rb +50 -0
- data/lib/ronin/chars.rb +25 -0
- data/lib/ronin/chars/char_set.rb +121 -0
- data/lib/ronin/chars/chars.rb +180 -0
- data/lib/ronin/config.rb +31 -0
- data/lib/ronin/console.rb +127 -0
- data/lib/ronin/context.rb +233 -0
- data/lib/ronin/database.rb +122 -0
- data/lib/ronin/environment.rb +39 -0
- data/lib/ronin/exceptions/context_not_found.rb +27 -0
- data/lib/ronin/exceptions/invalid_database_config.rb +27 -0
- data/lib/ronin/exceptions/object_context_not_found.rb +27 -0
- data/lib/ronin/exceptions/unknown_context.rb +27 -0
- data/lib/ronin/exceptions/unknown_object_context.rb +27 -0
- data/lib/ronin/extensions.rb +28 -0
- data/lib/ronin/extensions/hash.rb +62 -0
- data/lib/ronin/extensions/kernel.rb +34 -0
- data/lib/ronin/extensions/meta.rb +24 -0
- data/lib/ronin/extensions/meta/object.rb +24 -0
- data/lib/ronin/extensions/string.rb +37 -0
- data/lib/ronin/extensions/uri.rb +24 -0
- data/lib/ronin/extensions/uri/http.rb +78 -0
- data/lib/ronin/extensions/uri/query_params.rb +97 -0
- data/lib/ronin/formatting.rb +29 -0
- data/lib/ronin/formatting/binary.rb +24 -0
- data/lib/ronin/formatting/digest.rb +24 -0
- data/lib/ronin/formatting/extensions.rb +26 -0
- data/lib/ronin/formatting/extensions/binary.rb +25 -0
- data/lib/ronin/formatting/extensions/binary/integer.rb +59 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +73 -0
- data/lib/ronin/formatting/extensions/digest.rb +24 -0
- data/lib/ronin/formatting/extensions/digest/string.rb +65 -0
- data/lib/ronin/formatting/extensions/html.rb +24 -0
- data/lib/ronin/formatting/extensions/html/string.rb +75 -0
- data/lib/ronin/formatting/extensions/http.rb +24 -0
- data/lib/ronin/formatting/extensions/http/string.rb +69 -0
- data/lib/ronin/formatting/extensions/text.rb +24 -0
- data/lib/ronin/formatting/extensions/text/string.rb +96 -0
- data/lib/ronin/formatting/html.rb +24 -0
- data/lib/ronin/formatting/http.rb +24 -0
- data/lib/ronin/formatting/text.rb +24 -0
- data/lib/ronin/license.rb +87 -0
- data/lib/ronin/model.rb +44 -0
- data/lib/ronin/models.rb +34 -0
- data/lib/ronin/network.rb +31 -0
- data/lib/ronin/network/esmtp.rb +24 -0
- data/lib/ronin/network/extensions.rb +31 -0
- data/lib/ronin/network/extensions/esmtp.rb +24 -0
- data/lib/ronin/network/extensions/esmtp/net.rb +68 -0
- data/lib/ronin/network/extensions/http.rb +24 -0
- data/lib/ronin/network/extensions/http/net.rb +303 -0
- data/lib/ronin/network/extensions/imap.rb +24 -0
- data/lib/ronin/network/extensions/imap/net.rb +92 -0
- data/lib/ronin/network/extensions/pop3.rb +24 -0
- data/lib/ronin/network/extensions/pop3/net.rb +65 -0
- data/lib/ronin/network/extensions/smtp.rb +24 -0
- data/lib/ronin/network/extensions/smtp/net.rb +80 -0
- data/lib/ronin/network/extensions/tcp.rb +24 -0
- data/lib/ronin/network/extensions/tcp/net.rb +94 -0
- data/lib/ronin/network/extensions/telnet.rb +24 -0
- data/lib/ronin/network/extensions/telnet/net.rb +132 -0
- data/lib/ronin/network/extensions/udp.rb +24 -0
- data/lib/ronin/network/extensions/udp/net.rb +99 -0
- data/lib/ronin/network/http.rb +128 -0
- data/lib/ronin/network/http/exceptions.rb +24 -0
- data/lib/ronin/network/http/exceptions/unknown_request.rb +31 -0
- data/lib/ronin/network/imap.rb +47 -0
- data/lib/ronin/network/pop3.rb +47 -0
- data/lib/ronin/network/smtp.rb +26 -0
- data/lib/ronin/network/smtp/email.rb +126 -0
- data/lib/ronin/network/smtp/smtp.rb +55 -0
- data/lib/ronin/network/tcp.rb +24 -0
- data/lib/ronin/network/telnet.rb +95 -0
- data/lib/ronin/network/udp.rb +24 -0
- data/lib/ronin/object_context.rb +257 -0
- data/lib/ronin/objects.rb +29 -0
- data/lib/ronin/parameters.rb +27 -0
- data/lib/ronin/parameters/class_param.rb +45 -0
- data/lib/ronin/parameters/exceptions.rb +25 -0
- data/lib/ronin/parameters/exceptions/missing_param.rb +29 -0
- data/lib/ronin/parameters/exceptions/param_not_found.rb +29 -0
- data/lib/ronin/parameters/instance_param.rb +57 -0
- data/lib/ronin/parameters/param.rb +45 -0
- data/lib/ronin/parameters/parameters.rb +275 -0
- data/lib/ronin/path.rb +70 -0
- data/lib/ronin/pending_context.rb +42 -0
- data/lib/ronin/persistence.rb +32 -0
- data/lib/ronin/platform.rb +95 -0
- data/lib/ronin/product.rb +56 -0
- data/lib/ronin/ronin.rb +49 -0
- data/lib/ronin/rpc.rb +27 -0
- data/lib/ronin/rpc/call.rb +75 -0
- data/lib/ronin/rpc/client.rb +91 -0
- data/lib/ronin/rpc/console.rb +79 -0
- data/lib/ronin/rpc/exceptions.rb +25 -0
- data/lib/ronin/rpc/exceptions/not_implemented.rb +29 -0
- data/lib/ronin/rpc/exceptions/response_missing.rb +29 -0
- data/lib/ronin/rpc/interactive.rb +55 -0
- data/lib/ronin/rpc/interactive_console.rb +58 -0
- data/lib/ronin/rpc/interactive_shell.rb +59 -0
- data/lib/ronin/rpc/response.rb +57 -0
- data/lib/ronin/rpc/service.rb +69 -0
- data/lib/ronin/rpc/shell.rb +66 -0
- data/lib/ronin/runner.rb +24 -0
- data/lib/ronin/runner/program.rb +26 -0
- data/lib/ronin/runner/program/command.rb +204 -0
- data/lib/ronin/runner/program/commands.rb +33 -0
- data/lib/ronin/runner/program/commands/add.rb +73 -0
- data/lib/ronin/runner/program/commands/help.rb +52 -0
- data/lib/ronin/runner/program/commands/install.rb +65 -0
- data/lib/ronin/runner/program/commands/list.rb +81 -0
- data/lib/ronin/runner/program/commands/remove.rb +57 -0
- data/lib/ronin/runner/program/commands/uninstall.rb +57 -0
- data/lib/ronin/runner/program/commands/update.rb +55 -0
- data/lib/ronin/runner/program/exceptions.rb +24 -0
- data/lib/ronin/runner/program/exceptions/unknown_command.rb +31 -0
- data/lib/ronin/runner/program/options.rb +205 -0
- data/lib/ronin/runner/program/program.rb +173 -0
- data/lib/ronin/runner/program/runner.rb +35 -0
- data/lib/ronin/sessions.rb +32 -0
- data/lib/ronin/sessions/esmtp.rb +76 -0
- data/lib/ronin/sessions/imap.rb +73 -0
- data/lib/ronin/sessions/pop3.rb +70 -0
- data/lib/ronin/sessions/session.rb +52 -0
- data/lib/ronin/sessions/smtp.rb +76 -0
- data/lib/ronin/sessions/tcp.rb +111 -0
- data/lib/ronin/sessions/telnet.rb +76 -0
- data/lib/ronin/sessions/udp.rb +99 -0
- data/lib/ronin/sessions/web.rb +83 -0
- data/lib/ronin/shell.rb +81 -0
- data/lib/ronin/target.rb +40 -0
- data/lib/ronin/version.rb +27 -0
- data/lib/ronin/web.rb +24 -0
- data/lib/ronin/web/web.rb +265 -0
- data/spec/spec_helper.rb +9 -0
- data/tasks/spec.rb +7 -0
- metadata +324 -0
@@ -0,0 +1,173 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/runner/program/command'
|
25
|
+
require 'ronin/runner/program/options'
|
26
|
+
require 'ronin/runner/program/exceptions/unknown_command'
|
27
|
+
require 'ronin/console'
|
28
|
+
require 'ronin/version'
|
29
|
+
|
30
|
+
module Ronin
|
31
|
+
module Runner
|
32
|
+
module Program
|
33
|
+
#
|
34
|
+
# Returns the commands registered with the Program.
|
35
|
+
#
|
36
|
+
def Program.commands
|
37
|
+
@@commands ||= []
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Returns the Hash of the Command names and their Command objects
|
42
|
+
# registered with the Program.
|
43
|
+
#
|
44
|
+
def Program.commands_by_name
|
45
|
+
@@commands_by_name ||= {}
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Returns +true+ if the a Command with the specified _name_ was
|
50
|
+
# registered with the Program.
|
51
|
+
#
|
52
|
+
def Program.has_command?(name)
|
53
|
+
Program.commands_by_name.has_key?(name.to_s)
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Returns the Command registered with the Program with the specified
|
58
|
+
# _name_.
|
59
|
+
#
|
60
|
+
def Program.get_command(name)
|
61
|
+
name = name.to_s
|
62
|
+
|
63
|
+
unless Program.has_command?(name)
|
64
|
+
raise(UnknownCommand,"unknown command #{name.dump}",caller)
|
65
|
+
end
|
66
|
+
|
67
|
+
return Program.commands_by_name[name]
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Prints the specified error _message_.
|
72
|
+
#
|
73
|
+
def Program.error(message)
|
74
|
+
STDERR.puts "ronin: #{message}"
|
75
|
+
return false
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Exits successfully from the Program. If a _block_ is given, it will
|
80
|
+
# be called before the Program is exited.
|
81
|
+
#
|
82
|
+
def Program.success(&block)
|
83
|
+
block.call(self) if block
|
84
|
+
exit
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Prints the given error _messages_ and exits unseccessfully from the
|
89
|
+
# Program. If a _block_ is given, it will be called before any
|
90
|
+
# error _messages_ are printed.
|
91
|
+
#
|
92
|
+
def Program.fail(*messages,&block)
|
93
|
+
block.call(self) if block
|
94
|
+
|
95
|
+
messages.each do |mesg|
|
96
|
+
Program.error(mesg)
|
97
|
+
end
|
98
|
+
|
99
|
+
exit -1
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# If a _topic_ is given, the help message for that _topic_ will be
|
104
|
+
# printed, otherwise a list of available commands will be printed.
|
105
|
+
#
|
106
|
+
def Program.help(topic=nil)
|
107
|
+
if topic
|
108
|
+
begin
|
109
|
+
get_command(topic).help
|
110
|
+
rescue UnknownCommand => exp
|
111
|
+
Program.fail(exp)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
puts 'Available commands:'
|
115
|
+
|
116
|
+
Program.commands.each do |cmd|
|
117
|
+
puts " #{cmd.command_names.join(', ')}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#
|
123
|
+
# The default command to run with the given _argv_ Array when no
|
124
|
+
# sub-command is given.
|
125
|
+
#
|
126
|
+
def Program.default_command(*argv)
|
127
|
+
Options.new('ronin','<command> [options]') { |opts|
|
128
|
+
opts.options do |opts|
|
129
|
+
opts.on('-r','--require LIB','require the specified library or path') do |lib|
|
130
|
+
Console.auto_load << lib.to_s
|
131
|
+
end
|
132
|
+
|
133
|
+
opts.on('-V','--version','print version information and exit') do
|
134
|
+
Program.success do
|
135
|
+
puts "Ronin #{Ronin::VERSION}"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
opts.summary('Ronin is a Ruby development platform designed for information security','and data exploration tasks.')
|
141
|
+
}.parse(argv) { |opts,args|
|
142
|
+
Console.start
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# Runs the Program with the given _argv_ Array. If the first argument
|
148
|
+
# is a sub-command name, the Program will attempt to find and execute
|
149
|
+
# the Command with the same name.
|
150
|
+
#
|
151
|
+
def Program.run(*argv)
|
152
|
+
begin
|
153
|
+
if (argv.empty? || argv[0][0..0]=='-')
|
154
|
+
Program.default_command(*argv)
|
155
|
+
else
|
156
|
+
cmd = argv.first
|
157
|
+
argv = argv[1..-1]
|
158
|
+
|
159
|
+
if Program.has_command?(cmd)
|
160
|
+
Program.commands_by_name[cmd].run(*argv)
|
161
|
+
else
|
162
|
+
Program.fail("unknown command #{cmd.dump}")
|
163
|
+
end
|
164
|
+
end
|
165
|
+
rescue OptionParser::MissingArgument, OptionParser::InvalidOption => e
|
166
|
+
Program.fail(e)
|
167
|
+
end
|
168
|
+
|
169
|
+
return true
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/runner/program/program'
|
25
|
+
|
26
|
+
module Ronin
|
27
|
+
module Runner
|
28
|
+
#
|
29
|
+
# See Program.run.
|
30
|
+
#
|
31
|
+
def Runner.program(argv)
|
32
|
+
Program.run(*argv)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/sessions/session'
|
25
|
+
require 'ronin/sessions/tcp'
|
26
|
+
require 'ronin/sessions/udp'
|
27
|
+
require 'ronin/sessions/smtp'
|
28
|
+
require 'ronin/sessions/esmtp'
|
29
|
+
require 'ronin/sessions/pop3'
|
30
|
+
require 'ronin/sessions/imap'
|
31
|
+
require 'ronin/sessions/telnet'
|
32
|
+
require 'ronin/sessions/web'
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A ruby development platform designed for information security
|
4
|
+
# and data exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/sessions/session'
|
25
|
+
require 'ronin/network/esmtp'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Sessions
|
29
|
+
module SMTP
|
30
|
+
include Session
|
31
|
+
|
32
|
+
ESMTP_SESSION = proc do
|
33
|
+
parameter :esmtp_host, :description => 'ESMTP host'
|
34
|
+
parameter :esmtp_port, :description => 'ESMTP port'
|
35
|
+
|
36
|
+
parameter :esmtp_login, :description => 'ESMTP login'
|
37
|
+
parameter :esmtp_user, :description => 'ESMTP user'
|
38
|
+
parameter :esmtp_password, :description => 'ESMTP password'
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.included(base)
|
42
|
+
Session.setup_class(base,&ESMTP_SESSION)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.extended(obj)
|
46
|
+
Session.setup_object(obj,&ESMTP_SESSION)
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def esmtp_message(options={},&block)
|
52
|
+
Network::SMTP.message(options,&block)
|
53
|
+
end
|
54
|
+
|
55
|
+
def esmtp_connect(options={},&block)
|
56
|
+
unless @esmtp_host
|
57
|
+
raise(ParamNotFound,"Missing parameter #{describe_param(:esmtp_host).dump}",caller)
|
58
|
+
end
|
59
|
+
|
60
|
+
options[:port] ||= @esmtp_port
|
61
|
+
options[:login] ||= @esmtp_login
|
62
|
+
options[:user] ||= @esmtp_user
|
63
|
+
options[:password] ||= @esmtp_password
|
64
|
+
|
65
|
+
return ::Net.esmtp_connect(@esmtp_host,options,&block)
|
66
|
+
end
|
67
|
+
|
68
|
+
def esmtp_session(options={},&block)
|
69
|
+
esmtp_connect(options) do |sess|
|
70
|
+
block.call(sess) if block
|
71
|
+
sess.close
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A ruby development platform designed for information security
|
4
|
+
# and data exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/sessions/session'
|
25
|
+
require 'ronin/network/imap'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Sessions
|
29
|
+
module IMAP
|
30
|
+
include Session
|
31
|
+
|
32
|
+
IMAP_SESSION = proc do
|
33
|
+
parameter :imap_host, :description => 'IMAP host'
|
34
|
+
parameter :imap_port, :description => 'IMAP port'
|
35
|
+
|
36
|
+
parameter :imap_auth, :description => 'IMAP authentication mode'
|
37
|
+
parameter :imap_user, :description => 'IMAP user'
|
38
|
+
parameter :imap_password, :description => 'IMAP password'
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.included(base)
|
42
|
+
Session.setup_class(base,&IMAP_SESSION)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.extended(obj)
|
46
|
+
Session.setup_object(obj,&IMAP_SESSION)
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def imap_connect(options={},&block)
|
52
|
+
unless @imap_host
|
53
|
+
raise(ParamNotFound,"Missing parameter '#{describe_param(:imap_host)}'",caller)
|
54
|
+
end
|
55
|
+
|
56
|
+
options[:port] ||= @imap_port
|
57
|
+
options[:auth] ||= @imap_auth
|
58
|
+
options[:user] ||= @imap_user
|
59
|
+
options[:password] ||= @imap_password
|
60
|
+
|
61
|
+
return ::Net.imap_connect(@imap_host,options,&block)
|
62
|
+
end
|
63
|
+
|
64
|
+
def imap_session(options={},&block)
|
65
|
+
imap_connect(options) do |sess|
|
66
|
+
block.call(sess) if block
|
67
|
+
sess.close
|
68
|
+
sess.logout
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A ruby development platform designed for information security
|
4
|
+
# and data exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
#++
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'ronin/sessions/session'
|
25
|
+
require 'ronin/network/pop3'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Sessions
|
29
|
+
module POP3
|
30
|
+
include Session
|
31
|
+
|
32
|
+
POP3_SESSION = proc do
|
33
|
+
parameter :pop3_host, :description => 'POP3 host'
|
34
|
+
parameter :pop3_port, :description => 'POP3 port'
|
35
|
+
|
36
|
+
parameter :pop3_user, :description => 'POP3 user'
|
37
|
+
parameter :pop3_password, :description => 'POP3 password'
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.included(base)
|
41
|
+
Session.setup_class(base,&POP3_SESSION)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.extended(obj)
|
45
|
+
Session.setup_object(obj,&POP3_SESSION)
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
49
|
+
|
50
|
+
def pop3_connect(options={},&block)
|
51
|
+
unless @pop3_host
|
52
|
+
raise(ParamNotFound,"Missing parameter #{describe_param(:pop3_host).dump}",caller)
|
53
|
+
end
|
54
|
+
|
55
|
+
options[:port] ||= @pop3_port
|
56
|
+
options[:user] ||= @pop3_user
|
57
|
+
options[:password] ||= @pop3_password
|
58
|
+
|
59
|
+
return ::Net.pop3_connect(@pop3_host,options,&block)
|
60
|
+
end
|
61
|
+
|
62
|
+
def pop3_session(options={},&block)
|
63
|
+
pop3_connect(options) do |sess|
|
64
|
+
block.call(sess) if block
|
65
|
+
sess.finish
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|