ronin 0.1.4 → 0.2.0
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/History.txt +50 -0
- data/Manifest.txt +31 -19
- data/README.txt +27 -19
- data/Rakefile +1 -1
- data/TODO.txt +1 -7
- data/lib/ronin.rb +1 -11
- data/lib/ronin/database/database.rb +1 -1
- data/lib/ronin/{cache/config.rb → environment.rb} +10 -8
- data/lib/ronin/formatting.rb +0 -1
- data/lib/ronin/formatting/extensions.rb +0 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +10 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +11 -0
- data/lib/ronin/formatting/extensions/http/string.rb +1 -1
- data/lib/ronin/network/extensions/http/net.rb +8 -0
- data/lib/ronin/objectify/objectify.rb +0 -47
- data/lib/ronin/os.rb +89 -0
- data/lib/ronin/platform.rb +4 -77
- data/lib/ronin/{cache → platform}/exceptions.rb +2 -2
- data/lib/ronin/{cache → platform}/exceptions/extension_not_found.rb +1 -1
- data/lib/ronin/{cache → platform}/exceptions/overlay_cached.rb +1 -1
- data/lib/ronin/{cache → platform}/exceptions/overlay_not_found.rb +1 -1
- data/lib/ronin/{cache → platform}/extension.rb +68 -177
- data/lib/ronin/{cache → platform}/extension_cache.rb +9 -7
- data/lib/ronin/{cache → platform}/maintainer.rb +1 -1
- data/lib/ronin/platform/object_cache.rb +94 -0
- data/lib/ronin/platform/overlay.rb +274 -0
- data/lib/ronin/platform/overlay_cache.rb +318 -0
- data/lib/ronin/platform/platform.rb +195 -0
- data/lib/ronin/{cache → platform}/ronin.rb +7 -6
- data/lib/ronin/target.rb +5 -5
- data/lib/ronin/ui.rb +4 -1
- data/lib/ronin/ui/command_line/command_line.rb +0 -1
- data/lib/ronin/ui/command_line/commands/add.rb +21 -6
- data/lib/ronin/ui/command_line/commands/default.rb +6 -1
- data/lib/ronin/ui/command_line/commands/extension.rb +3 -3
- data/lib/ronin/ui/command_line/commands/install.rb +16 -5
- data/lib/ronin/ui/command_line/commands/list.rb +31 -8
- data/lib/ronin/ui/command_line/commands/overlay.rb +10 -9
- data/lib/ronin/ui/command_line/commands/remove.rb +16 -5
- data/lib/ronin/ui/command_line/commands/uninstall.rb +16 -5
- data/lib/ronin/ui/command_line/commands/update.rb +16 -3
- data/lib/ronin/ui/console.rb +81 -77
- data/lib/ronin/ui/diagnostics.rb +73 -0
- data/lib/ronin/version.rb +1 -1
- data/spec/chars/chars_spec.rb +1 -3
- data/spec/formatting/binary/integer_spec.rb +48 -36
- data/spec/formatting/binary/string_spec.rb +66 -4
- data/spec/os_spec.rb +24 -0
- data/spec/platform/extension_cache_spec.rb +42 -0
- data/spec/platform/extension_spec.rb +62 -0
- data/spec/platform/helpers/overlays.rb +18 -0
- data/spec/platform/helpers/overlays.yaml.erb +10 -0
- data/spec/platform/helpers/overlays/hello/hello/extension.rb +7 -0
- data/spec/platform/helpers/overlays/hello/ronin.xml +26 -0
- data/spec/platform/helpers/overlays/test1/ronin.xml +26 -0
- data/spec/platform/helpers/overlays/test1/test/extension.rb +7 -0
- data/spec/platform/helpers/overlays/test2/ronin.xml +26 -0
- data/spec/platform/helpers/overlays/test2/test/extension.rb +7 -0
- data/spec/platform/overlay_cache_spec.rb +63 -0
- data/spec/platform/platform_spec.rb +14 -0
- data/spec/platform/ronin_spec.rb +22 -0
- data/spec/target_spec.rb +1 -1
- data/spec/ui/diagnostics_spec.rb +17 -0
- metadata +34 -22
- data/lib/ronin/cache.rb +0 -27
- data/lib/ronin/cache/cache.rb +0 -78
- data/lib/ronin/cache/overlay.rb +0 -470
- data/lib/ronin/cache/overlay_cache.rb +0 -216
- data/lib/ronin/formatting/extensions/html.rb +0 -24
- data/lib/ronin/formatting/extensions/html/string.rb +0 -75
- data/lib/ronin/formatting/html.rb +0 -24
- data/spec/formatting/html_spec.rb +0 -46
- data/spec/platform_spec.rb +0 -24
@@ -22,7 +22,7 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
require 'ronin/ui/command_line/command'
|
25
|
-
require 'ronin/
|
25
|
+
require 'ronin/platform/overlay'
|
26
26
|
require 'ronin/version'
|
27
27
|
|
28
28
|
require 'fileutils'
|
@@ -38,7 +38,7 @@ module Ronin
|
|
38
38
|
command :overlay
|
39
39
|
|
40
40
|
def initialize
|
41
|
-
@
|
41
|
+
@title = nil
|
42
42
|
@source = nil
|
43
43
|
@source_view = nil
|
44
44
|
@website = nil
|
@@ -53,8 +53,8 @@ module Ronin
|
|
53
53
|
opts.usage = '[options] PATH'
|
54
54
|
|
55
55
|
opts.options do
|
56
|
-
opts.on('-
|
57
|
-
@
|
56
|
+
opts.on('-t','--title NAME','Name of the Overlay') do |title|
|
57
|
+
@title = title
|
58
58
|
end
|
59
59
|
|
60
60
|
opts.on('-S','--source URL','The URL where the source of the Overlay will be hosted') do |url|
|
@@ -101,14 +101,15 @@ module Ronin
|
|
101
101
|
|
102
102
|
path = File.expand_path(args.first)
|
103
103
|
|
104
|
-
@
|
104
|
+
@title ||= File.basename(path).gsub(/[_\s]+/,' ').capitalize
|
105
105
|
@source_view ||= @source
|
106
106
|
@website ||= @source_view
|
107
107
|
|
108
108
|
FileUtils.mkdir_p(path)
|
109
|
+
FileUtils.mkdir_p(File.join(path,'lib'))
|
109
110
|
FileUtils.mkdir_p(File.join(path,'objects'))
|
110
111
|
|
111
|
-
File.open(File.join(path,
|
112
|
+
File.open(File.join(path,Platform::Overlay::METADATA_FILE),'w') do |file|
|
112
113
|
doc = Document.new
|
113
114
|
doc.add(XMLDecl.new)
|
114
115
|
doc.add(Instruction.new('xml-stylesheet','type="text/xsl" href="http://ronin.rubyforge.org/dist/overlay.xsl"'))
|
@@ -116,9 +117,9 @@ module Ronin
|
|
116
117
|
root = Element.new('ronin-overlay')
|
117
118
|
root.attributes['version'] = Ronin::VERSION
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
root.add_element(
|
120
|
+
title_tag = Element.new('title')
|
121
|
+
title_tag.text = @title
|
122
|
+
root.add_element(title_tag)
|
122
123
|
|
123
124
|
if @source
|
124
125
|
source_tag = Element.new('source')
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
require 'ronin/ui/command_line/command'
|
25
|
-
require 'ronin/
|
25
|
+
require 'ronin/platform/overlay'
|
26
26
|
|
27
27
|
module Ronin
|
28
28
|
module UI
|
@@ -31,10 +31,21 @@ module Ronin
|
|
31
31
|
|
32
32
|
command :remove, :rm
|
33
33
|
|
34
|
+
def initialize
|
35
|
+
@cache = nil
|
36
|
+
@verbose = false
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
34
41
|
def define_options(opts)
|
35
42
|
opts.usage = 'NAME [...] [options]'
|
36
43
|
|
37
44
|
opts.options do
|
45
|
+
opts.on('-C','--cache DIR','Specify an alternate overlay cache') do |dir|
|
46
|
+
@cache = dir
|
47
|
+
end
|
48
|
+
|
38
49
|
opts.on('-v','--verbose','Enable verbose output') do
|
39
50
|
@verbose = true
|
40
51
|
end
|
@@ -48,11 +59,11 @@ module Ronin
|
|
48
59
|
end
|
49
60
|
|
50
61
|
def arguments(*args)
|
62
|
+
Platform.load_overlays(@cache) if @cache
|
63
|
+
|
51
64
|
args.each do |name|
|
52
|
-
|
53
|
-
|
54
|
-
puts "Removing #{overlay.name.dump} ..."
|
55
|
-
end
|
65
|
+
Platform.remove(name) do |overlay|
|
66
|
+
puts "Removing #{overlay.name.dump} ..."
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
require 'ronin/ui/command_line/command'
|
25
|
-
require 'ronin/
|
25
|
+
require 'ronin/platform/overlay'
|
26
26
|
|
27
27
|
module Ronin
|
28
28
|
module UI
|
@@ -31,10 +31,21 @@ module Ronin
|
|
31
31
|
|
32
32
|
command :uninstall
|
33
33
|
|
34
|
+
def initialize
|
35
|
+
@cache = nil
|
36
|
+
@verbose = false
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
34
41
|
def define_options(opts)
|
35
42
|
opts.usage = 'NAME [NAME ...] [options]'
|
36
43
|
|
37
44
|
opts.options do
|
45
|
+
opts.on('-C','--cache DIR','Specify an alternate overlay cache') do |dir|
|
46
|
+
@cache = dir
|
47
|
+
end
|
48
|
+
|
38
49
|
opts.on('-v','--verbose','Enable verbose output') do
|
39
50
|
@verbose = true
|
40
51
|
end
|
@@ -48,11 +59,11 @@ module Ronin
|
|
48
59
|
end
|
49
60
|
|
50
61
|
def arguments(*args)
|
62
|
+
Platform.load_overlays(@cache) if @cache
|
63
|
+
|
51
64
|
args.each do |name|
|
52
|
-
|
53
|
-
|
54
|
-
puts "Uninstalling #{overlay.name.dump} ..."
|
55
|
-
end
|
65
|
+
Platform.uninstall(name) do |overlay|
|
66
|
+
puts "Uninstalling #{overlay.name.dump} ..."
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
require 'ronin/ui/command_line/command'
|
25
|
-
require 'ronin/
|
25
|
+
require 'ronin/platform/overlay'
|
26
26
|
|
27
27
|
module Ronin
|
28
28
|
module UI
|
@@ -31,10 +31,21 @@ module Ronin
|
|
31
31
|
|
32
32
|
command :update, :up
|
33
33
|
|
34
|
+
def initialize
|
35
|
+
@cache = nil
|
36
|
+
@verbose = false
|
37
|
+
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
34
41
|
def define_options(opts)
|
35
42
|
opts.usage = '[NAME ...] [options]'
|
36
43
|
|
37
44
|
opts.options do
|
45
|
+
opts.on('-C','--cache DIR','Specify an alternate overlay cache') do |dir|
|
46
|
+
@cache = dir
|
47
|
+
end
|
48
|
+
|
38
49
|
opts.on('-v','--verbose','Enable verbose output') do
|
39
50
|
@verbose = true
|
40
51
|
end
|
@@ -48,10 +59,12 @@ module Ronin
|
|
48
59
|
end
|
49
60
|
|
50
61
|
def arguments(*args)
|
62
|
+
Platform.load_overlays(@cache) if @cache
|
63
|
+
|
51
64
|
if args.empty?
|
52
|
-
|
65
|
+
Platform.overlays.each_overlay { |overlay| overlay.update }
|
53
66
|
else
|
54
|
-
args.each { |name|
|
67
|
+
args.each { |name| Platform.overlays.update(name) }
|
55
68
|
end
|
56
69
|
end
|
57
70
|
|
data/lib/ronin/ui/console.rb
CHANGED
@@ -27,101 +27,105 @@ require 'irb'
|
|
27
27
|
require 'irb/completion'
|
28
28
|
|
29
29
|
module Ronin
|
30
|
-
module
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
module UI
|
31
|
+
module Console
|
32
|
+
#
|
33
|
+
# Returns the default Console prompt style
|
34
|
+
#
|
35
|
+
def Console.prompt
|
36
|
+
@@ronin_console_prompt ||= :SIMPLE
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
#
|
40
|
+
# Sets the default Console prompt style to the specified _style_.
|
41
|
+
#
|
42
|
+
def Console.prompt=(style)
|
43
|
+
@@ronin_console_prompt = style
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
#
|
47
|
+
# Returns the default Console indent setting.
|
48
|
+
#
|
49
|
+
def Console.indent
|
50
|
+
@@ronin_console_indent ||= true
|
51
|
+
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
#
|
54
|
+
# Sets the default Console indent setting.
|
55
|
+
#
|
56
|
+
def Console.indent=(value)
|
57
|
+
@@ronin_console_indent = value
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
#
|
61
|
+
# Returns the Array of files to require when the Console starts.
|
62
|
+
#
|
63
|
+
def Console.auto_load
|
64
|
+
@@ronin_console_auto_load ||= []
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
#
|
68
|
+
# Calls the specified _block_ from within the Console after it is
|
69
|
+
# started.
|
70
|
+
#
|
71
|
+
def Console.setup(&block)
|
72
|
+
Console.setup_blocks << block if block
|
73
|
+
end
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
#
|
76
|
+
# Starts a Console with the given _script_. If a _block_ is given, it
|
77
|
+
# will be called from within the Console.
|
78
|
+
#
|
79
|
+
def Console.start(script=nil,&block)
|
80
|
+
IRB.setup(script)
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
IRB.conf[:LOAD_MODULES] = Console.auto_load
|
82
|
+
IRB.conf[:IRB_NAME] = 'ronin'
|
83
|
+
IRB.conf[:PROMPT_MODE] = Console.prompt
|
84
|
+
IRB.conf[:AUTO_INDENT] = Console.indent
|
85
85
|
|
86
|
-
|
86
|
+
irb = IRB::Irb.new(nil,script)
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
require 'pp'
|
88
|
+
# configure the irb workspace
|
89
|
+
irb.context.main.instance_eval do
|
90
|
+
require 'ronin/environment'
|
92
91
|
|
93
|
-
|
94
|
-
|
92
|
+
Ronin::UI::Console.auto_load.each do |path|
|
93
|
+
require path
|
94
|
+
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
end
|
96
|
+
include Ronin
|
97
|
+
end
|
99
98
|
|
100
|
-
|
101
|
-
|
99
|
+
Console.setup_blocks.each do |setup_block|
|
100
|
+
irb.context.main.instance_eval(&setup_block)
|
101
|
+
end
|
102
102
|
|
103
|
-
|
103
|
+
# Load console configuration block is given
|
104
|
+
irb.context.main.instance_eval(&block) if block
|
104
105
|
|
105
|
-
|
106
|
-
irb.signal_handle
|
107
|
-
end
|
106
|
+
IRB.conf[:MAIN_CONTEXT] = irb.context
|
108
107
|
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
trap('SIGINT') do
|
109
|
+
irb.signal_handle
|
110
|
+
end
|
112
111
|
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
catch(:IRB_EXIT) do
|
113
|
+
irb.eval_input
|
114
|
+
end
|
116
115
|
|
117
|
-
|
116
|
+
putc "\n"
|
117
|
+
return nil
|
118
|
+
end
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
protected
|
121
|
+
|
122
|
+
#
|
123
|
+
# Returns the Array of setup_blocks to run within the Console after it
|
124
|
+
# is started.
|
125
|
+
#
|
126
|
+
def Console.setup_blocks
|
127
|
+
@@console_setup_blocks ||= []
|
128
|
+
end
|
125
129
|
end
|
126
130
|
end
|
127
131
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
4
|
+
# exploration tasks.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006-2009 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 UI
|
26
|
+
module Diagnostics
|
27
|
+
def Diagnostics.enable!
|
28
|
+
@@ronin_diagnostics = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def Diagnostics.enabled?
|
32
|
+
(@@ronin_diagnostics ||= false) == true
|
33
|
+
end
|
34
|
+
|
35
|
+
def Diagnostics.disable!
|
36
|
+
@@ronin_diagnostics = false
|
37
|
+
end
|
38
|
+
|
39
|
+
def Diagnostics.disabled?
|
40
|
+
(@@ronin_diagnostics ||= false) == false
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
#
|
46
|
+
# Prints the given _messages_ as info diagnostics.
|
47
|
+
#
|
48
|
+
def print_info(*messages)
|
49
|
+
if Diagnostics.enabled?
|
50
|
+
STDERR.puts(*(messages.map { |mesg| "[-] #{mesg}" }))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Prints the given _messages_ as warning diagnostics.
|
56
|
+
#
|
57
|
+
def print_warning(*messages)
|
58
|
+
if Diagnostics.enabled?
|
59
|
+
STDERR.puts(*(messages.map { |mesg| "[*] #{mesg}" }))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Prints the given _messages_ as error diagnostics.
|
65
|
+
#
|
66
|
+
def print_error(*messages)
|
67
|
+
if Diagnostics.enabled?
|
68
|
+
STDERR.puts(*(messages.map { |mesg| "[!] #{mesg}" }))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|