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
data/lib/ronin/version.rb
CHANGED
data/spec/chars/chars_spec.rb
CHANGED
@@ -66,8 +66,6 @@ describe Chars do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should provide a symbols CharSet" do
|
69
|
-
|
70
|
-
(@symbols_string =~ /[\@\#\$\%\^\&\*\_\+\=\|\\\<\>\/]{10}/).should_not be_nil
|
71
|
-
end
|
69
|
+
(@symbols_string =~ /[\@\#\$\%\^\&\*\_\+\=\|\\\<\>\/]/).should_not be_nil
|
72
70
|
end
|
73
71
|
end
|
@@ -3,53 +3,65 @@ require 'ronin/formatting/binary'
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Integer do
|
6
|
-
before(:all) do
|
7
|
-
@integer = 0x1337
|
8
|
-
|
9
|
-
@i386_packed_int = "7\023\000\000"
|
10
|
-
@i386_packed_short = "7\023"
|
11
|
-
@i386_packed_long = "7\023\000\000"
|
12
|
-
@i386_packed_quad = "7\023\000\000\000\000\000\000"
|
13
|
-
|
14
|
-
@ppc_packed_int = "\000\000\0237"
|
15
|
-
@ppc_packed_short = "\0237"
|
16
|
-
@ppc_packed_long = "\000\000\0237"
|
17
|
-
@ppc_packed_quad = "\000\000\000\000\000\000\0237"
|
18
|
-
end
|
19
|
-
|
20
6
|
it "should provide Integer#pack" do
|
21
|
-
|
7
|
+
Integer.instance_method('pack').should_not be_nil
|
22
8
|
end
|
23
9
|
|
24
|
-
it "
|
25
|
-
|
10
|
+
it "should provide Integer#hex_escape" do
|
11
|
+
Integer.instance_method('hex_escape').should_not be_nil
|
26
12
|
end
|
27
13
|
|
28
|
-
|
29
|
-
|
30
|
-
|
14
|
+
describe "pack" do
|
15
|
+
before(:all) do
|
16
|
+
@integer = 0x1337
|
31
17
|
|
32
|
-
|
33
|
-
|
34
|
-
|
18
|
+
@i386_packed_int = "7\023\000\000"
|
19
|
+
@i386_packed_short = "7\023"
|
20
|
+
@i386_packed_long = "7\023\000\000"
|
21
|
+
@i386_packed_quad = "7\023\000\000\000\000\000\000"
|
35
22
|
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
@ppc_packed_int = "\000\000\0237"
|
24
|
+
@ppc_packed_short = "\0237"
|
25
|
+
@ppc_packed_long = "\000\000\0237"
|
26
|
+
@ppc_packed_quad = "\000\000\000\000\000\000\0237"
|
27
|
+
end
|
39
28
|
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
it "should pack itself for a little-endian architecture" do
|
30
|
+
@integer.pack(Arch.i386).should == @i386_packed_int
|
31
|
+
end
|
43
32
|
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
it "should pack itself as a short for a little-endian architecture" do
|
34
|
+
@integer.pack(Arch.i386,2).should == @i386_packed_short
|
35
|
+
end
|
36
|
+
|
37
|
+
it "Integer#pack should pack itself as a long for a little-endian architecture" do
|
38
|
+
@integer.pack(Arch.i386,4).should == @i386_packed_long
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should pack itself as a quad for a little-endian architecture" do
|
42
|
+
@integer.pack(Arch.i386,8).should == @i386_packed_quad
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should pack itself for a big-endian architecture" do
|
46
|
+
@integer.pack(Arch.ppc).should == @ppc_packed_int
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should pack itself as a short for a big-endian architecture" do
|
50
|
+
@integer.pack(Arch.ppc,2).should == @ppc_packed_short
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should pack itself as a long for a big-endian architecture" do
|
54
|
+
@integer.pack(Arch.ppc,4).should == @ppc_packed_long
|
55
|
+
end
|
47
56
|
|
48
|
-
|
49
|
-
|
57
|
+
it "should pack itself as a quad for a big-endian architecture" do
|
58
|
+
@integer.pack(Arch.ppc,8).should == @ppc_packed_quad
|
59
|
+
end
|
50
60
|
end
|
51
61
|
|
52
|
-
|
53
|
-
|
62
|
+
describe "hex_escape" do
|
63
|
+
it "should hex escape an Integer" do
|
64
|
+
42.hex_escape.should == "\\x2a"
|
65
|
+
end
|
54
66
|
end
|
55
67
|
end
|
@@ -3,12 +3,74 @@ require 'ronin/formatting/binary'
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe String do
|
6
|
-
|
7
|
-
|
6
|
+
it "should provide String#depack" do
|
7
|
+
String.instance_method('depack').should_not be_nil
|
8
8
|
end
|
9
9
|
|
10
|
-
it "should provide String#
|
11
|
-
|
10
|
+
it "should provide String#hex_escape" do
|
11
|
+
String.instance_method('hex_escape').should_not be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should provide String#xor" do
|
15
|
+
String.instance_method('xor').should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "pack" do
|
19
|
+
before(:all) do
|
20
|
+
@integer = 0x1337
|
21
|
+
|
22
|
+
@i386_packed_int = "7\023\000\000"
|
23
|
+
@i386_packed_short = "7\023"
|
24
|
+
@i386_packed_long = "7\023\000\000"
|
25
|
+
@i386_packed_quad = "7\023\000\000\000\000\000\000"
|
26
|
+
|
27
|
+
@ppc_packed_int = "\000\000\0237"
|
28
|
+
@ppc_packed_short = "\0237"
|
29
|
+
@ppc_packed_long = "\000\000\0237"
|
30
|
+
@ppc_packed_quad = "\000\000\000\000\000\000\0237"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should pack itself for a little-endian architecture" do
|
34
|
+
@i386_packed_int.depack(Arch.i386).should == @integer
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should pack itself as a short for a little-endian architecture" do
|
38
|
+
@i386_packed_short.depack(Arch.i386,2).should == @integer
|
39
|
+
end
|
40
|
+
|
41
|
+
it "Integer#pack should pack itself as a long for a little-endian architecture" do
|
42
|
+
@i386_packed_long.depack(Arch.i386,4).should == @integer
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should pack itself as a quad for a little-endian architecture" do
|
46
|
+
@i386_packed_quad.depack(Arch.i386,8).should == @integer
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should pack itself for a big-endian architecture" do
|
50
|
+
@ppc_packed_int.depack(Arch.ppc).should == @integer
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should pack itself as a short for a big-endian architecture" do
|
54
|
+
@ppc_packed_short.depack(Arch.ppc,2).should == @integer
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should pack itself as a long for a big-endian architecture" do
|
58
|
+
@ppc_packed_long.depack(Arch.ppc,4).should == @integer
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should pack itself as a quad for a big-endian architecture" do
|
62
|
+
@ppc_packed_quad.depack(Arch.ppc,8).should == @integer
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "hex_escape" do
|
67
|
+
before(:all) do
|
68
|
+
@binary_string = "hello\x4e"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should hex escape a String" do
|
72
|
+
@binary_string.hex_escape.should == "\\x68\\x65\\x6c\\x6c\\x6f\\x4e"
|
73
|
+
end
|
12
74
|
end
|
13
75
|
|
14
76
|
describe "xor" do
|
data/spec/os_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'ronin/os'
|
2
|
+
|
3
|
+
require 'helpers/database'
|
4
|
+
|
5
|
+
describe OS do
|
6
|
+
it "should require os and version attributes" do
|
7
|
+
@os = OS.new
|
8
|
+
@os.should_not be_valid
|
9
|
+
|
10
|
+
@os.name = 'test'
|
11
|
+
@os.should_not be_valid
|
12
|
+
|
13
|
+
@os.version = '0.0.1'
|
14
|
+
@os.should be_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should provide methods for built-in OSes" do
|
18
|
+
OS.linux.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should provide methods for creating OSes with versions" do
|
22
|
+
OS.linux_version('2.6.11').should be_valid
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'ronin/platform/extension_cache'
|
2
|
+
|
3
|
+
require 'platform/helpers/overlays'
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe Platform::ExtensionCache do
|
7
|
+
before(:all) do
|
8
|
+
Platform.load_overlays(overlay_cache_path)
|
9
|
+
|
10
|
+
@cache = Platform::ExtensionCache.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be able to load an extension from the overlays" do
|
14
|
+
ext = @cache.load_extension('test')
|
15
|
+
|
16
|
+
ext.should_not be_nil
|
17
|
+
ext.name.should == 'test'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should provide transparent caching of extensions" do
|
21
|
+
ext = @cache['test']
|
22
|
+
ext.should_not be_nil
|
23
|
+
ext.name.should == 'test'
|
24
|
+
|
25
|
+
@cache['test'].should == ext
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should load together the extension from all overlays" do
|
29
|
+
ext = @cache.load_extension('test')
|
30
|
+
|
31
|
+
ext.should_not be_nil
|
32
|
+
ext.test1.should == 'test one'
|
33
|
+
ext.test2.should == 'test two'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have loaded extensions with multiple paths" do
|
37
|
+
paths = @cache.load_extension('test').paths
|
38
|
+
|
39
|
+
paths.length.should == 2
|
40
|
+
paths.select { |path| path =~ /test$/ }.should == paths
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'ronin/platform/extension'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Platform::Extension do
|
6
|
+
before(:each) do
|
7
|
+
@ext = Platform::Extension.new('test') do
|
8
|
+
setup do
|
9
|
+
@var = :setup
|
10
|
+
end
|
11
|
+
|
12
|
+
teardown do
|
13
|
+
@var = :toredown
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_method
|
17
|
+
:method
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_method
|
21
|
+
@var = :running
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should allow for custom methods" do
|
27
|
+
@ext.has_method?(:test_method).should == true
|
28
|
+
@ext.test_method.should == :method
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have a setup state" do
|
32
|
+
@ext.setup!
|
33
|
+
@ext.should be_setup
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have setup blocks" do
|
37
|
+
@ext.setup!
|
38
|
+
@ext.instance_eval { @var }.should == :setup
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have a toredown state" do
|
42
|
+
@ext.teardown!
|
43
|
+
@ext.should be_toredown
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have teardown blocks" do
|
47
|
+
@ext.setup!
|
48
|
+
@ext.teardown!
|
49
|
+
@ext.instance_eval { @var }.should == :toredown
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should not be torendown before it is setup" do
|
53
|
+
@ext.teardown!
|
54
|
+
@ext.instance_eval { @var }.should be_nil
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should be able to be ran" do
|
58
|
+
@ext.run do |ext|
|
59
|
+
ext.run_method.should == :running
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
OVERLAY_CACHE = File.expand_path(File.join(File.dirname(__FILE__),'overlays'))
|
5
|
+
|
6
|
+
def overlay_cache_path(&block)
|
7
|
+
file = Tempfile.new('overlays.yaml')
|
8
|
+
path = file.path
|
9
|
+
|
10
|
+
template_path = File.join(File.dirname(__FILE__),'overlays.yaml.erb')
|
11
|
+
template = ERB.new(File.read(template_path))
|
12
|
+
|
13
|
+
file.write(template.result(binding))
|
14
|
+
file.close
|
15
|
+
|
16
|
+
block.call(path) if block
|
17
|
+
return path
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<?xml-stylesheet type="text/xsl" href="http://ronin.rubyforge.org/dist/overlay.xsl"?>
|
3
|
+
<ronin-overlay version='0.1.5'>
|
4
|
+
<title>
|
5
|
+
Hello World
|
6
|
+
</title>
|
7
|
+
<website>
|
8
|
+
http://ronin.rubyforge.org/
|
9
|
+
</website>
|
10
|
+
<license>
|
11
|
+
GPL-2
|
12
|
+
</license>
|
13
|
+
<maintainers>
|
14
|
+
<maintainer>
|
15
|
+
<name>
|
16
|
+
Postmodern
|
17
|
+
</name>
|
18
|
+
<email>
|
19
|
+
postmodern.mod3@gmail.com
|
20
|
+
</email>
|
21
|
+
</maintainer>
|
22
|
+
</maintainers>
|
23
|
+
<description>
|
24
|
+
This is a test overlay used in Ronin's specs.
|
25
|
+
</description>
|
26
|
+
</ronin-overlay>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<?xml-stylesheet type="text/xsl" href="http://ronin.rubyforge.org/dist/overlay.xsl"?>
|
3
|
+
<ronin-overlay version='0.1.5'>
|
4
|
+
<title>
|
5
|
+
Test One
|
6
|
+
</title>
|
7
|
+
<website>
|
8
|
+
http://ronin.rubyforge.org/
|
9
|
+
</website>
|
10
|
+
<license>
|
11
|
+
GPL-2
|
12
|
+
</license>
|
13
|
+
<maintainers>
|
14
|
+
<maintainer>
|
15
|
+
<name>
|
16
|
+
Postmodern
|
17
|
+
</name>
|
18
|
+
<email>
|
19
|
+
postmodern.mod3@gmail.com
|
20
|
+
</email>
|
21
|
+
</maintainer>
|
22
|
+
</maintainers>
|
23
|
+
<description>
|
24
|
+
This is a test overlay used in Ronin's specs.
|
25
|
+
</description>
|
26
|
+
</ronin-overlay>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version='1.0'?>
|
2
|
+
<?xml-stylesheet type="text/xsl" href="http://ronin.rubyforge.org/dist/overlay.xsl"?>
|
3
|
+
<ronin-overlay version='0.1.5'>
|
4
|
+
<title>
|
5
|
+
Test Two
|
6
|
+
</title>
|
7
|
+
<website>
|
8
|
+
http://ronin.rubyforge.org/
|
9
|
+
</website>
|
10
|
+
<license>
|
11
|
+
GPL-2
|
12
|
+
</license>
|
13
|
+
<maintainers>
|
14
|
+
<maintainer>
|
15
|
+
<name>
|
16
|
+
Postmodern
|
17
|
+
</name>
|
18
|
+
<email>
|
19
|
+
postmodern.mod3@gmail.com
|
20
|
+
</email>
|
21
|
+
</maintainer>
|
22
|
+
</maintainers>
|
23
|
+
<description>
|
24
|
+
This is a test overlay used in Ronin's specs.
|
25
|
+
</description>
|
26
|
+
</ronin-overlay>
|