ronin 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/lib/ronin/model.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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/extensions/meta'
|
|
25
|
+
|
|
26
|
+
require 'dm-core'
|
|
27
|
+
require 'dm-types'
|
|
28
|
+
require 'dm-serializer'
|
|
29
|
+
require 'dm-aggregates'
|
|
30
|
+
|
|
31
|
+
module Ronin
|
|
32
|
+
module Model
|
|
33
|
+
include DataMapper::Types
|
|
34
|
+
|
|
35
|
+
def self.included(base)
|
|
36
|
+
base.module_eval do
|
|
37
|
+
include DataMapper::Resource
|
|
38
|
+
include DataMapper::AutoMigrations
|
|
39
|
+
|
|
40
|
+
property :type, Discriminator
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/ronin/models.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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/extensions/kernel'
|
|
25
|
+
require 'ronin/model'
|
|
26
|
+
require 'ronin/arch'
|
|
27
|
+
require 'ronin/platform'
|
|
28
|
+
require 'ronin/author'
|
|
29
|
+
require 'ronin/license'
|
|
30
|
+
require 'ronin/product'
|
|
31
|
+
|
|
32
|
+
module Ronin
|
|
33
|
+
ronin_require 'ronin/models'
|
|
34
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
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/tcp'
|
|
25
|
+
require 'ronin/network/udp'
|
|
26
|
+
require 'ronin/network/smtp'
|
|
27
|
+
require 'ronin/network/esmtp'
|
|
28
|
+
require 'ronin/network/pop3'
|
|
29
|
+
require 'ronin/network/imap'
|
|
30
|
+
require 'ronin/network/telnet'
|
|
31
|
+
require 'ronin/network/http'
|
|
@@ -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/esmtp'
|
|
@@ -0,0 +1,31 @@
|
|
|
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'
|
|
25
|
+
require 'ronin/network/extensions/udp'
|
|
26
|
+
require 'ronin/network/extensions/smtp'
|
|
27
|
+
require 'ronin/network/extensions/esmtp'
|
|
28
|
+
require 'ronin/network/extensions/pop3'
|
|
29
|
+
require 'ronin/network/extensions/imap'
|
|
30
|
+
require 'ronin/network/extensions/telnet'
|
|
31
|
+
require 'ronin/network/extensions/http'
|
|
@@ -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/esmtp/net'
|
|
@@ -0,0 +1,68 @@
|
|
|
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'
|
|
25
|
+
|
|
26
|
+
module Net
|
|
27
|
+
#
|
|
28
|
+
# See <tt>Ronin::Network::SMTP.message</tt>.
|
|
29
|
+
#
|
|
30
|
+
def Net.esmtp_message(options={},&block)
|
|
31
|
+
Net.smtp_message(options,&block)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Connects to the ESMTP server on the specified _host_ with the given
|
|
36
|
+
# _options_. If a _block_ is given it will be passed the newly created
|
|
37
|
+
# <tt>Net::SMTP</tt> object.
|
|
38
|
+
#
|
|
39
|
+
# _options_ may contain the following keys:
|
|
40
|
+
# <tt>:port</tt>:: The port to connect to, defaults to
|
|
41
|
+
# <tt>Ronin::Network::SMTP.default_port</tt>.
|
|
42
|
+
# <tt>:helo</tt>:: The HELO domain.
|
|
43
|
+
# <tt>:auth</tt>:: The type of authentication to use. Can be
|
|
44
|
+
# either <tt>:login</tt>, <tt>:plain</tt> or
|
|
45
|
+
# <tt>:cram_md5</tt>.
|
|
46
|
+
# <tt>:user</tt>:: The user name to authenticate with.
|
|
47
|
+
# <tt>:password</tt>:: The password to authenticate with.
|
|
48
|
+
#
|
|
49
|
+
def Net.esmtp_connect(host,options={},&block)
|
|
50
|
+
Net.smtp_connect(host,options) do |sess|
|
|
51
|
+
sess.esmtp = true
|
|
52
|
+
block.call(sess)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#
|
|
57
|
+
# Connects to the ESMTP server on the specified _host_ with the given
|
|
58
|
+
# _options_. If a _block_ is given it will be passed the newly created
|
|
59
|
+
# <tt>Net::SMTP</tt> object. After the <tt>Net::SMTP</tt> object has been
|
|
60
|
+
# passed to the _block_ it will be closed.
|
|
61
|
+
#
|
|
62
|
+
def Net.esmtp_session(host,options={},&block)
|
|
63
|
+
Net.smtp_session(host,options) do |sess|
|
|
64
|
+
sess.esmtp = true
|
|
65
|
+
block.call(sess)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
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/http/net'
|
|
@@ -0,0 +1,303 @@
|
|
|
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/http'
|
|
25
|
+
require 'ronin/extensions/uri/http'
|
|
26
|
+
|
|
27
|
+
require 'net/http'
|
|
28
|
+
|
|
29
|
+
module Net
|
|
30
|
+
#
|
|
31
|
+
# Connects to the HTTP server using the given _options_. If a _block_
|
|
32
|
+
# is given it will be passed the newly created <tt>Net::HTTP</tt> object.
|
|
33
|
+
#
|
|
34
|
+
# _options_ may contain the following keys:
|
|
35
|
+
# <tt>:host</tt>:: The host the HTTP server is running on.
|
|
36
|
+
# <tt>:port</tt>:: The port the HTTP server is running on. Defaults to
|
|
37
|
+
# <tt>Net::HTTP.default_port</tt>.
|
|
38
|
+
# <tt>:url</tt>:: The full URL to request.
|
|
39
|
+
# <tt>:user</tt>:: The user to authenticate with when connecting to the
|
|
40
|
+
# HTTP server.
|
|
41
|
+
# <tt>:password</tt>:: The password to authenticate with when connecting
|
|
42
|
+
# to the HTTP server.
|
|
43
|
+
# <tt>:path</tt>:: The path to request from the HTTP server.
|
|
44
|
+
# <tt>:proxy</tt>:: A Hash of proxy settings to use when connecting to
|
|
45
|
+
# the HTTP server. Defaults to
|
|
46
|
+
# <tt>Ronin::Network::HTTP.proxy</tt>.
|
|
47
|
+
# <tt>:host</tt>:: The HTTP proxy host to connect to.
|
|
48
|
+
# <tt>:port</tt>:: The HTTP proxy port to connect to.
|
|
49
|
+
# Defaults to <tt>Ronin::Network::HTTP.default_proxy_port</tt>.
|
|
50
|
+
# <tt>:user</tt>:: The user to authenticate with
|
|
51
|
+
# when connecting to the HTTP proxy.
|
|
52
|
+
# <tt>:password</tt>:: The password to authenticate with
|
|
53
|
+
# when connecting to the HTTP
|
|
54
|
+
# proxy.
|
|
55
|
+
#
|
|
56
|
+
#
|
|
57
|
+
def Net.http_session(options={},&block)
|
|
58
|
+
host = options[:host]
|
|
59
|
+
port = (options[:port] || ::Net::HTTP.default_port)
|
|
60
|
+
|
|
61
|
+
if options[:url]
|
|
62
|
+
url = URI(options[:url].to_s)
|
|
63
|
+
|
|
64
|
+
host = url.host
|
|
65
|
+
port = url.port
|
|
66
|
+
|
|
67
|
+
options[:user] = url.user if url.user
|
|
68
|
+
options[:password] = url.password if url.password
|
|
69
|
+
|
|
70
|
+
if url.query
|
|
71
|
+
options[:path] = "#{url.path}?#{url.query}"
|
|
72
|
+
else
|
|
73
|
+
options[:path] = url.path
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
proxy = (options[:proxy] || Ronin::Network::HTTP.proxy)
|
|
78
|
+
|
|
79
|
+
if proxy
|
|
80
|
+
proxy_host = proxy[:host]
|
|
81
|
+
proxy_port = (proxy[:port] || Ronin::Network::HTTP.default_proxy_port)
|
|
82
|
+
proxy_user = proxy[:user]
|
|
83
|
+
proxy_pass = proxy[:password]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
sess = Net::HTTP::Proxy(proxy_host,proxy_port,proxy_user,proxy_pass).start(host,port)
|
|
87
|
+
|
|
88
|
+
block.call(sess) if block
|
|
89
|
+
return sess
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Performes an HTTP Copy request with the given _options_. If a _block_
|
|
94
|
+
# is given, it will be passed the response from the HTTP server.
|
|
95
|
+
# Returns the response from the HTTP server.
|
|
96
|
+
#
|
|
97
|
+
def Net.http_copy(options={},&block)
|
|
98
|
+
Net.http_session(options) do |http|
|
|
99
|
+
resp = http.request(Ronin::Network::HTTP.request(:copy,options))
|
|
100
|
+
|
|
101
|
+
block.call(resp) if block
|
|
102
|
+
return resp
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
#
|
|
107
|
+
# Performes an HTTP Delete request with the given _options_. If a _block_
|
|
108
|
+
# is given, it will be passed the response from the HTTP server.
|
|
109
|
+
# Returns the response from the HTTP server.
|
|
110
|
+
#
|
|
111
|
+
def Net.http_delete(options={},&block)
|
|
112
|
+
Net.http_session(options) do |http|
|
|
113
|
+
req = Ronin::Network::HTTP.request(:delete,options)
|
|
114
|
+
req['Depth'] = (options[:depth].to_s || 'Infinity')
|
|
115
|
+
|
|
116
|
+
resp = http.request(req)
|
|
117
|
+
|
|
118
|
+
block.call(resp) if block
|
|
119
|
+
return resp
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
#
|
|
124
|
+
# Performes an HTTP Get request with the given _options_. If a _block_
|
|
125
|
+
# is given, it will be passed the response from the HTTP server.
|
|
126
|
+
# Returns the response from the HTTP server.
|
|
127
|
+
#
|
|
128
|
+
def Net.http_get(options={},&block)
|
|
129
|
+
Net.http_session(options) do |http|
|
|
130
|
+
resp = http.request(Ronin::Network::HTTP.request(:get,options))
|
|
131
|
+
|
|
132
|
+
block.call(resp) if block
|
|
133
|
+
return resp
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#
|
|
138
|
+
# Performes an HTTP Get request with the given _options_. If a _block_
|
|
139
|
+
# is given, it will be passed the response body from the HTTP server.
|
|
140
|
+
# Returns the response body from the HTTP server.
|
|
141
|
+
#
|
|
142
|
+
def Net.http_get_body(options={},&block)
|
|
143
|
+
Net.http_get(options,&block).body
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
#
|
|
147
|
+
# Performes an HTTP Head request with the given _options_. If a _block_
|
|
148
|
+
# is given, it will be passed the response from the HTTP server.
|
|
149
|
+
# Returns the response from the HTTP server.
|
|
150
|
+
#
|
|
151
|
+
def Net.http_head(options={},&block)
|
|
152
|
+
Net.http_session(options) do |http|
|
|
153
|
+
resp = http.request(Ronin::Network::HTTP.request(:head,options))
|
|
154
|
+
|
|
155
|
+
block.call(resp) if block
|
|
156
|
+
return resp
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
#
|
|
161
|
+
# Performes an HTTP Lock request with the given _options_. If a _block_
|
|
162
|
+
# is given, it will be passed the response from the HTTP server.
|
|
163
|
+
# Returns the response from the HTTP server.
|
|
164
|
+
#
|
|
165
|
+
def Net.http_lock(options={},&block)
|
|
166
|
+
Net.http_session(options) do |http|
|
|
167
|
+
resp = http.request(Ronin::Network::HTTP.request(:lock,options),options[:body])
|
|
168
|
+
|
|
169
|
+
block.call(resp) if block
|
|
170
|
+
return resp
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
#
|
|
175
|
+
# Performes an HTTP Mkcol request with the given _options_. If a _block_
|
|
176
|
+
# is given, it will be passed the response from the HTTP server.
|
|
177
|
+
# Returns the response from the HTTP server.
|
|
178
|
+
#
|
|
179
|
+
def Net.http_mkcol(options={},&block)
|
|
180
|
+
Net.http_session(options) do |http|
|
|
181
|
+
resp = http.request(Ronin::Network::HTTP.request(:mkcol,options),options[:body])
|
|
182
|
+
|
|
183
|
+
block.call(resp) if block
|
|
184
|
+
return resp
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
#
|
|
189
|
+
# Performes an HTTP Move request with the given _options_. If a _block_
|
|
190
|
+
# is given, it will be passed the response from the HTTP server.
|
|
191
|
+
# Returns the response from the HTTP server.
|
|
192
|
+
#
|
|
193
|
+
def Net.http_move(options={},&block)
|
|
194
|
+
Net.http_session(options) do |http|
|
|
195
|
+
resp = http.request(Ronin::Network::HTTP.request(:move,options))
|
|
196
|
+
|
|
197
|
+
block.call(resp) if block
|
|
198
|
+
return resp
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
#
|
|
203
|
+
# Performes an HTTP Options request with the given _options_. If a _block_
|
|
204
|
+
# is given, it will be passed the response from the HTTP server.
|
|
205
|
+
# Returns the response from the HTTP server.
|
|
206
|
+
#
|
|
207
|
+
def Net.http_options(options={},&block)
|
|
208
|
+
Net.http_session(options) do |http|
|
|
209
|
+
resp = http.request(Ronin::Network::HTTP.request(:options,options))
|
|
210
|
+
|
|
211
|
+
block.call(resp) if block
|
|
212
|
+
return resp
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
#
|
|
217
|
+
# Performes an HTTP Post request with the given _options_. If a _block_
|
|
218
|
+
# is given, it will be passed the response from the HTTP server.
|
|
219
|
+
# Returns the response from the HTTP server.
|
|
220
|
+
#
|
|
221
|
+
def Net.http_post(options={},&block)
|
|
222
|
+
Net.http_session(options) do |http|
|
|
223
|
+
url = URI(options[:url].to_s)
|
|
224
|
+
post_data = (options[:post_data] || url.query_params)
|
|
225
|
+
|
|
226
|
+
req = Ronin::Network::HTTP.request(:post,options)
|
|
227
|
+
req.set_form_data(post_data)
|
|
228
|
+
|
|
229
|
+
resp = http.request(req)
|
|
230
|
+
|
|
231
|
+
block.call(resp) if block
|
|
232
|
+
return resp
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
#
|
|
237
|
+
# Performes an HTTP Post request with the given _options_. If a _block_
|
|
238
|
+
# is given, it will be passed the response body from the HTTP server.
|
|
239
|
+
# Returns the response body from the HTTP server.
|
|
240
|
+
#
|
|
241
|
+
def Net.http_post_body(options={},&block)
|
|
242
|
+
Net.http_post(options,&block).body
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
#
|
|
246
|
+
# Performes an HTTP Propfind request with the given _options_. If a
|
|
247
|
+
# _block_ is given, it will be passed the response from the HTTP server.
|
|
248
|
+
# Returns the response from the HTTP server.
|
|
249
|
+
#
|
|
250
|
+
def Net.http_prop_find(options={},&block)
|
|
251
|
+
Net.http_session(options) do |http|
|
|
252
|
+
req = Ronin::Network::HTTP.request(:propfind,options)
|
|
253
|
+
req['Depth'] = (options[:depth] || '0')
|
|
254
|
+
|
|
255
|
+
resp = http.request(req,options[:body])
|
|
256
|
+
|
|
257
|
+
block.call(resp) if block
|
|
258
|
+
return resp
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
#
|
|
263
|
+
# Performes an HTTP Proppath request with the given _options_. If a
|
|
264
|
+
# _block_ is given, it will be passed the response from the HTTP server.
|
|
265
|
+
# Returns the response from the HTTP server.
|
|
266
|
+
#
|
|
267
|
+
def Net.http_prop_path(options={},&block)
|
|
268
|
+
Net.http_session(options) do |http|
|
|
269
|
+
resp = http.request(Ronin::Network::HTTP.request(:proppath,options),options[:body])
|
|
270
|
+
|
|
271
|
+
block.call(resp) if block
|
|
272
|
+
return resp
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
#
|
|
277
|
+
# Performes an HTTP Trace request with the given _options_. If a _block_
|
|
278
|
+
# is given, it will be passed the response from the HTTP server.
|
|
279
|
+
# Returns the response from the HTTP server.
|
|
280
|
+
#
|
|
281
|
+
def Net.http_trace(options={},&block)
|
|
282
|
+
Net.http_session(options) do |http|
|
|
283
|
+
resp = http.request(Ronin::Network::HTTP.request(:trace,options))
|
|
284
|
+
|
|
285
|
+
block.call(resp) if block
|
|
286
|
+
return resp
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
#
|
|
291
|
+
# Performes an HTTP Unlock request with the given _options_. If a _block_
|
|
292
|
+
# is given, it will be passed the response from the HTTP server.
|
|
293
|
+
# Returns the response from the HTTP server.
|
|
294
|
+
#
|
|
295
|
+
def Net.http_unlock(options={},&block)
|
|
296
|
+
Net.http_session(options) do |http|
|
|
297
|
+
resp = http.request(Ronin::Network::HTTP.request(:unlock,options),options[:body])
|
|
298
|
+
|
|
299
|
+
block.call(resp) if block
|
|
300
|
+
return resp
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
end
|