ronin 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
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
data/bin/ronin-ext DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
-
5
- lib_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
6
- unless $LOAD_PATH.include?(lib_dir)
7
- $LOAD_PATH << lib_dir
8
- end
9
-
10
- require 'ronin/ui/command_line/commands/ext'
11
-
12
- Ronin::UI::CommandLine::Commands::Ext.run(*ARGV)
data/bin/ronin-overlay DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
-
5
- lib_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
6
- unless $LOAD_PATH.include?(lib_dir)
7
- $LOAD_PATH << lib_dir
8
- end
9
-
10
- require 'ronin/ui/command_line/commands/overlay'
11
-
12
- Ronin::UI::CommandLine::Commands::Overlay.run(*ARGV)
@@ -1,198 +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 'set'
25
-
26
- module Ronin
27
- module Chars
28
- class CharSet < SortedSet
29
-
30
- #
31
- # Creates a new CharSet object with the given _chars_.
32
- #
33
- def initialize(*chars)
34
- super()
35
-
36
- merge_chars = lambda { |element|
37
- if element.kind_of?(String)
38
- element.each_byte(&merge_chars)
39
- elsif element.kind_of?(Integer)
40
- self << element
41
- elsif element.kind_of?(Enumerable)
42
- element.each(&merge_chars)
43
- end
44
- }
45
-
46
- merge_chars.call(chars)
47
- end
48
-
49
- alias include_byte? include?
50
- alias bytes to_a
51
- alias each_byte each
52
- alias select_bytes select
53
- alias map_bytes map
54
-
55
- #
56
- # Returns +true+ if the character set includes the specified _char_,
57
- # returns +false+ otherwise.
58
- #
59
- def include_char?(char)
60
- char.each_byte do |b|
61
- return include?(b)
62
- end
63
- end
64
-
65
- #
66
- # Returns all the characters within the character set as Strings.
67
- #
68
- def chars
69
- map { |b| b.chr }
70
- end
71
-
72
- #
73
- # Iterates over every character within the character set, passing
74
- # each to the given _block_.
75
- #
76
- def each_char(&block)
77
- each { |b| block.call(b.chr) } if block
78
- end
79
-
80
- #
81
- # Selects an Array of characters from the character set that match
82
- # the given _block_.
83
- #
84
- def select_chars(&block)
85
- chars.select(&block)
86
- end
87
-
88
- #
89
- # Maps the characters of the character set using the given _block_.
90
- #
91
- def map_chars(&block)
92
- chars.map(&block)
93
- end
94
-
95
- #
96
- # Returns a random byte from the character set.
97
- #
98
- def random_byte
99
- self.entries[rand(self.length)]
100
- end
101
-
102
- #
103
- # Returns a random char from the character set.
104
- #
105
- def random_char
106
- random_byte.chr
107
- end
108
-
109
- #
110
- # Pass a random byte to the specified _block_, _n_ times.
111
- #
112
- def each_random_byte(n,&block)
113
- n.times { block.call(random_byte) }
114
- end
115
-
116
- #
117
- # Pass a random character to the specified _block_, _n_ times.
118
- #
119
- def each_random_char(n,&block)
120
- each_random_byte(n) { |b| block.call(b.chr) }
121
- end
122
-
123
- #
124
- # Returns an Array of the specified _length_ containing
125
- # random bytes from the character set. The specified _length_ may
126
- # be an Integer, Array or a Range of lengths.
127
- #
128
- def random_bytes(length)
129
- if (length.kind_of?(Array) || length.kind_of?(Range))
130
- return Array.new(length.sort_by { rand }.first) { random_byte }
131
- else
132
- return Array.new(length) { random_byte }
133
- end
134
- end
135
-
136
- #
137
- # Returns an Array of the specified _length_ containing
138
- # random characters from the character set. The specified _length_
139
- # may be an Integer, Array or a Range of lengths.
140
- #
141
- def random_chars(length)
142
- random_bytes(length).map { |b| b.chr }
143
- end
144
-
145
- #
146
- # Returns a String of the specified _length_ containing
147
- # random characters from the character set.
148
- #
149
- def random_string(length)
150
- random_chars(length).join
151
- end
152
-
153
- #
154
- # Creates a new CharSet object containing the both the characters
155
- # of the character set and the specified _other_set_.
156
- #
157
- def |(other_set)
158
- super(CharSet.new(other_set))
159
- end
160
-
161
- alias + |
162
-
163
- #
164
- # Returns +true+ if all of the bytes within the specified _string_
165
- # are included in the character set, returns +false+ otherwise.
166
- #
167
- # Chars.alpha =~ "hello"
168
- # # => true
169
- #
170
- def =~(string)
171
- string.each_byte do |b|
172
- return false unless include?(b)
173
- end
174
-
175
- return true
176
- end
177
-
178
- #
179
- # Inspects the character set.
180
- #
181
- def inspect
182
- "#<#{self.class.name}: {" + map { |b|
183
- case b
184
- when (0x07..0x0d), (0x20..0x7e)
185
- b.chr.dump
186
- when 0x00
187
- # sly hack to make char-sets more friendly
188
- # to us C programmers
189
- '"\0"'
190
- else
191
- "0x%02x" % b
192
- end
193
- }.join(', ') + "}>"
194
- end
195
-
196
- end
197
- end
198
- end
@@ -1,190 +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/chars/char_set'
25
-
26
- module Ronin
27
- module Chars
28
- # The numeric decimal character set
29
- NUMERIC = CharSet.new('0'..'9')
30
-
31
- # The octal character set
32
- OCTAL = CharSet.new('0'..'7')
33
-
34
- # The upper-case hexadecimal character set
35
- UPPERCASE_HEXADECIMAL = NUMERIC + ('A'..'F')
36
-
37
- # The lower-case hexadecimal character set
38
- LOWERCASE_HEXADECIMAL = NUMERIC + ('a'..'f')
39
-
40
- # The hexadecimal character set
41
- HEXADECIMAL = UPPERCASE_HEXADECIMAL + LOWERCASE_HEXADECIMAL
42
-
43
- # The upper-case alpha character set
44
- UPPERCASE_ALPHA = CharSet.new('A'..'Z')
45
-
46
- # The lower-case alpha character set
47
- LOWERCASE_ALPHA = CharSet.new('a'..'z')
48
-
49
- # The alpha character set
50
- ALPHA = UPPERCASE_ALPHA + LOWERCASE_ALPHA
51
-
52
- # The alpha-numeric character set
53
- ALPHA_NUMERIC = ALPHA + NUMERIC
54
-
55
- # The punctuation character set
56
- PUNCTUATION = CharSet.new(' ', '\'', '"', '`', ',', ';', ':', '~', '-',
57
- '(', ')', '[', ']', '{', '}', '.', '?', '!')
58
-
59
- # The symbolic character set
60
- SYMBOLS = PUNCTUATION + ['@', '#', '$', '%', '^', '&', '*', '_', '+',
61
- '=', '|', '\\', '<', '>', '/']
62
-
63
- # The space character set
64
- SPACE = CharSet.new(' ', "\f", "\n", "\r", "\t", "\v")
65
-
66
- # The set of printable characters (including spaces)
67
- PRINTABLE = ALPHA_NUMERIC + PUNCTUATION + SYMBOLS + SPACE
68
-
69
- # The control-char character set
70
- CONTROL = CharSet.new(0..0x1f, 0x7f)
71
-
72
- # The ASCII character set
73
- ASCII = CharSet.new(0..0x7f)
74
-
75
- # The full 8-bit character set
76
- ALL = CharSet.new(0..0xff)
77
-
78
- #
79
- # The numeric decimal character set.
80
- #
81
- def Chars.numeric
82
- NUMERIC
83
- end
84
-
85
- #
86
- # The octal character set.
87
- #
88
- def Chars.octal
89
- OCTAL
90
- end
91
-
92
- #
93
- # The upper-case hexadecimal character set.
94
- #
95
- def Chars.uppercase_hexadecimal
96
- UPPERCASE_HEXADECIMAL
97
- end
98
-
99
- #
100
- # The lower-case hexadecimal character set.
101
- #
102
- def Chars.lowercase_hexadecimal
103
- LOWERCASE_HEXADECIMAL
104
- end
105
-
106
- #
107
- # The hexadecimal character set.
108
- #
109
- def Chars.hexadecimal
110
- HEXADECIMAL
111
- end
112
-
113
- #
114
- # The upper-case alpha character set.
115
- #
116
- def Chars.uppercase_alpha
117
- UPPERCASE_ALPHA
118
- end
119
-
120
- #
121
- # The lower-case alpha character set.
122
- #
123
- def Chars.lowercase_alpha
124
- LOWERCASE_ALPHA
125
- end
126
-
127
- #
128
- # The alpha character set.
129
- #
130
- def Chars.alpha
131
- ALPHA
132
- end
133
-
134
- #
135
- # The alpha-numeric character set.
136
- #
137
- def Chars.alpha_numeric
138
- ALPHA_NUMERIC
139
- end
140
-
141
- #
142
- # The punctuation character set.
143
- #
144
- def Chars.punctuation
145
- PUNCTUATION
146
- end
147
-
148
- #
149
- # The symbolic character set.
150
- #
151
- def Chars.symbols
152
- SYMBOLS
153
- end
154
-
155
- #
156
- # The space character set.
157
- #
158
- def Chars.space
159
- SPACE
160
- end
161
-
162
- #
163
- # The set of printable characters, including spaces.
164
- #
165
- def Chars.printable
166
- PRINTABLE
167
- end
168
-
169
- #
170
- # The control-char character set.
171
- #
172
- def Chars.control
173
- CONTROL
174
- end
175
-
176
- #
177
- # The ASCII character set.
178
- #
179
- def Chars.ascii
180
- ASCII
181
- end
182
-
183
- #
184
- # The full 8-bit character set.
185
- #
186
- def Chars.all
187
- ALL
188
- end
189
- end
190
- end
@@ -1,70 +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/extension'
26
- require 'ronin/config'
27
-
28
- require 'fileutils'
29
- require 'erb'
30
-
31
- module Ronin
32
- module UI
33
- module CommandLine
34
- module Commands
35
- class Ext < Command
36
-
37
- def defaults
38
- @uses = []
39
- end
40
-
41
- def define_options(opts)
42
- opts.usage = 'PATH [...]'
43
-
44
- opts.arguments(
45
- 'PATH' => 'The PATH of the Extension to be created'
46
- )
47
-
48
- opts.summary('Create an empty Extension at the specified PATH')
49
- end
50
-
51
- def arguments(*args)
52
- args.each do |path|
53
- path = File.expand_path(path)
54
- extension_path = File.join(path,Platform::Extension::EXTENSION_FILE)
55
- lib_dir = File.join(path,Platform::Extension::LIB_DIR)
56
- template_path = File.join(Config::STATIC_DIR,'extension.rb')
57
-
58
- FileUtils.mkdir_p(path)
59
- FileUtils.mkdir_p(lib_dir)
60
- FileUtils.touch(File.join(lib_dir,File.basename(path) + '.rb'))
61
- FileUtils.mkdir_p(File.join(lib_dir,File.basename(path)))
62
- FileUtils.cp(template_path,extension_path)
63
- end
64
- end
65
-
66
- end
67
- end
68
- end
69
- end
70
- end