ronin 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/History.txt +39 -0
  2. data/Manifest.txt +46 -34
  3. data/README.txt +81 -20
  4. data/Rakefile +6 -4
  5. data/TODO.txt +1 -5
  6. data/bin/ronin +2 -2
  7. data/lib/ronin.rb +3 -3
  8. data/lib/ronin/arch.rb +5 -3
  9. data/lib/ronin/author.rb +2 -1
  10. data/lib/ronin/cache/cache.rb +78 -0
  11. data/lib/ronin/cache/extension.rb +6 -6
  12. data/lib/ronin/cache/extension_cache.rb +3 -21
  13. data/lib/ronin/{parameters/instance_param.rb → cache/maintainer.rb} +22 -17
  14. data/lib/ronin/cache/overlay.rb +74 -23
  15. data/lib/ronin/cache/overlay_cache.rb +3 -21
  16. data/lib/ronin/chars/char_set.rb +114 -31
  17. data/lib/ronin/chars/chars.rb +20 -10
  18. data/lib/ronin/{parameters/param.rb → code/emittable.rb} +29 -11
  19. data/lib/ronin/code/symbol_table.rb +13 -0
  20. data/lib/ronin/{parameters/class_param.rb → code/token.rb} +37 -10
  21. data/lib/ronin/config.rb +33 -0
  22. data/lib/ronin/context.rb +32 -29
  23. data/lib/ronin/database.rb +1 -2
  24. data/lib/ronin/extensions.rb +0 -1
  25. data/lib/ronin/extensions/string.rb +41 -0
  26. data/lib/ronin/extensions/uri/query_params.rb +8 -0
  27. data/lib/ronin/formatting/extensions/binary/string.rb +10 -0
  28. data/lib/ronin/{program.rb → hexdump.rb} +2 -2
  29. data/lib/ronin/{parameters/exceptions/missing_param.rb → hexdump/extensions.rb} +2 -6
  30. data/lib/ronin/{extensions/kernel.rb → hexdump/extensions/file.rb} +8 -6
  31. data/lib/ronin/{persistence.rb → hexdump/extensions/kernel.rb} +7 -6
  32. data/lib/ronin/hexdump/hexdump.rb +76 -0
  33. data/lib/ronin/license.rb +5 -3
  34. data/lib/ronin/model.rb +4 -2
  35. data/lib/ronin/models.rb +8 -2
  36. data/lib/ronin/object_context.rb +89 -62
  37. data/lib/ronin/rpc/console.rb +6 -4
  38. data/lib/ronin/rpc/shell.rb +4 -4
  39. data/lib/ronin/sessions/http.rb +144 -0
  40. data/lib/ronin/sessions/session.rb +2 -1
  41. data/lib/ronin/sessions/telnet.rb +3 -1
  42. data/lib/ronin/sessions/udp.rb +1 -1
  43. data/lib/ronin/sessions/web.rb +7 -2
  44. data/lib/ronin/translators/translator.rb +75 -0
  45. data/lib/ronin/ui/command_line.rb +25 -0
  46. data/lib/ronin/ui/command_line/command.rb +165 -0
  47. data/lib/ronin/ui/command_line/command_line.rb +117 -0
  48. data/lib/ronin/{program → ui/command_line}/commands.rb +12 -9
  49. data/lib/ronin/ui/command_line/commands/add.rb +75 -0
  50. data/lib/ronin/{program/commands/help.rb → ui/command_line/commands/default.rb} +26 -17
  51. data/lib/ronin/ui/command_line/commands/extension.rb +85 -0
  52. data/lib/ronin/ui/command_line/commands/help.rb +70 -0
  53. data/lib/ronin/{program → ui/command_line}/commands/install.rb +26 -23
  54. data/lib/ronin/ui/command_line/commands/list.rb +93 -0
  55. data/lib/ronin/ui/command_line/commands/overlay.rb +187 -0
  56. data/lib/ronin/{program/commands/uninstall.rb → ui/command_line/commands/remove.rb} +25 -17
  57. data/lib/ronin/{program/commands/update.rb → ui/command_line/commands/uninstall.rb} +27 -17
  58. data/lib/ronin/{program/commands/remove.rb → ui/command_line/commands/update.rb} +24 -18
  59. data/lib/ronin/{program → ui/command_line}/exceptions.rb +1 -1
  60. data/lib/ronin/{program → ui/command_line}/exceptions/unknown_command.rb +4 -2
  61. data/lib/ronin/ui/command_line/options.rb +148 -0
  62. data/lib/ronin/{console.rb → ui/console.rb} +0 -0
  63. data/lib/ronin/ui/shell.rb +117 -0
  64. data/lib/ronin/version.rb +1 -1
  65. data/lib/ronin/web.rb +1 -0
  66. data/lib/ronin/web/extensions.rb +1 -0
  67. data/lib/ronin/web/extensions/hpricot.rb +5 -0
  68. data/lib/ronin/web/extensions/hpricot/comment.rb +19 -0
  69. data/lib/ronin/web/extensions/hpricot/container.rb +46 -0
  70. data/lib/ronin/web/extensions/hpricot/doc.rb +21 -0
  71. data/lib/ronin/web/extensions/hpricot/elem.rb +25 -0
  72. data/lib/ronin/web/extensions/hpricot/tag.rb +19 -0
  73. data/lib/ronin/web/extensions/hpricot/text.rb +19 -0
  74. data/lib/ronin/web/web.rb +70 -4
  75. data/spec/arch_spec.rb +1 -1
  76. data/spec/author_spec.rb +1 -1
  77. data/spec/chars/char_set_spec.rb +177 -0
  78. data/spec/code/symbol_table_spec.rb +6 -0
  79. data/spec/extensions/string_spec.rb +12 -0
  80. data/spec/formatting/binary_spec.rb +9 -0
  81. data/spec/license_spec.rb +1 -1
  82. data/spec/object_context/object_context_spec.rb +29 -0
  83. data/spec/platform_spec.rb +1 -1
  84. data/spec/product_spec.rb +1 -1
  85. data/spec/ronin_spec.rb +1 -1
  86. data/spec/spec_helper.rb +3 -2
  87. data/spec/target_spec.rb +1 -1
  88. data/spec/translators/translator_spec.rb +63 -0
  89. data/spec/web/extensions/hpricot_spec.rb +62 -0
  90. data/static/extension.rb.erb +16 -0
  91. data/static/overlay.xsl +103 -0
  92. data/tasks/spec.rb +2 -0
  93. metadata +72 -42
  94. data/FAQ.txt +0 -103
  95. data/lib/ronin/environment.rb +0 -39
  96. data/lib/ronin/objects.rb +0 -27
  97. data/lib/ronin/parameters.rb +0 -27
  98. data/lib/ronin/parameters/exceptions.rb +0 -25
  99. data/lib/ronin/parameters/exceptions/param_not_found.rb +0 -29
  100. data/lib/ronin/parameters/parameters.rb +0 -286
  101. data/lib/ronin/program/command.rb +0 -203
  102. data/lib/ronin/program/commands/add.rb +0 -71
  103. data/lib/ronin/program/commands/list.rb +0 -79
  104. data/lib/ronin/program/options.rb +0 -201
  105. data/lib/ronin/program/program.rb +0 -168
  106. data/lib/ronin/rpc/interactive.rb +0 -55
  107. data/lib/ronin/rpc/interactive_console.rb +0 -58
  108. data/lib/ronin/rpc/interactive_shell.rb +0 -59
  109. data/lib/ronin/shell.rb +0 -81
  110. data/spec/parameters/parameters_spec.rb +0 -109
