ronin 0.2.1 → 0.2.2

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.
Files changed (80) hide show
  1. data/History.txt +25 -0
  2. data/Manifest.txt +36 -11
  3. data/README.txt +6 -8
  4. data/Rakefile +2 -1
  5. data/lib/ronin/config.rb +0 -3
  6. data/lib/ronin/environment.rb +1 -1
  7. data/lib/ronin/extensions/string.rb +0 -11
  8. data/lib/ronin/formatting/extensions/binary/integer.rb +24 -12
  9. data/lib/ronin/formatting/extensions/binary/string.rb +166 -0
  10. data/lib/ronin/formatting/extensions/text/string.rb +4 -4
  11. data/lib/ronin/license.rb +42 -12
  12. data/lib/ronin/os.rb +3 -2
  13. data/lib/ronin/platform/extension.rb +11 -141
  14. data/lib/ronin/platform/extension_cache.rb +11 -0
  15. data/lib/ronin/platform/overlay.rb +56 -25
  16. data/lib/ronin/platform/overlay_cache.rb +1 -1
  17. data/lib/ronin/platform/platform.rb +14 -3
  18. data/lib/ronin/platform/ronin.rb +20 -1
  19. data/lib/ronin/platform/tasks/spec.rb +9 -0
  20. data/lib/ronin/{chars.rb → static.rb} +2 -2
  21. data/lib/ronin/static/finders.rb +144 -0
  22. data/lib/ronin/static/static.rb +53 -0
  23. data/lib/ronin/ui/command_line/commands/add.rb +21 -5
  24. data/lib/ronin/ui/command_line/commands/install.rb +19 -3
  25. data/lib/ronin/ui/command_line/commands/rm.rb +1 -1
  26. data/lib/ronin/ui/command_line/commands/uninstall.rb +1 -1
  27. data/lib/ronin/ui/command_line/commands/update.rb +9 -2
  28. data/lib/ronin/version.rb +1 -1
  29. data/spec/extensions/string_spec.rb +0 -10
  30. data/spec/formatting/binary/helpers/hexdumps.rb +14 -0
  31. data/spec/formatting/binary/helpers/hexdumps/hexdump_decimal_shorts.txt +17 -0
  32. data/spec/formatting/binary/helpers/hexdumps/hexdump_hex_bytes.txt +17 -0
  33. data/spec/formatting/binary/helpers/hexdumps/hexdump_hex_shorts.txt +17 -0
  34. data/spec/formatting/binary/helpers/hexdumps/hexdump_octal_bytes.txt +17 -0
  35. data/spec/formatting/binary/helpers/hexdumps/hexdump_octal_shorts.txt +17 -0
  36. data/spec/formatting/binary/helpers/hexdumps/hexdump_repeated.txt +6 -0
  37. data/spec/formatting/binary/helpers/hexdumps/od_decimal_bytes.txt +17 -0
  38. data/spec/formatting/binary/helpers/hexdumps/od_decimal_ints.txt +17 -0
  39. data/spec/formatting/binary/helpers/hexdumps/od_decimal_quads.txt +17 -0
  40. data/spec/formatting/binary/helpers/hexdumps/od_decimal_shorts.txt +17 -0
  41. data/spec/formatting/binary/helpers/hexdumps/od_hex_bytes.txt +17 -0
  42. data/spec/formatting/binary/helpers/hexdumps/od_hex_ints.txt +17 -0
  43. data/spec/formatting/binary/helpers/hexdumps/od_hex_quads.txt +17 -0
  44. data/spec/formatting/binary/helpers/hexdumps/od_hex_shorts.txt +17 -0
  45. data/spec/formatting/binary/helpers/hexdumps/od_octal_bytes.txt +17 -0
  46. data/spec/formatting/binary/helpers/hexdumps/od_octal_ints.txt +17 -0
  47. data/spec/formatting/binary/helpers/hexdumps/od_octal_quads.txt +17 -0
  48. data/spec/formatting/binary/helpers/hexdumps/od_octal_shorts.txt +17 -0
  49. data/spec/formatting/binary/helpers/hexdumps/od_repeated.txt +6 -0
  50. data/spec/formatting/binary/helpers/hexdumps/repeated.bin +1 -0
  51. data/spec/formatting/binary/integer_spec.rb +61 -1
  52. data/spec/formatting/binary/string_spec.rb +166 -9
  53. data/spec/platform/extension_cache_spec.rb +8 -0
  54. data/spec/platform/helpers/overlays.yaml.erb +3 -0
  55. data/spec/platform/helpers/overlays/hello/ronin.xml +1 -1
  56. data/spec/platform/helpers/overlays/random/random/extension.rb +7 -0
  57. data/spec/platform/helpers/overlays/random/ronin.xml +26 -0
  58. data/spec/platform/helpers/overlays/test1/ronin.xml +2 -2
  59. data/spec/platform/helpers/overlays/test2/ronin.xml +2 -2
  60. data/spec/platform/overlay_cache_spec.rb +5 -3
  61. data/spec/platform/overlay_spec.rb +35 -0
  62. data/spec/platform/ronin_spec.rb +13 -1
  63. data/spec/static/finders_spec.rb +55 -0
  64. data/spec/static/helpers/static.rb +11 -0
  65. data/spec/static/helpers/static1/dir/two.txt +0 -0
  66. data/spec/static/helpers/static1/one.txt +0 -0
  67. data/spec/static/helpers/static2/dir/two.txt +0 -0
  68. data/spec/static/helpers/static_class.rb +7 -0
  69. data/spec/static/static_spec.rb +24 -0
  70. data/static/{overlay.xsl → ronin/platform/overlay.xsl} +0 -0
  71. metadata +50 -17
  72. data/bin/ronin-ext +0 -12
  73. data/bin/ronin-overlay +0 -12
  74. data/lib/ronin/chars/char_set.rb +0 -198
  75. data/lib/ronin/chars/chars.rb +0 -190
  76. data/lib/ronin/ui/command_line/commands/ext.rb +0 -70
  77. data/lib/ronin/ui/command_line/commands/overlay.rb +0 -189
  78. data/spec/chars/char_set_spec.rb +0 -175
  79. data/spec/chars/chars_spec.rb +0 -107
  80. data/static/extension.rb +0 -9
