ronin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +39 -0
- data/Manifest.txt +46 -34
- data/README.txt +81 -20
- data/Rakefile +6 -4
- data/TODO.txt +1 -5
- data/bin/ronin +2 -2
- data/lib/ronin.rb +3 -3
- data/lib/ronin/arch.rb +5 -3
- data/lib/ronin/author.rb +2 -1
- data/lib/ronin/cache/cache.rb +78 -0
- data/lib/ronin/cache/extension.rb +6 -6
- data/lib/ronin/cache/extension_cache.rb +3 -21
- data/lib/ronin/{parameters/instance_param.rb → cache/maintainer.rb} +22 -17
- data/lib/ronin/cache/overlay.rb +74 -23
- data/lib/ronin/cache/overlay_cache.rb +3 -21
- data/lib/ronin/chars/char_set.rb +114 -31
- data/lib/ronin/chars/chars.rb +20 -10
- data/lib/ronin/{parameters/param.rb → code/emittable.rb} +29 -11
- data/lib/ronin/code/symbol_table.rb +13 -0
- data/lib/ronin/{parameters/class_param.rb → code/token.rb} +37 -10
- data/lib/ronin/config.rb +33 -0
- data/lib/ronin/context.rb +32 -29
- data/lib/ronin/database.rb +1 -2
- data/lib/ronin/extensions.rb +0 -1
- data/lib/ronin/extensions/string.rb +41 -0
- data/lib/ronin/extensions/uri/query_params.rb +8 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +10 -0
- data/lib/ronin/{program.rb → hexdump.rb} +2 -2
- data/lib/ronin/{parameters/exceptions/missing_param.rb → hexdump/extensions.rb} +2 -6
- data/lib/ronin/{extensions/kernel.rb → hexdump/extensions/file.rb} +8 -6
- data/lib/ronin/{persistence.rb → hexdump/extensions/kernel.rb} +7 -6
- data/lib/ronin/hexdump/hexdump.rb +76 -0
- data/lib/ronin/license.rb +5 -3
- data/lib/ronin/model.rb +4 -2
- data/lib/ronin/models.rb +8 -2
- data/lib/ronin/object_context.rb +89 -62
- data/lib/ronin/rpc/console.rb +6 -4
- data/lib/ronin/rpc/shell.rb +4 -4
- data/lib/ronin/sessions/http.rb +144 -0
- data/lib/ronin/sessions/session.rb +2 -1
- data/lib/ronin/sessions/telnet.rb +3 -1
- data/lib/ronin/sessions/udp.rb +1 -1
- data/lib/ronin/sessions/web.rb +7 -2
- data/lib/ronin/translators/translator.rb +75 -0
- data/lib/ronin/ui/command_line.rb +25 -0
- data/lib/ronin/ui/command_line/command.rb +165 -0
- data/lib/ronin/ui/command_line/command_line.rb +117 -0
- data/lib/ronin/{program → ui/command_line}/commands.rb +12 -9
- data/lib/ronin/ui/command_line/commands/add.rb +75 -0
- data/lib/ronin/{program/commands/help.rb → ui/command_line/commands/default.rb} +26 -17
- data/lib/ronin/ui/command_line/commands/extension.rb +85 -0
- data/lib/ronin/ui/command_line/commands/help.rb +70 -0
- data/lib/ronin/{program → ui/command_line}/commands/install.rb +26 -23
- data/lib/ronin/ui/command_line/commands/list.rb +93 -0
- data/lib/ronin/ui/command_line/commands/overlay.rb +187 -0
- data/lib/ronin/{program/commands/uninstall.rb → ui/command_line/commands/remove.rb} +25 -17
- data/lib/ronin/{program/commands/update.rb → ui/command_line/commands/uninstall.rb} +27 -17
- data/lib/ronin/{program/commands/remove.rb → ui/command_line/commands/update.rb} +24 -18
- data/lib/ronin/{program → ui/command_line}/exceptions.rb +1 -1
- data/lib/ronin/{program → ui/command_line}/exceptions/unknown_command.rb +4 -2
- data/lib/ronin/ui/command_line/options.rb +148 -0
- data/lib/ronin/{console.rb → ui/console.rb} +0 -0
- data/lib/ronin/ui/shell.rb +117 -0
- data/lib/ronin/version.rb +1 -1
- data/lib/ronin/web.rb +1 -0
- data/lib/ronin/web/extensions.rb +1 -0
- data/lib/ronin/web/extensions/hpricot.rb +5 -0
- data/lib/ronin/web/extensions/hpricot/comment.rb +19 -0
- data/lib/ronin/web/extensions/hpricot/container.rb +46 -0
- data/lib/ronin/web/extensions/hpricot/doc.rb +21 -0
- data/lib/ronin/web/extensions/hpricot/elem.rb +25 -0
- data/lib/ronin/web/extensions/hpricot/tag.rb +19 -0
- data/lib/ronin/web/extensions/hpricot/text.rb +19 -0
- data/lib/ronin/web/web.rb +70 -4
- data/spec/arch_spec.rb +1 -1
- data/spec/author_spec.rb +1 -1
- data/spec/chars/char_set_spec.rb +177 -0
- data/spec/code/symbol_table_spec.rb +6 -0
- data/spec/extensions/string_spec.rb +12 -0
- data/spec/formatting/binary_spec.rb +9 -0
- data/spec/license_spec.rb +1 -1
- data/spec/object_context/object_context_spec.rb +29 -0
- data/spec/platform_spec.rb +1 -1
- data/spec/product_spec.rb +1 -1
- data/spec/ronin_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -2
- data/spec/target_spec.rb +1 -1
- data/spec/translators/translator_spec.rb +63 -0
- data/spec/web/extensions/hpricot_spec.rb +62 -0
- data/static/extension.rb.erb +16 -0
- data/static/overlay.xsl +103 -0
- data/tasks/spec.rb +2 -0
- metadata +72 -42
- data/FAQ.txt +0 -103
- data/lib/ronin/environment.rb +0 -39
- data/lib/ronin/objects.rb +0 -27
- data/lib/ronin/parameters.rb +0 -27
- data/lib/ronin/parameters/exceptions.rb +0 -25
- data/lib/ronin/parameters/exceptions/param_not_found.rb +0 -29
- data/lib/ronin/parameters/parameters.rb +0 -286
- data/lib/ronin/program/command.rb +0 -203
- data/lib/ronin/program/commands/add.rb +0 -71
- data/lib/ronin/program/commands/list.rb +0 -79
- data/lib/ronin/program/options.rb +0 -201
- data/lib/ronin/program/program.rb +0 -168
- data/lib/ronin/rpc/interactive.rb +0 -55
- data/lib/ronin/rpc/interactive_console.rb +0 -58
- data/lib/ronin/rpc/interactive_shell.rb +0 -59
- data/lib/ronin/shell.rb +0 -81
- data/spec/parameters/parameters_spec.rb +0 -109
data/lib/ronin/chars/chars.rb
CHANGED
@@ -52,9 +52,6 @@ module Ronin
|
|
52
52
|
# The alpha-numeric character set
|
53
53
|
ALPHA_NUMERIC = ALPHA + NUMERIC
|
54
54
|
|
55
|
-
# The space character set
|
56
|
-
SPACE = CharSet.new(' ', "\f", "\n", "\r", "\t", "\v")
|
57
|
-
|
58
55
|
# The punctuation character set
|
59
56
|
PUNCTUATION = CharSet.new(' ', '\'', '"', '`', ',', ';', ':', '~', '-',
|
60
57
|
'(', ')', '[', ']', '{', '}', '.', '?', '!')
|
@@ -63,6 +60,12 @@ module Ronin
|
|
63
60
|
SYMBOLS = PUNCTUATION + ['@', '#', '$', '%', '^', '&', '*', '_', '+',
|
64
61
|
'=', '|', '\\', '<', '>', '/']
|
65
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
|
+
|
66
69
|
# The control-char character set
|
67
70
|
CONTROL = CharSet.new(0..0x1f, 0x7f)
|
68
71
|
|
@@ -135,13 +138,6 @@ module Ronin
|
|
135
138
|
ALPHA_NUMERIC
|
136
139
|
end
|
137
140
|
|
138
|
-
#
|
139
|
-
# The space character set.
|
140
|
-
#
|
141
|
-
def Chars.space
|
142
|
-
SPACE
|
143
|
-
end
|
144
|
-
|
145
141
|
#
|
146
142
|
# The punctuation character set.
|
147
143
|
#
|
@@ -156,6 +152,20 @@ module Ronin
|
|
156
152
|
SYMBOLS
|
157
153
|
end
|
158
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
|
+
|
159
169
|
#
|
160
170
|
# The control-char character set.
|
161
171
|
#
|
@@ -22,24 +22,42 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
module Ronin
|
25
|
-
module
|
26
|
-
|
25
|
+
module Code
|
26
|
+
module Emittable
|
27
|
+
#
|
28
|
+
# Default emit method which simply returns +nil+.
|
29
|
+
#
|
30
|
+
def emit
|
31
|
+
[]
|
32
|
+
end
|
27
33
|
|
28
|
-
|
29
|
-
attr_reader :name
|
34
|
+
protected
|
30
35
|
|
31
|
-
#
|
32
|
-
|
36
|
+
#
|
37
|
+
# Emits a Token with the specified _name_.
|
38
|
+
#
|
39
|
+
def emit_token(name)
|
40
|
+
[Token.new(name)]
|
41
|
+
end
|
33
42
|
|
34
43
|
#
|
35
|
-
#
|
36
|
-
#
|
44
|
+
# Emits the specified _value_ if _value_ is an Emittable object,
|
45
|
+
# otherwise _value_ will be returned.
|
37
46
|
#
|
38
|
-
def
|
39
|
-
|
40
|
-
|
47
|
+
def emit_value(value)
|
48
|
+
if value.kind_of?(Emittable)
|
49
|
+
return value.emit
|
50
|
+
else
|
51
|
+
return [value]
|
52
|
+
end
|
41
53
|
end
|
42
54
|
|
55
|
+
#
|
56
|
+
# Emits each of the specified _valueis_.
|
57
|
+
#
|
58
|
+
def emit_values(values)
|
59
|
+
values.inject([]) { |tokens,value| tokens + emit_value(value) }
|
60
|
+
end
|
43
61
|
end
|
44
62
|
end
|
45
63
|
end
|
@@ -52,6 +52,19 @@ module Ronin
|
|
52
52
|
@table[name.to_s]
|
53
53
|
end
|
54
54
|
|
55
|
+
#
|
56
|
+
# Returns a Hash of the symbol names and their values.
|
57
|
+
#
|
58
|
+
def symbols
|
59
|
+
hash = {}
|
60
|
+
|
61
|
+
@table.each do |name,symbol|
|
62
|
+
hash[name] = symbol.value
|
63
|
+
end
|
64
|
+
|
65
|
+
return hash
|
66
|
+
end
|
67
|
+
|
55
68
|
#
|
56
69
|
# Sets the symbol values en-mass using the specified _hash_ of
|
57
70
|
# symbol names and their values.
|
@@ -21,25 +21,52 @@
|
|
21
21
|
#++
|
22
22
|
#
|
23
23
|
|
24
|
-
require 'ronin/
|
24
|
+
require 'ronin/code/emittable'
|
25
25
|
|
26
26
|
module Ronin
|
27
|
-
module
|
28
|
-
class
|
27
|
+
module Code
|
28
|
+
class Token
|
29
|
+
|
30
|
+
include Emittable
|
29
31
|
|
30
|
-
#
|
31
|
-
|
32
|
+
# Value of the token
|
33
|
+
attr_reader :value
|
32
34
|
|
33
35
|
#
|
34
|
-
# Creates a new
|
35
|
-
# given _description_ and _value_.
|
36
|
+
# Creates a new Token object with the specified _value_.
|
36
37
|
#
|
37
|
-
def initialize(
|
38
|
-
super(name,description)
|
39
|
-
|
38
|
+
def initialize(value)
|
40
39
|
@value = value
|
41
40
|
end
|
42
41
|
|
42
|
+
#
|
43
|
+
# Emits the token.
|
44
|
+
#
|
45
|
+
def emit
|
46
|
+
[self]
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Returns +true+ if the token has the same value as the specified
|
51
|
+
# _other_ token, returns +false+ otherwise.
|
52
|
+
#
|
53
|
+
def ==(other)
|
54
|
+
self.value == other.value
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Inspects the token.
|
59
|
+
#
|
60
|
+
def inspect
|
61
|
+
"#<Token:#{@value.inspect}>"
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# Returns the String form of the token.
|
66
|
+
#
|
67
|
+
def to_s
|
68
|
+
@value.to_s
|
69
|
+
end
|
43
70
|
end
|
44
71
|
end
|
45
72
|
end
|
data/lib/ronin/config.rb
CHANGED
@@ -27,5 +27,38 @@ module Ronin
|
|
27
27
|
module Config
|
28
28
|
# Ronin home directory
|
29
29
|
PATH = FileUtils.mkdir_p(File.join(ENV['HOME'],'.ronin'))
|
30
|
+
|
31
|
+
# Path to static directory
|
32
|
+
STATIC_DIR = File.expand_path(File.join(File.dirname(__FILE__),'..','..','static'))
|
33
|
+
|
34
|
+
# Main configuration file
|
35
|
+
CONFIG_PATH = File.expand_path(File.join(PATH,'config.rb'))
|
36
|
+
|
37
|
+
# Configuration files directory
|
38
|
+
CONFIG_DIR = File.expand_path(File.join(PATH,'config'))
|
39
|
+
|
40
|
+
# Temporary file directory
|
41
|
+
TMP_DIR = FileUtils.mkdir_p(File.join(PATH,'tmp'))
|
42
|
+
|
43
|
+
#
|
44
|
+
# Require the Ronin configuration file with the given _name_ in the
|
45
|
+
# Ronin configuration files directory. If _name_ is not given, than the
|
46
|
+
# main Ronin configuration file will be loaded.
|
47
|
+
#
|
48
|
+
# # Load the main config file at <tt>~/.ronin/config.rb</tt>
|
49
|
+
# Config.load # => true
|
50
|
+
#
|
51
|
+
# # Load a specific config file in <tt>~/.ronin/config/</tt>
|
52
|
+
# Config.load 'sql' # => true
|
53
|
+
#
|
54
|
+
def Config.load(name=nil)
|
55
|
+
if name
|
56
|
+
path = File.expand_path(File.join(CONFIG_DIR,name))
|
57
|
+
else
|
58
|
+
path = CONFIG_PATH
|
59
|
+
end
|
60
|
+
|
61
|
+
require path if File.file?(path)
|
62
|
+
end
|
30
63
|
end
|
31
64
|
end
|
data/lib/ronin/context.rb
CHANGED
@@ -29,40 +29,44 @@ require 'ronin/extensions/meta'
|
|
29
29
|
module Ronin
|
30
30
|
module Context
|
31
31
|
def self.included(base)
|
32
|
-
base.
|
33
|
-
|
32
|
+
base.module_eval do
|
33
|
+
def self.contextify(name)
|
34
|
+
name = name.to_sym
|
34
35
|
|
35
|
-
|
36
|
+
Context.contexts[name] = self
|
36
37
|
|
37
|
-
|
38
|
+
meta_def(:context_name) { name }
|
38
39
|
|
39
|
-
|
40
|
-
Context.load_context(self.context_name,path,*args)
|
41
|
-
end
|
40
|
+
class_def(:context_name) { name }
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
def ronin_#{name}(*args,&block)
|
46
|
-
if (args.empty? && Ronin::Context.is_pending?)
|
47
|
-
Ronin::Context.pending.blocks[:#{name}] = block
|
48
|
-
return nil
|
49
|
-
else
|
50
|
-
new_context = #{self}.new(*args)
|
51
|
-
new_context.instance_eval(&block) if block
|
52
|
-
return new_context
|
53
|
-
end
|
42
|
+
meta_def(:load_context) do |path,*args|
|
43
|
+
Context.load_context(self.context_name,path,*args)
|
54
44
|
end
|
55
|
-
}
|
56
45
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
# define the top-level context wrappers
|
47
|
+
Kernel.module_eval %{
|
48
|
+
def ronin_#{name}(*args,&block)
|
49
|
+
if (args.empty? && Ronin::Context.is_pending?)
|
50
|
+
Ronin::Context.pending.blocks[:#{name}] = block
|
51
|
+
return nil
|
52
|
+
else
|
53
|
+
new_context = #{self}.new(*args)
|
54
|
+
new_context.instance_eval(&block) if block
|
55
|
+
return new_context
|
56
|
+
end
|
57
|
+
end
|
58
|
+
}
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
# define the Ronin-level context loader
|
61
|
+
Ronin.module_eval %{
|
62
|
+
def ronin_load_#{name}(path,*args,&block)
|
63
|
+
new_context = #{self}.load_context(path,*args)
|
64
|
+
|
65
|
+
block.call(new_context) if block
|
66
|
+
return new_context
|
67
|
+
end
|
68
|
+
}
|
69
|
+
end
|
66
70
|
end
|
67
71
|
end
|
68
72
|
|
@@ -90,7 +94,6 @@ module Ronin
|
|
90
94
|
# Context.namify(Analysis::Audio) # => "ronin_analysis_audio"
|
91
95
|
#
|
92
96
|
def Context.namify(base)
|
93
|
-
# similar to the way Og tableizes Class names
|
94
97
|
base.to_s.downcase.gsub(/::/,'_').gsub(/^ronin_/,'').to_sym
|
95
98
|
end
|
96
99
|
|
@@ -221,12 +224,12 @@ module Ronin
|
|
221
224
|
new_obj = Context.contexts[name].new
|
222
225
|
new_obj.instance_eval(&context_block)
|
223
226
|
|
227
|
+
block.call(new_obj) if block
|
224
228
|
new_objs << new_obj
|
225
229
|
end
|
226
230
|
end
|
227
231
|
end
|
228
232
|
|
229
|
-
new_objs.each(&block) if block
|
230
233
|
return new_objs
|
231
234
|
end
|
232
235
|
end
|
data/lib/ronin/database.rb
CHANGED
@@ -22,13 +22,12 @@
|
|
22
22
|
#
|
23
23
|
|
24
24
|
require 'ronin/exceptions/invalid_database_config'
|
25
|
-
require 'ronin/extensions/kernel'
|
26
|
-
require 'ronin/config'
|
27
25
|
require 'ronin/arch'
|
28
26
|
require 'ronin/platform'
|
29
27
|
require 'ronin/author'
|
30
28
|
require 'ronin/license'
|
31
29
|
require 'ronin/product'
|
30
|
+
require 'ronin/config'
|
32
31
|
|
33
32
|
require 'yaml'
|
34
33
|
require 'dm-core'
|
data/lib/ronin/extensions.rb
CHANGED
@@ -83,4 +83,45 @@ class String
|
|
83
83
|
return self[prefix.length...(length - postfix.length)]
|
84
84
|
end
|
85
85
|
|
86
|
+
#
|
87
|
+
# Inspects the string, returning a C style encoded version of the string.
|
88
|
+
#
|
89
|
+
# "hello\x00\073\x90\r\n"
|
90
|
+
# # => "hello\0;\x90\r\n"
|
91
|
+
#
|
92
|
+
def inspect
|
93
|
+
c_string = ''
|
94
|
+
|
95
|
+
each_byte do |b|
|
96
|
+
c_string << case b
|
97
|
+
when 0x00
|
98
|
+
"\\0"
|
99
|
+
when 0x07
|
100
|
+
"\\a"
|
101
|
+
when 0x08
|
102
|
+
"\\b"
|
103
|
+
when 0x09
|
104
|
+
"\\t"
|
105
|
+
when 0x0a
|
106
|
+
"\\n"
|
107
|
+
when 0x0b
|
108
|
+
"\\v"
|
109
|
+
when 0x0c
|
110
|
+
"\\f"
|
111
|
+
when 0x0d
|
112
|
+
"\\r"
|
113
|
+
when 0x22
|
114
|
+
"\\\""
|
115
|
+
when 0x5c
|
116
|
+
"\\\\"
|
117
|
+
when (0x20..0x7e)
|
118
|
+
b.chr
|
119
|
+
else
|
120
|
+
("\\x%.2x" % b)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
return "\"#{c_string}\""
|
125
|
+
end
|
126
|
+
|
86
127
|
end
|
@@ -56,6 +56,16 @@ class String
|
|
56
56
|
return integer
|
57
57
|
end
|
58
58
|
|
59
|
+
#
|
60
|
+
# XOR encodes the string using the specified _key_.
|
61
|
+
#
|
62
|
+
def xor(key)
|
63
|
+
encoded = ''
|
64
|
+
|
65
|
+
each_byte { |b| encoded << (b ^ key).chr }
|
66
|
+
return encoded
|
67
|
+
end
|
68
|
+
|
59
69
|
#
|
60
70
|
# Returns the base64 encoded form of the string.
|
61
71
|
#
|