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,24 @@
|
|
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/network/extensions/imap/net'
|
@@ -0,0 +1,92 @@
|
|
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/network/imap'
|
25
|
+
|
26
|
+
require 'net/imap'
|
27
|
+
|
28
|
+
module Net
|
29
|
+
#
|
30
|
+
# Connects to the IMAP server on the specified _host_ with the given
|
31
|
+
# _options_. If a _block_ is given, it will be passed the newly created
|
32
|
+
# Net::Imap object.
|
33
|
+
#
|
34
|
+
# _options_ may contain the following keys:
|
35
|
+
# <tt>:port</tt>:: The port the IMAP server is running on. Defaults to
|
36
|
+
# IMAP.default_port.
|
37
|
+
# <tt>:certs</tt>:: The path to the file containing CA certs of the server.
|
38
|
+
# <tt>:auth</tt>:: The type of authentication to perform when connecting
|
39
|
+
# to the server. May be either :login, or :cram_md5.
|
40
|
+
# <tt>:user</tt>:: The user to authenticate as when connecting to the
|
41
|
+
# server.
|
42
|
+
# <tt>:password</tt>:: The password to authenticate with when connecting
|
43
|
+
# to the server.
|
44
|
+
# <tt>:ssl</tt>:: Indicates wether or not to use SSL when connecting to
|
45
|
+
# the server.
|
46
|
+
#
|
47
|
+
def Net.imap_connect(host,options={},&block)
|
48
|
+
port = (options[:port] || Ronin::Net::IMAP.default_port)
|
49
|
+
certs = options[:certs]
|
50
|
+
auth = options[:auth]
|
51
|
+
user = options[:user]
|
52
|
+
passwd = options[:password]
|
53
|
+
|
54
|
+
if options[:ssl]
|
55
|
+
ssl = true
|
56
|
+
ssl_certs = options[:ssl][:certs]
|
57
|
+
ssl_verify = options[:ssl][:verify]
|
58
|
+
else
|
59
|
+
ssl = false
|
60
|
+
ssl_verify = false
|
61
|
+
end
|
62
|
+
|
63
|
+
sess = Net::IMAP.new(host,port,ssl,ssl_certs,ssl_verify)
|
64
|
+
|
65
|
+
if user
|
66
|
+
if auth==:cram_md5
|
67
|
+
sess.authenticate('CRAM-MD5',user,passwd)
|
68
|
+
else
|
69
|
+
sess.authenticate('LOGIN',user,passwd)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
block.call(sess) if block
|
74
|
+
return sess
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# Starts an IMAP session with the IMAP server running on the specified
|
79
|
+
# _host_ with the given _options_. If a _block_ is given, it will be
|
80
|
+
# called before the session is closed.
|
81
|
+
#
|
82
|
+
def Net.imap_session(host,options={},&block)
|
83
|
+
Net.imap_connect(host,options) do |sess|
|
84
|
+
block.call(sess) if block
|
85
|
+
sess.logout if options[:user]
|
86
|
+
sess.close
|
87
|
+
sess.disconnect
|
88
|
+
end
|
89
|
+
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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/network/extensions/pop3/net'
|
@@ -0,0 +1,65 @@
|
|
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/network/pop3'
|
25
|
+
|
26
|
+
require 'net/pop'
|
27
|
+
|
28
|
+
module Net
|
29
|
+
#
|
30
|
+
# Connects to the POP3 server on the specified _host_ using the given
|
31
|
+
# _options_. If a _block_ is given, it will be passed the newly created
|
32
|
+
# <tt>Net::POP3</tt> object.
|
33
|
+
#
|
34
|
+
# _options_ may contain the following keys:
|
35
|
+
# <tt>:port</tt>:: The port the POP3 server is running on. Defaults to
|
36
|
+
# <tt>Ronin::Network::POP3.default_port</tt>.
|
37
|
+
# <tt>:user</tt>:: The user to authenticate with when connecting to the
|
38
|
+
# POP3 server.
|
39
|
+
# <tt>:password</tt>:: The password to authenticate with when connecting
|
40
|
+
# to the POP3 server.
|
41
|
+
#
|
42
|
+
def Net.pop3_connect(host,options={},&block)
|
43
|
+
port = (options[:port] || Ronin::Network::POP3.default_port)
|
44
|
+
user = options[:user]
|
45
|
+
password = options[:password]
|
46
|
+
|
47
|
+
sess Net::POP3.start(host,port,user,password)
|
48
|
+
block.call(sess) if block
|
49
|
+
return sess
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Starts a session with the POP3 server on the specified _host_ using the
|
54
|
+
# given _options_. If a _block_ is given, it will be passed the newly
|
55
|
+
# created <tt>Net::POP3</tt> object before the connection is closed.
|
56
|
+
#
|
57
|
+
def Net.pop3_session(host,options={},&block)
|
58
|
+
Net.pop3_connect(host,options) do |sess|
|
59
|
+
block.call(sess) if block
|
60
|
+
sess.finish
|
61
|
+
end
|
62
|
+
|
63
|
+
return nil
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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/network/extensions/smtp/net'
|
@@ -0,0 +1,80 @@
|
|
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/network/smtp/email'
|
25
|
+
|
26
|
+
require 'net/smtp'
|
27
|
+
|
28
|
+
module Net
|
29
|
+
#
|
30
|
+
# See <tt>Ronin::Network::SMTP.message</tt>.
|
31
|
+
#
|
32
|
+
def Net.smtp_message(options={},&block)
|
33
|
+
Ronin::Network::SMTP.message(options,&block)
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Connects to the SMTP server on the specified _host_ with the given
|
38
|
+
# _options_. If a _block_ is given it will be passed the newly created
|
39
|
+
# <tt>Net::SMTP</tt> object.
|
40
|
+
#
|
41
|
+
# _options_ may contain the following keys:
|
42
|
+
# <tt>:port</tt>:: The port to connect to, defaults to
|
43
|
+
# <tt>Ronin::Network::SMTP.default_port</tt>.
|
44
|
+
# <tt>:helo</tt>:: The HELO domain.
|
45
|
+
# <tt>:auth</tt>:: The type of authentication to use. Can be
|
46
|
+
# either <tt>:login</tt>, <tt>:plain</tt> or
|
47
|
+
# <tt>:cram_md5</tt>.
|
48
|
+
# <tt>:user</tt>:: The user name to authenticate with.
|
49
|
+
# <tt>:password</tt>:: The password to authenticate with.
|
50
|
+
#
|
51
|
+
def Net.smtp_connect(host,options={},&block)
|
52
|
+
port = (options[:port] || Ronin::Network::SMTP.default_port)
|
53
|
+
|
54
|
+
helo = options[:helo]
|
55
|
+
|
56
|
+
auth = options[:auth]
|
57
|
+
user = options[:user]
|
58
|
+
password = options[:password]
|
59
|
+
|
60
|
+
sess = Net::SMTP.start(host,port,helo,user,password,auth)
|
61
|
+
|
62
|
+
block.call(sess) if block
|
63
|
+
return sess
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Connects to the SMTP server on the specified _host_ with the given
|
68
|
+
# _options_. If a _block_ is given it will be passed the newly created
|
69
|
+
# <tt>Net::SMTP</tt> object. After the <tt>Net::SMTP</tt> object has been
|
70
|
+
# passed to the _block_ it will be closed.
|
71
|
+
#
|
72
|
+
def Net.smtp_session(host,options={},&block)
|
73
|
+
Net.smtp_connect(host,options) do |sess|
|
74
|
+
block.call(sess) if block
|
75
|
+
sess.finish
|
76
|
+
end
|
77
|
+
|
78
|
+
return nil
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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/network/extensions/tcp/net'
|
@@ -0,0 +1,94 @@
|
|
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 'socket'
|
25
|
+
|
26
|
+
module Net
|
27
|
+
#
|
28
|
+
# Creates a new TCPSocket object with the specified _rhost_, _rport_
|
29
|
+
# and the given _lhost_ and _lport_. If _block_ is given, it will be
|
30
|
+
# passed the newly created TCPSocket object.
|
31
|
+
#
|
32
|
+
# Net.tcp_connect('www.hackety.org',80) # => TCPSocket
|
33
|
+
#
|
34
|
+
# Net.tcp_connect('www.wired.com',80) do |sock|
|
35
|
+
# sock.write("GET /\n\n")
|
36
|
+
# puts sock.readlines
|
37
|
+
# sock.close
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
def Net.tcp_connect(rhost,rport,lhost=nil,lport=nil,&block)
|
41
|
+
sock = TCPSocket.new(rhost,rport,lhost,lport)
|
42
|
+
block.call(sock) if block
|
43
|
+
|
44
|
+
return sock
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Creates a new TCPSocket object with the specified _rhost_
|
49
|
+
# _rport_, and the given _lhost_ and _lport_. The specified _data_ will
|
50
|
+
# then be written to the newly created TCPSocket. If a _block_ is given
|
51
|
+
# it will be passed the TCPSocket object.
|
52
|
+
#
|
53
|
+
def Net.tcp_connect_and_send(data,rhost,rport,lhost=nil,lport=nil,&block)
|
54
|
+
Net.tcp_connect(rhost,rport,lhost,lport) do |sock|
|
55
|
+
sock.write(data)
|
56
|
+
|
57
|
+
block.call(sock) if block
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Creates a new TCPSocket object with the specified _rhost_, _rport_
|
63
|
+
# and the given _lhost_ and _lport_. If _block_ is given, it will be
|
64
|
+
# passed the newly created TCPSocket object. After the TCPSocket object
|
65
|
+
# has been passed to the given _block_ it will be closed.
|
66
|
+
#
|
67
|
+
def Net.tcp_session(rhost,rport,lhost=nil,lport=nil,&block)
|
68
|
+
Net.tcp_connect(rhost,rport,lhost,lport) do |sock|
|
69
|
+
block.call(sock) if block
|
70
|
+
sock.close
|
71
|
+
end
|
72
|
+
|
73
|
+
return nil
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Connects to the specified _rhost_ and _rport_ with the given _lhost_
|
78
|
+
# and _lport_, reads the banner then closes the connection, returning the
|
79
|
+
# received banner. If a _block_ is given it will be passed the banner.
|
80
|
+
#
|
81
|
+
# Net.tcp_banner('pop.gmail.com',25)
|
82
|
+
# # => "220 mx.google.com ESMTP c20sm3096959rvf.1"
|
83
|
+
#
|
84
|
+
def Net.tcp_banner(rhost,rport,lhost=nil,lport=nil,&block)
|
85
|
+
banner = nil
|
86
|
+
|
87
|
+
Net.tcp_session(rhost,rport,lhost,lport) do |sock|
|
88
|
+
banner = sock.readline.strip
|
89
|
+
end
|
90
|
+
|
91
|
+
block.call(banner) if block
|
92
|
+
return banner
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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/network/extensions/telnet/net'
|