@@ -0,0 +1,75 @@
1
+ #
2
+ #--
3
+ # Ronin - A Ruby platform designed for information security and data
4
+ # exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2007 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/cache/overlay'
26
+
27
+ module Ronin
28
+ module UI
29
+ module CommandLine
30
+ class AddCommand < Command
31
+
32
+ command :add
33
+
34
+ def define_options(opts)
35
+ opts.usage = 'PATH [options]'
36
+
37
+ opts.options do
38
+ opts.on('-m','--media MEDIA','Spedify the media-type of the repository') do |media|
39
+ @media = media
40
+ end
41
+
42
+ opts.on('-U','--uri URI','Specify the source URI of the repository') do |uri|
43
+ @uri = uri
44
+ end
45
+
46
+ opts.on('-L','--local','Similiar to: --media local') do
47
+ @media = :local
48
+ end
49
+ end
50
+
51
+ opts.arguments(
52
+ 'PATH' => 'Add the repository located at the specified PATH'
53
+ )
54
+
55
+ opts.summary('Add a local repository located at the specified PATH to the repository cache')
56
+ end
57
+
58
+ def arguments(*args)
59
+ unless args.length == 1
60
+ fail('only one repository path maybe specified')
61
+ end
62
+
63
+ path = args.first
64
+
65
+ Cache::Overlay.save_cache do
66
+ Cache::Overlay.add(path,@media,@uri) do |repo|
67
+ puts "Overlay #{repo} added."
68
+ end
69
+ end
70
+ end
71
+
72
+ end
73
+ end
74
+ end
75
+ end
@@ -21,30 +21,39 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/program/command'
24
+ require 'ronin/ui/command_line/command'
25
+ require 'ronin/cache/overlay'
25
26
 