@@ -1,189 +0,0 @@
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
- require 'ronin/ui/command_line/command'
25
- require 'ronin/platform/overlay'
26
- require 'ronin/version'
27
-
28
- require 'fileutils'
29
- require 'nokogiri'
30
-
31
- module Ronin
32
- module UI
33
- module CommandLine
34
- module Commands
35
- class Overlay < Command
36
-
37
- include Nokogiri
38
-
39
- def defaults
40
- @title = nil
41
- @source = nil
42
- @source_view = nil
43
- @website = nil
44
- @license = nil
45
- @maintainers = []
46
- @description = nil
47
- end
48
-
49
- def define_options(opts)
50
- opts.usage = '[options] PATH'
51
-
52
- opts.options do
53
- opts.on('-t','--title NAME','Name of the Overlay') do |title|
54
- @title = title
55
- end
56
-
57
- opts.on('-S','--source URL','The URL where the source of the Overlay will be hosted') do |url|
58
- @source = url
59
- end
60
-
61
- opts.on('-V','--source-view URL','The URL for viewing the contents of the Overlay') do |url|
62
- @source_view = url
63
- end
64
-
65
- opts.on('-U','--website URL','The URL of the website of the Overlay') do |url|
66
- @website = url
67
- end
68
-
69
- opts.on('-L','--license LICENSE','The license of the contents of the Overlay') do |license|
70
- @license = license
71
- end
72
-
73
- opts.on('-m','--maintainer "NAME <EMAIL>"','Name of a maintainer of the Overlay') do |text|
74
- name = text.scan(/^[^<]+[^<\s]/).first
75
- email = text.scan(/<([^<>]+)>\s*$/).first
76
-
77
- email = email.first if email
78
-
79
- @maintainers << {:name => name, :email => email}
80
- end
81
-
82
- opts.on('-D','--description TEXT','The description for the Overlay') do |text|
83
- @description = text
84
- end
85
- end
86
-
87
- opts.arguments(
88
- 'PATH' => 'The PATH of the Overlay to be created'
89
- )
90
-
91
- opts.summary('Create an empty Overlay at the specified PATH')
92
- end
93
-
94
- def arguments(*args)
95
- unless args.length == 1
96
- fail('only one Overlay path maybe specified')
97
- end
98
-
99
- path = File.expand_path(args.first)
100
-
101
- @title ||= File.basename(path).gsub(/[_\s]+/,' ').capitalize
102
- @source_view ||= @source
103
- @website ||= @source_view
104
-
105
- FileUtils.mkdir_p(path)
106
- FileUtils.mkdir_p(File.join(path,'lib'))
107
- FileUtils.mkdir_p(File.join(path,'objects'))
108
-
109
- File.open(File.join(path,Platform::Overlay::METADATA_FILE),'w') do |file|
110
- doc = XML::Document.new
111
- doc << XML::ProcessingInstruction.new(
112
- doc,
113
- 'xml-stylesheet',
114
- 'type="text/xsl" href="http://ronin.rubyforge.org/dist/overlay.xsl"'
115
- )
116
-
117
- root = XML::Node.new('ronin-overlay',doc)
118
- root['version'] = Ronin::VERSION
119
-
120
- title_tag = XML::Node.new('title',doc)
121
- title_tag << XML::Text.new(@title,doc)
122
- root << title_tag
123
-
124
- if @source
125
- source_tag = XML::Node.new('source',doc)
126
- source_tag << XML::Text.new(@source,doc)
127
- root << source_tag
128
- end
129
-
130
- if @source_view
131
- source_view_tag = XML::Node.new('source-view',doc)
132
- source_view_tag << XML::Text.new(@source_view,doc)
133
- root << source_view_tag
134
- end
135
-
136
- if @website
137
- url_tag = XML::Node.new('website',doc)
138
- url_tag << XML::Text.new(@website,doc)
139
- root << url_tag
140
- end
141
-
142
- if @license
143
- license_tag = XML::Node.new('license',doc)
144
- license_tag << XML::Text.new(@license,doc)
145
- root << license_tag
146
- end
147
-
148
- unless @maintainers.empty?
149
- maintainers_tag = XML::Node.new('maintainers',doc)
150
-
151
- @maintainers.each do |author|
152
- if (author[:name] || author[:email])
153
- maintainer_tag = XML::Node.new('maintainer',doc)
154
-
155
- if author[:name]
156
- name_tag = XML::Node.new('name',doc)
157
- name_tag << XML::Text.new(author[:name],doc)
158
- maintainer_tag << name_tag
159
- end
160
-
161
- if author[:email]
162
- email_tag = XML::Node.new('email',doc)
163
- email_tag << XML::Text.new(author[:email],doc)
164
- maintainer_tag << email_tag
165
- end
166
-
167
- maintainers_tag << maintainer_tag
168
- end
169
- end
170
-
171
- root << maintainers_tag
172
- end
173
-
174
- if @description
175
- description_tag = XML::Node.new('description',doc)
176
- description_tag << XML::Text.new(@description,doc)
177
- root << description_tag
178
- end
179
-
180
- doc << root
181
- doc.write_xml_to(file)
182
- end
183
- end
184
-
185
- end
186
- end
187
- end
188
- end
189
- end
@@ -1,175 +0,0 @@
1
- require 'ronin/chars/chars'
2
-
3
- require 'spec_helper'
4
-
5
- describe Chars::CharSet do
6
- before(:all) do
7
- @integer_range = (0x41..0x43)
8
- @string_range = ('A'..'C')
9
- @integers = @integer_range.to_a
10
- @strings = @string_range.to_a
11
-
12
- @char_set = Chars::CharSet.new(*@strings)
13
- end
14
-
15
- it "may be created with String arguments" do
16
- @chars = Chars::CharSet.new(*@strings)
17
-
18
- @strings.each do |s|
19
- @chars.include_char?(s).should == true
20
- end
21
- end
22
-
23
- it "may be created with an Array of Strings" do
24
- @chars = Chars::CharSet.new(@strings)
25
-
26
- @strings.each do |s|
27
- @chars.include_char?(s).should == true
28
- end
29
- end
30
-
31
- it "may be created with a Range of Strings" do
32
- @chars = Chars::CharSet.new(@string_range)
33
-
34
- @strings.each do |s|
35
- @chars.include_char?(s).should == true
36
- end
37
- end
38
-
39
- it "may be created with Integer arguments" do
40
- @chars = Chars::CharSet.new(*@integers)
41
-
42
- @integers.each do |i|
43
- @chars.include?(i).should == true
44
- end
45
- end
46
-
47
- it "may be created with an Array of Integers" do
48
- @chars = Chars::CharSet.new(@integers)
49
-
50
- @integers.each do |i|
51
- @chars.include?(i).should == true
52
- end
53
- end
54
-
55
- it "may be created with a Range of Integers" do
56
- @chars = Chars::CharSet.new(@integer_range)
57
-
58
- @integers.each do |i|
59
- @chars.include?(i).should == true
60
- end
61
- end
62
-
63
- it "should include Strings" do
64
- @char_set.include_char?('A').should == true
65
- end
66
-
67
- it "should include Integers" do
68
- @char_set.include?(0x41).should == true
69
- end
70
-
71
- it "should be able to select bytes" do
72
- @sub_chars = @char_set.select_bytes { |c| c <= 0x42 }
73
-
74
- @sub_chars.should == [0x41, 0x42]
75
- end
76
-
77
- it "should be able to select chars" do
78
- @sub_chars = @char_set.select_chars { |c| c <= 'B' }
79
-
80
- @sub_chars.should == ['A', 'B']
81
- end
82
-
83
- it "should return a random byte" do
84
- @char_set.include?(@char_set.random_byte).should == true
85
- end
86
-
87
- it "should return a random char" do
88
- @char_set.include_char?(@char_set.random_char).should == true
89
- end
90
-
91
- it "should iterate over n random bytes" do
92
- @char_set.each_random_byte(10) do |b|
93
- @char_set.include?(b).should == true
94
- end
95
- end
96
-
97
- it "should iterate over n random chars" do
98
- @char_set.each_random_char(10) do |c|
99
- @char_set.include_char?(c).should == true
100
- end
101
- end
102
-
103
- it "should return a random Array of bytes" do
104
- bytes = @char_set.random_bytes(10)
105
-
106
- bytes.each do |b|
107
- @char_set.include?(b).should == true
108
- end
109
- end
110
-
111
- it "should return a random Array of chars" do
112
- chars = @char_set.random_chars(10)
113
-
114
- chars.each do |c|
115
- @char_set.include_char?(c).should == true
116
- end
117
- end
118
-
119
- it "should return a random Array of bytes with a varying length" do
120
- bytes = @char_set.random_bytes(5..10)
121
-
122
- bytes.length.between?(5, 10).should == true
123
- bytes.each do |b|
124
- @char_set.include?(b).should == true
125
- end
126
- end
127
-
128
- it "should return a random Array of chars with a varying length" do
129
- chars = @char_set.random_chars(5..10)
130
-
131
- chars.length.between?(5, 10).should == true
132
- chars.each do |c|
133
- @char_set.include_char?(c).should == true
134
- end
135
- end
136
-
137
- it "should return a random String of chars" do
138
- @char_set.random_string(10).each_byte do |b|
139
- @char_set.include?(b).should == true
140
- end
141
- end
142
-
143
- it "should return a random String of chars with a varying length" do
144
- string = @char_set.random_string(5..10)
145
-
146
- string.length.between?(5, 10)
147
- string.each_byte do |b|
148
- @char_set.include?(b).should == true
149
- end
150
- end
151
-
152
- it "should be able to be compared with another set of chars" do
153
- (@char_set == Chars::CharSet['A', 'B', 'C']).should == true
154
- (@char_set == Chars::CharSet['A', 'C', 'B']).should == true
155
- end
156
-
157
- it "should be able to be unioned with another set of chars" do
158
- super_set = (@char_set | Chars::CharSet['D'])
159
-
160
- super_set.class.should == Chars::CharSet
161
- super_set.should == Chars::CharSet['A', 'B', 'C', 'D']
162
- end
163
-
164
- it "should be able to be removed from another set of chars" do
165
- sub_set = (@char_set - Chars::CharSet['B'])
166
-
167
- sub_set.class.should == Chars::CharSet
168
- sub_set.subset?(@char_set).should == true
169
- end
170
-
171
- it "should determine if a String is made up of the characters from the char set" do
172
- (@char_set =~ "AABCBAA").should == true
173
- (@char_set =~ "AADDEE").should_not == true
174
- end
175
- end
@@ -1,107 +0,0 @@
1
- require 'ronin/chars/chars'
2
-
3
- require 'spec_helper'
4
-
5
- describe Chars do
6
- before(:all) do
7
- @numeric_string = Chars.numeric.random_string(10)
8
- @octal_string = Chars.octal.random_string(10)
9
- @uppercase_hex_string = Chars.uppercase_hexadecimal.random_string(10)
10
- @lowercase_hex_string = Chars.lowercase_hexadecimal.random_string(10)
11
- @hex_string = Chars.hexadecimal.random_string(10)
12
- @uppercase_alpha_string = Chars.uppercase_alpha.random_string(10)
13
- @lowercase_alpha_string = Chars.lowercase_alpha.random_string(10)
14
- @alpha_string = Chars.alpha.random_string(10)
15
- @alpha_numeric_string = Chars.alpha_numeric.random_string(10)
16
- @space_string = Chars.space.random_string(10)
17
- @punctuation_string = Chars.punctuation.random_string(10)
18
- @symbols_string = Chars.symbols.random_string(10)
19
- @control_string = Chars.control.random_string(10)
20
- @ascii_string = Chars.ascii.random_string(10)
21
- @all_string = Chars.all.random_string(10)
22
- end
23
-
24
- it "should provide a numeric CharSet" do
25
- @numeric_string.length.should == 10
26
- @numeric_string.each_byte do |b|
27
- Chars::NUMERIC.include?(b).should == true
28
- end
29
- end
30
-
31
- it "should provide an octal CharSet" do
32
- @octal_string.length.should == 10
33
- @octal_string.each_byte do |b|
34
- Chars::OCTAL.include?(b).should == true
35
- end
36
- end
37
-
38
- it "should provide an upper-case hexadecimal CharSet" do
39
- @uppercase_hex_string.length.should == 10
40
- @uppercase_hex_string.each_byte do |b|
41
- Chars::UPPERCASE_HEXADECIMAL.include?(b).should == true
42
- end
43
- end
44
-
45
- it "should provide a lower-case hexadecimal CharSet" do
46
- @lowercase_hex_string.length.should == 10
47
- @lowercase_hex_string.each_byte do |b|
48
- Chars::LOWERCASE_HEXADECIMAL.include?(b).should == true
49
- end
50
- end
51
-
52
- it "should provide a hexadecimal CharSet" do
53
- @hex_string.length.should == 10
54
- @hex_string.each_byte do |b|
55
- Chars::HEXADECIMAL.include?(b).should == true
56
- end
57
- end
58
-
59
- it "should provide an upper-case alpha CharSet" do
60
- @uppercase_alpha_string.length.should == 10
61
- @uppercase_alpha_string.each_byte do |b|
62
- Chars::UPPERCASE_ALPHA.include?(b).should == true
63
- end
64
- end
65
-
66
- it "should provide a lower-case alpha CharSet" do
67
- @lowercase_alpha_string.length.should == 10
68
- @lowercase_alpha_string.each_byte do |b|
69
- Chars::LOWERCASE_ALPHA.include?(b).should == true
70
- end
71
- end
72
-
73
- it "should provide an alpha CharSet" do
74
- @alpha_string.length.should == 10
75
- @alpha_string.each_byte do |b|
76
- Chars::ALPHA.include?(b).should == true
77
- end
78
- end
79
-
80
- it "should provide an alpha-numeric CharSet" do
81
- @alpha_numeric_string.length.should == 10
82
- @alpha_numeric_string.each_byte do |b|
83
- Chars::ALPHA_NUMERIC.include?(b).should == true
84
- end
85
- end
86
-
87
- it "should provide a space CharSet" do
88
- @space_string.length.should == 10
89
- @space_string.each_byte do |b|
90
- Chars::SPACE.include?(b).should == true
91
- end
92
- end
93
-
94
- it "should provide a punctuation CharSet" do
95
- @punctuation_string.length.should == 10
96
- @punctuation_string.each_byte do |b|
97
- Chars::PUNCTUATION.include?(b).should == true
98
- end
99
- end
100
-
101
- it "should provide a symbols CharSet" do
102
- @symbols_string.length.should == 10
103
- @symbols_string.each_byte do |b|
104
- Chars::SYMBOLS.include?(b).should == true
105
- end
106
- end
107
- end