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,52 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2007 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
|
+
|
26
|
+
module Ronin
|
27
|
+
module Runner
|
28
|
+
module Program
|
29
|
+
class HelpCommand < Command
|
30
|
+
|
31
|
+
command :help
|
32
|
+
|
33
|
+
options('[COMMAND]') do |opts|
|
34
|
+
opts.arguments do
|
35
|
+
opts.arg('COMMAND','The command to view')
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.summary('View a list of supported commands or information on a specific command')
|
39
|
+
end
|
40
|
+
|
41
|
+
def arguments(*args)
|
42
|
+
unless args.length<=1
|
43
|
+
fail('help: only one command maybe specified')
|
44
|
+
end
|
45
|
+
|
46
|
+
success { Program.help(args.first) }
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -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-2007 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/cache/overlay'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Runner
|
29
|
+
module Program
|
30
|
+
class InstallCommand < Command
|
31
|
+
|
32
|
+
command :install
|
33
|
+
|
34
|
+
options('URI [options]') do |opts|
|
35
|
+
opts.settings.media = nil
|
36
|
+
opts.settings.uri = nil
|
37
|
+
|
38
|
+
opts.options do
|
39
|
+
opts.on('-m','--media [MEDIA]','Spedify the media-type of the repository') do |media|
|
40
|
+
options.settings.media = media
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.arguments do
|
45
|
+
opts.arg('URI','The URI of the repository to install')
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.summary('Installs the repository located at the specified URI')
|
49
|
+
end
|
50
|
+
|
51
|
+
def arguments(args)
|
52
|
+
unless args.length==1
|
53
|
+
fail('install: only one repository URI maybe specified')
|
54
|
+
end
|
55
|
+
|
56
|
+
Cache::Overlay.save_cache do
|
57
|
+
Cache::Overlay.install(:uri => args.first, :media => options.settings.media) do |repo|
|
58
|
+
puts "Overlay #{repo} has been installed."
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2007 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/cache/overlay'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Runner
|
29
|
+
module Program
|
30
|
+
class ListCommand < Command
|
31
|
+
|
32
|
+
command :list, :ls
|
33
|
+
|
34
|
+
options('[NAME ...] [options]') do |opts|
|
35
|
+
opts.options
|
36
|
+
|
37
|
+
opts.arguments do
|
38
|
+
opts.arg('NAME','Overlay to display')
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.summary('Display all or the specified repositories within the repository cache')
|
42
|
+
end
|
43
|
+
|
44
|
+
def arguments(*args)
|
45
|
+
if args.empty?
|
46
|
+
# list all repositories by name
|
47
|
+
Cache::Overlay.each do |repo|
|
48
|
+
puts " #{repo}"
|
49
|
+
end
|
50
|
+
else
|
51
|
+
# list specified repositories
|
52
|
+
args.each do |name|
|
53
|
+
repo = Cache::Overlay.get(name)
|
54
|
+
|
55
|
+
puts "[ #{repo} ]\n\n"
|
56
|
+
|
57
|
+
puts " path: #{repo.path}" if options.settings.verbose
|
58
|
+
puts " media: #{repo.media}"
|
59
|
+
puts " uri: #{repo.uri}" if repo.uri
|
60
|
+
|
61
|
+
if repo.description
|
62
|
+
puts " description:\n\n #{repo.description}"
|
63
|
+
end
|
64
|
+
|
65
|
+
puts "\n"
|
66
|
+
|
67
|
+
if options.settings.verbose
|
68
|
+
puts " extensions:\n\n"
|
69
|
+
|
70
|
+
repo.each_extension do |ext|
|
71
|
+
puts " #{ext}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2007 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/cache/overlay'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Runner
|
29
|
+
module Program
|
30
|
+
class RemoveCommand < Command
|
31
|
+
|
32
|
+
command :remove, :rm
|
33
|
+
|
34
|
+
options('NAME [NAME ...] [options]') do |opts|
|
35
|
+
opts.options
|
36
|
+
|
37
|
+
opts.arguments do
|
38
|
+
opts.arg('NAME','The repository to remove')
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.summary('Remove the specified repositories')
|
42
|
+
end
|
43
|
+
|
44
|
+
def arguments(*args)
|
45
|
+
args.each do |name|
|
46
|
+
Cache::Overlay.save_cache do
|
47
|
+
Cache::Overlay.remove(name) do |repo|
|
48
|
+
puts "Removing #{repo}..."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2007 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/cache/overlay'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Runner
|
29
|
+
module Program
|
30
|
+
class UninstallCommand < Command
|
31
|
+
|
32
|
+
command :uninstall
|
33
|
+
|
34
|
+
options('NAME [NAME ...] [options]') do |opts|
|
35
|
+
opts.options
|
36
|
+
|
37
|
+
opts.arguments do
|
38
|
+
opts.arg('NAME','The repository to uninstall')
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.summary('Uninstall the specified repositories')
|
42
|
+
end
|
43
|
+
|
44
|
+
def arguments(*args)
|
45
|
+
args.each do |name|
|
46
|
+
Cache::Overlay.save_cache do
|
47
|
+
Cache::Overlay.uninstall(name) do |repo|
|
48
|
+
puts "Uninstalling #{repo}..."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2007 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/cache/overlay'
|
26
|
+
|
27
|
+
module Ronin
|
28
|
+
module Runner
|
29
|
+
module Program
|
30
|
+
class UpdateCommand < Command
|
31
|
+
|
32
|
+
command :update, :up
|
33
|
+
|
34
|
+
options('[NAME ...] [options]') do |opts|
|
35
|
+
opts.options
|
36
|
+
|
37
|
+
opts.arguments do
|
38
|
+
opts.arg('NAME','The repository to update')
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.summary('Updates all or the specified repositories')
|
42
|
+
end
|
43
|
+
|
44
|
+
def arguments(*args)
|
45
|
+
if args.empty?
|
46
|
+
Cache::Overlay.each { |repo| repo.update }
|
47
|
+
else
|
48
|
+
args.each { |name| Cache::Overlay.update(name) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
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/runner/program/exceptions/unknown_command'
|
@@ -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
|
+
module Ronin
|
25
|
+
module Runner
|
26
|
+
module Program
|
27
|
+
class UnknownCommand < RuntimeError
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,205 @@
|
|
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
|
+
require 'optparse'
|
27
|
+
require 'ostruct'
|
28
|
+
|
29
|
+
module Ronin
|
30
|
+
module Runner
|
31
|
+
class Options
|
32
|
+
|
33
|
+
# Settings used by the options
|
34
|
+
attr_reader :settings
|
35
|
+
|
36
|
+
#
|
37
|
+
# Creates a new Options object with the specified _program_ name
|
38
|
+
# and the given _banner_. If a _block_ is given, it will be passed
|
39
|
+
# the newly created Options object.
|
40
|
+
#
|
41
|
+
def initialize(program,banner=nil,&block)
|
42
|
+
@settings = OpenStruct.new
|
43
|
+
@settings.verbose = false
|
44
|
+
|
45
|
+
@help_block = proc { help }
|
46
|
+
|
47
|
+
@verbose_block = proc {
|
48
|
+
@settings.verbose = true
|
49
|
+
}
|
50
|
+
|
51
|
+
@parser = OptionParser.new do |opts|
|
52
|
+
if banner
|
53
|
+
opts.banner = "Usage: #{program} #{banner}"
|
54
|
+
opts.separator ''
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
block.call(self) if block
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Creates a new Options object for a Command with the specified
|
63
|
+
# _program_ name, command _name_ and the given _banner_. If a _block_
|
64
|
+
# is given, it will be passed the newly created Options object.
|
65
|
+
#
|
66
|
+
def Options.command(program,name,banner=nil,&block)
|
67
|
+
return Options.new(program,"#{name} #{banner}",&block) if banner
|
68
|
+
return Options.new(program,name,&block)
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# Call the specified _block_ when the given option _flags_ are parsed.
|
73
|
+
#
|
74
|
+
def on(*flags,&block)
|
75
|
+
@parser.on(*flags,&block)
|
76
|
+
return self
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Calls the specified _block_ when the verbose option flag is parsed.
|
81
|
+
#
|
82
|
+
def on_verbose(&block)
|
83
|
+
@verbose_block = block
|
84
|
+
return self
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Calls the specified _block_ when the help option-flag is parsed.
|
89
|
+
#
|
90
|
+
def on_help(&block)
|
91
|
+
@help_block = block
|
92
|
+
return self
|
93
|
+
end
|
94
|
+
|
95
|
+
#
|
96
|
+
# Adds a section separator with the specified _text_.
|
97
|
+
#
|
98
|
+
def separator(text)
|
99
|
+
@parser.separator(text)
|
100
|
+
return self
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Adds an options section to the help message. If a _block_ is given
|
105
|
+
# it will be called before any default options are added.
|
106
|
+
#
|
107
|
+
def options(&block)
|
108
|
+
@parser.separator ' Options:'
|
109
|
+
|
110
|
+
block.call(self) if block
|
111
|
+
|
112
|
+
@parser.on('-v','--verbose','produce excess output',&(@verbose_block))
|
113
|
+
@parser.on('-h','--help','print this message',&(@help_block))
|
114
|
+
@parser.separator ''
|
115
|
+
|
116
|
+
return self
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Adds an the argument with the specified _name_ and _description_
|
121
|
+
# to the arguments section of the help message of these options.
|
122
|
+
#
|
123
|
+
def arg(name,description)
|
124
|
+
@parser.separator " #{name}\t#{description}"
|
125
|
+
return self
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Creates an arguments section in the help message and calls the
|
130
|
+
# given _block_.
|
131
|
+
#
|
132
|
+
def arguments(&block)
|
133
|
+
if block
|
134
|
+
@parser.separator ' Arguments:'
|
135
|
+
|
136
|
+
block.call(self)
|
137
|
+
|
138
|
+
@parser.separator ''
|
139
|
+
end
|
140
|
+
|
141
|
+
return self
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# Addes a summary section with the specified _lines_.
|
146
|
+
#
|
147
|
+
def summary(*lines)
|
148
|
+
@parser.separator ' Summary:'
|
149
|
+
|
150
|
+
lines.each do |line|
|
151
|
+
@parser.separator " #{line}"
|
152
|
+
end
|
153
|
+
|
154
|
+
@parser.separator ''
|
155
|
+
return self
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
# Adds a defaults section with the specified _flags_.
|
160
|
+
#
|
161
|
+
def defaults(*flags)
|
162
|
+
@parser.separator ' Defaults:'
|
163
|
+
|
164
|
+
flags.each do |flag|
|
165
|
+
@parser.separator " #{flag}"
|
166
|
+
end
|
167
|
+
|
168
|
+
@parser.separator ''
|
169
|
+
return self
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# Prints the help message and exits successfully. If a _block_ is
|
174
|
+
# given it will be called after the help message has been print
|
175
|
+
# and before the Program has exited.
|
176
|
+
#
|
177
|
+
def help(&block)
|
178
|
+
Program.success do
|
179
|
+
puts @parser
|
180
|
+
|
181
|
+
block.call(self) if block
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
#
|
186
|
+
# Parses the specified _argv_ Array. If a _block_ is given it will
|
187
|
+
# be passed the left-over arguments. Returns the left-over arguments.
|
188
|
+
#
|
189
|
+
def parse(argv,&block)
|
190
|
+
args = @parser.parse(argv)
|
191
|
+
|
192
|
+
block.call(self,args) if block
|
193
|
+
return args
|
194
|
+
end
|
195
|
+
|
196
|
+
#
|
197
|
+
# Returns a String representation of the OptParse parser.
|
198
|
+
#
|
199
|
+
def to_s
|
200
|
+
@parser.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|