26
27
  module Ronin
27
- module Program
28
- class HelpCommand < Command
29
-
30
- command :help
31
-
32
- options('[COMMAND]') do |opts|
33
- opts.arguments do
34
- opts.arg('COMMAND','The command to view')
28
+ module UI
29
+ module CommandLine
30
+ class DefaultCommand < Command
31
+
32
+ def define_options(opts)
33
+ opts.usage = '<command> [options]'
34
+ opts.options do
35
+ opts.on('-r','--require LIB','require the specified library or path') do |lib|
36
+ Console.auto_load << lib.to_s
37
+ end
38
+
39
+ opts.on('-V','--version','print version information and exit') do
40
+ CommandLine.success do
41
+ puts "Ronin #{Ronin::VERSION}"
42
+ end
43
+ end
44
+ end
45
+
46
+ opts.summary %{
47
+ Ronin is a Ruby development platform designed for information security
48
+ and data exploration tasks.
49
+ }
35
50
  end
36
51
 
37
- opts.summary('View a list of supported commands or information on a specific command')
38
- end
39
-
40
- def arguments(*args)
41
- unless args.length<=1
42
- fail('help: only one command maybe specified')
52
+ def arguments(*args)
53
+ Console.start
43
54
  end
44
55
 
45
- success { Program.help(args.first) }
46
56
  end
47
-
48
57
  end
49
58
  end
50
59
  end
@@ -0,0 +1,85 @@
1
+ #
2
+ #--
3
+ # Ronin - A Ruby platform designed for information security and data
4
+ # exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2007 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/cache/extension'
26
+ require 'ronin/config'
27
+
28
+ require 'fileutils'
29
+ require 'erb'
30
+
31
+ module Ronin
32
+ module UI
33
+ module CommandLine
34
+ class ExtensionCommand < Command
35
+
36
+ command :extension, :ext
37
+
38
+ def initialize
39
+ @uses = []
40
+
41
+ super
42
+ end
43
+
44
+ def define_options(opts)
45
+ opts.usage = '[options] PATH'
46
+
47
+ opts.options do
48
+ opts.on('-u','--uses NAME','Name of an other extension to use') do |name|
49
+ @uses << name
50
+ end
51
+ end
52
+
53
+ opts.arguments(
54
+ 'PATH' => 'The PATH of the Extension to be created'
55
+ )
56
+
57
+ opts.summary('Create an empty Extension at the specified PATH')
58
+ end
59
+
60
+ def arguments(*args)
61
+ unless args.length == 1
62
+ fail('only one Extension path maybe specified')
63
+ end
64
+
65
+ path = File.expand_path(args.first)
66
+ extension_path = File.join(path,Cache::Extension::EXTENSION_FILE)
67
+ lib_dir = File.join(path,Cache::Extension::LIB_DIR)
68
+
69
+ FileUtils.mkdir_p(path)
70
+ FileUtils.mkdir_p(lib_dir)
71
+ FileUtils.touch(File.join(lib_dir,File.basename(path) + '.rb'))
72
+ FileUtils.mkdir_p(File.join(lib_dir,File.basename(path)))
73
+
74
+ File.open(extension_path,'w') do |file|
75
+ template_path = File.join(Config::STATIC_DIR,'extension.rb.erb')
76
+ template = ERB.new(File.read(template_path))
77
+
78
+ file.write(template.result(binding))
79
+ end
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,70 @@
1
+ #
2
+ #--
3
+ # Ronin - A Ruby platform designed for information security and data
4
+ # exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2007 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
+
26
+ module Ronin
27
+ module UI
28
+ module CommandLine
29
+ class HelpCommand < Command
30
+
31
+ command :help
32
+
33
+ def define_options(opts)
34
+ opts.usage = '[COMMAND]'
35
+
36
+ opts.arguments(
37
+ 'COMMAND' => 'The command to view'
38
+ )
39
+
40
+ opts.summary('View a list of supported commands or information on a specific command')
41
+ end
42
+
43
+ def arguments(*args)
44
+ if args.length > 1
45
+ fail('only one command maybe specified')
46
+ end
47
+
48
+ topic = args.first
49
+
50
+ if topic
51
+ begin
52
+ CommandLine.get_command(topic).help
53
+ rescue UnknownCommand => exp
54
+ CommandLine.fail(exp)
55
+ end
56
+ else
57
+ puts 'Available commands:'
58
+
59
+ CommandLine.commands.sort_by { |cmd|
60
+ cmd.command_names.first
61
+ }.each { |cmd|
62
+ puts " #{cmd.command_names.join(', ')}"
63
+ }
64
+ end
65
+ end
66
+
67
+ end
68
+ end
69
+ end
70
+ end
@@ -21,44 +21,47 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/program/command'
24
+ require 'ronin/ui/command_line/command'
25
25
  require 'ronin/cache/overlay'
26
26
 
27
27
  module Ronin
28
- module Program
29
- class InstallCommand < Command
28
+ module UI
29
+ module CommandLine
30
+ class InstallCommand < Command
30
31
 
31
- command :install
32
+ command :install
32
33
 
33
- options('URI [options]') do |opts|
34
- opts.settings.media = nil
35
- opts.settings.uri = nil
34
+ def define_options(opts)
35
+ opts.usage = 'URI [options]'
36
36
 
37
- opts.options do
38
- opts.on('-m','--media [MEDIA]','Spedify the media-type of the repository') do |media|
39
- options.settings.media = media
37
+ opts.options do
38
+ opts.on('-m','--media [MEDIA]','Spedify the media-type of the repository') do |media|
39
+ @media = media
40
+ end
40
41
  end
41
- end
42
42
 
43
- opts.arguments do
44
- opts.arg('URI','The URI of the repository to install')
43
+ opts.arguments(
44
+ 'URI' => 'The URI of the repository to install'
45
+ )
46
+
47
+ opts.summary('Installs the repository located at the specified URI')
45
48
  end
46
49
 
47
- opts.summary('Installs the repository located at the specified URI')
48
- end
50
+ def arguments(args)
51
+ unless args.length == 1
52
+ fail('only one repository URI maybe specified')
53
+ end
49
54
 
50
- def arguments(args)
51
- unless args.length==1
52
- fail('install: only one repository URI maybe specified')
53
- end
55
+ uri = args.first
54
56
 
55
- Cache::Overlay.save_cache do
56
- Cache::Overlay.install(:uri => args.first, :media => options.settings.media) do |repo|
57
- puts "Overlay #{repo} has been installed."
57
+ Cache::Overlay.save_cache do
58
+ Cache::Overlay.install(:uri => uri, :media => @media) do |repo|
59
+ puts "Overlay #{repo} has been installed."
60
+ end
58
61
  end
59
62
  end
60
- end
61
63
 
64
+ end
62
65
  end
63
66
  end
64
67
  end
@@ -0,0 +1,93 @@
1
+ #
2
+ #--
3
+ # Ronin - A Ruby platform designed for information security and data
4
+ # exploration tasks.
5
+ #
6
+ # Copyright (c) 2006-2007 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/cache/overlay'
26
+
27
+ module Ronin
28
+ module UI
29
+ module CommandLine
30
+ class ListCommand < Command
31
+
32
+ command :list, :ls
33
+
34
+ def define_options(opts)
35
+ opts.usage = '[NAME ...] [options]'
36
+
37
+ opts.options do
38
+ opts.on('-v','--verbose','Enable verbose output') do
39
+ @verbose = true
40
+ end
41
+ end
42
+
43
+ opts.arguments(
44
+ 'NAME' => 'Overlay to display'
45
+ )
46
+
47
+ opts.summary('Display all or the specified repositories within the repository cache')
48
+ end
49
+
50
+ def arguments(*args)
51
+ if args.empty?
52
+ # list all repositories by name
53
+ Cache::Overlay.each { |repo| puts " #{repo}" }
54
+ return
55
+ end
56
+
57
+ # list specified repositories
58
+ args.each do |name|
59
+ overlay = Cache::Overlay.get(name)
60
+
61
+ puts "[ #{overlay.name} ]\n\n"
62
+
63
+ puts " Path: #{overlay.path}"
64
+ puts " Media: #{overlay.media}" if overlay.media
65
+ puts " URI: #{overlay.uri}" if overlay.uri
66
+
67
+ if @verbose
68
+ if overlay.source
69
+ puts " Source URI: #{overlay.source}"
70
+ end
71
+
72
+ if overlay.source_view
73
+ puts " Source View: #{overlay.source_view}"
74
+ end
75
+
76
+ if overlay.website
77
+ puts " Website: #{overlay.website}"
78
+ end
79
+
80
+ if overlay.description
81
+ puts " Description:\n\n #{overlay.description}"
82
+ end
83
+
84
+ puts " Extensions:\n\n"
85
+ overlay.each_extension { |ext| puts " #{ext.name}" }
86
+ end
87
+ end
88
+ end
89
+
90
+ end
91
+ end
92
+ end
93
+ end