ronin 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/History.txt +19 -1
  2. data/Manifest.txt +8 -17
  3. data/README.txt +0 -4
  4. data/Rakefile +14 -15
  5. data/TODO.txt +1 -2
  6. data/lib/ronin.rb +2 -2
  7. data/lib/ronin/extensions.rb +1 -0
  8. data/lib/ronin/extensions/file.rb +33 -0
  9. data/lib/ronin/formatting/extensions/http/string.rb +12 -0
  10. data/lib/ronin/formatting/extensions/text/string.rb +4 -4
  11. data/lib/ronin/model.rb +8 -0
  12. data/lib/ronin/objectify/exceptions/object_context_not_found.rb +3 -1
  13. data/lib/ronin/objectify/exceptions/unknown_object_context.rb +3 -1
  14. data/lib/ronin/sessions/telnet.rb +5 -2
  15. data/lib/ronin/{web.rb → translators.rb} +1 -2
  16. data/lib/ronin/{hexdump.rb → ui.rb} +2 -2
  17. data/lib/ronin/{hexdump/extensions.rb → ui/hexdump.rb} +2 -2
  18. data/lib/ronin/ui/hexdump/extensions.rb +25 -0
  19. data/lib/ronin/{hexdump → ui/hexdump}/extensions/file.rb +2 -2
  20. data/lib/ronin/{hexdump → ui/hexdump}/extensions/kernel.rb +2 -2
  21. data/lib/ronin/ui/hexdump/hexdump.rb +78 -0
  22. data/lib/ronin/version.rb +1 -1
  23. data/spec/formatting/html_spec.rb +9 -0
  24. data/spec/formatting/http_spec.rb +9 -0
  25. data/spec/formatting/text_spec.rb +20 -1
  26. metadata +12 -51
  27. data/lib/ronin/hexdump/hexdump.rb +0 -76
  28. data/lib/ronin/sessions/web.rb +0 -78
  29. data/lib/ronin/web/extensions.rb +0 -1
  30. data/lib/ronin/web/extensions/hpricot.rb +0 -5
  31. data/lib/ronin/web/extensions/hpricot/comment.rb +0 -19
  32. data/lib/ronin/web/extensions/hpricot/container.rb +0 -46
  33. data/lib/ronin/web/extensions/hpricot/doc.rb +0 -21
  34. data/lib/ronin/web/extensions/hpricot/elem.rb +0 -25
  35. data/lib/ronin/web/extensions/hpricot/tag.rb +0 -19
  36. data/lib/ronin/web/extensions/hpricot/text.rb +0 -19
  37. data/lib/ronin/web/web.rb +0 -331
  38. data/spec/web/extensions/hpricot_spec.rb +0 -62
@@ -1,4 +1,22 @@
1
- === 0.1.3 / 2008-01-08
1
+ === 0.1.4 / 2009-01-22
2
+
3
+ * Moved Ronin::Web and Ronin::Sessions::Web into the ronin-web library.
4
+ * Removed dependencies to hpricot, mechanize, spidr and rack.
5
+ * Moved Hexdump into the Ronin::UI namespace.
6
+ * Require parameters >= 0.1.3:
7
+ * Parameters 0.1.3 adds support for using lambdas as the default values
8
+ of parameters.
9
+ * Temporarily added Ronin::Model.first_or_new:
10
+ * Will be removed once dkubb's version of first_or_new is merged into
11
+ dm-core.
12
+ * Added the File.write method.
13
+ * Added specs for String#format_http and String#format_html.
14
+ * Fixed a formatting bug in String#format_chars and String#format_bytes.
15
+ * Fixed typos.
16
+ * Automatically load 'ronin/ui/hexdump' when starting the
17
+ Ronin::UI::Console.
18
+
19
+ === 0.1.3 / 2009-01-08
2
20
 
3
21
  * Moved Context into the Contextify library.
4
22
  * Require dm-core >= 0.9.9.
@@ -15,6 +15,7 @@ lib/ronin/extensions/uri.rb
15
15
  lib/ronin/extensions/uri/query_params.rb
16
16
  lib/ronin/extensions/uri/http.rb
17
17
  lib/ronin/extensions/string.rb
18
+ lib/ronin/extensions/file.rb
18
19
  lib/ronin/formatting.rb
19
20
  lib/ronin/formatting/digest.rb
20
21
  lib/ronin/formatting/binary.rb
@@ -33,14 +34,10 @@ lib/ronin/formatting/extensions/html.rb
33
34
  lib/ronin/formatting/extensions/html/string.rb
34
35
  lib/ronin/formatting/extensions/http.rb
35
36
  lib/ronin/formatting/extensions/http/string.rb
36
- lib/ronin/hexdump.rb
37
- lib/ronin/hexdump/hexdump.rb
38
- lib/ronin/hexdump/extensions.rb
39
- lib/ronin/hexdump/extensions/file.rb
40
- lib/ronin/hexdump/extensions/kernel.rb
41
37
  lib/ronin/chars.rb
42
38
  lib/ronin/chars/char_set.rb
43
39
  lib/ronin/chars/chars.rb
40
+ lib/ronin/translators.rb
44
41
  lib/ronin/translators/translator.rb
45
42
  lib/ronin/path.rb
46
43
  lib/ronin/network.rb
@@ -88,16 +85,6 @@ lib/ronin/rpc/client.rb
88
85
  lib/ronin/rpc/service.rb
89
86
  lib/ronin/rpc/console.rb
90
87
  lib/ronin/rpc/shell.rb
91
- lib/ronin/web.rb
92
- lib/ronin/web/extensions.rb
93
- lib/ronin/web/extensions/hpricot.rb
94
- lib/ronin/web/extensions/hpricot/tag.rb
95
- lib/ronin/web/extensions/hpricot/text.rb
96
- lib/ronin/web/extensions/hpricot/comment.rb
97
- lib/ronin/web/extensions/hpricot/elem.rb
98
- lib/ronin/web/extensions/hpricot/container.rb
99
- lib/ronin/web/extensions/hpricot/doc.rb
100
- lib/ronin/web/web.rb
101
88
  lib/ronin/sessions.rb
102
89
  lib/ronin/sessions/session.rb
103
90
  lib/ronin/sessions/tcp.rb
@@ -108,7 +95,6 @@ lib/ronin/sessions/pop3.rb
108
95
  lib/ronin/sessions/imap.rb
109
96
  lib/ronin/sessions/telnet.rb
110
97
  lib/ronin/sessions/http.rb
111
- lib/ronin/sessions/web.rb
112
98
  lib/ronin/database.rb
113
99
  lib/ronin/database/exceptions.rb
114
100
  lib/ronin/database/exceptions/invalid_config.rb
@@ -140,6 +126,12 @@ lib/ronin/cache/extension_cache.rb
140
126
  lib/ronin/cache/extension.rb
141
127
  lib/ronin/cache/cache.rb
142
128
  lib/ronin/cache/ronin.rb
129
+ lib/ronin/ui.rb
130
+ lib/ronin/ui/hexdump.rb
131
+ lib/ronin/ui/hexdump/hexdump.rb
132
+ lib/ronin/ui/hexdump/extensions.rb
133
+ lib/ronin/ui/hexdump/extensions/file.rb
134
+ lib/ronin/ui/hexdump/extensions/kernel.rb
143
135
  lib/ronin/ui/console.rb
144
136
  lib/ronin/ui/shell.rb
145
137
  lib/ronin/ui/command_line.rb
@@ -183,7 +175,6 @@ spec/formatting/http_spec.rb
183
175
  spec/formatting/text_spec.rb
184
176
  spec/code/reference_spec.rb
185
177
  spec/code/symbol_table_spec.rb
186
- spec/web/extensions/hpricot_spec.rb
187
178
  spec/license_spec.rb
188
179
  spec/path_spec.rb
189
180
  spec/platform_spec.rb
data/README.txt CHANGED
@@ -61,7 +61,6 @@ of Ronin.
61
61
  * Imap
62
62
  * Telnet
63
63
  * HTTP
64
- * Web access (utilizing Mechanize and Hpricot).
65
64
  * Provides an IRB styled console with:
66
65
  * Tab-completion enabled.
67
66
  * Auto-indentation enabled.
@@ -69,9 +68,6 @@ of Ronin.
69
68
 
70
69
  == REQUIREMENTS:
71
70
 
72
- * hpricot
73
- * mechanize
74
- * spidr >= 0.1.3
75
71
  * DataMapper:
76
72
  * dm-core >= 0.9.9
77
73
  * data_objects >= 0.9.9
data/Rakefile CHANGED
@@ -9,21 +9,20 @@ Hoe.new('ronin', Ronin::VERSION) do |p|
9
9
  p.rubyforge_name = 'ronin'
10
10
  p.developer('Postmodern','postmodern.mod3@gmail.com')
11
11
  p.remote_rdoc_dir = 'docs/ronin'
12
- p.extra_deps = ['hpricot',
13
- 'mechanize',
14
- ['spidr', '>=0.1.3'],
15
- ['dm-core', '>=0.9.9'],
16
- ['data_objects', '>=0.9.9'],
17
- ['do_sqlite3', '>=0.9.9'],
18
- ['dm-types', '>=0.9.9'],
19
- ['dm-serializer', '>=0.9.9'],
20
- ['dm-aggregates', '>=0.9.9'],
21
- ['dm-validations', '>=0.9.9'],
22
- ['dm-predefined', '>=0.1.0'],
23
- ['parameters', '>=0.1.2'],
24
- ['contextify', '>=0.1.0'],
25
- ['reverse-require', '>=0.3.1'],
26
- ['repertoire', '>=0.1.2']]
12
+ p.extra_deps = [
13
+ ['dm-core', '>=0.9.9'],
14
+ ['data_objects', '>=0.9.9'],
15
+ ['do_sqlite3', '>=0.9.9'],
16
+ ['dm-types', '>=0.9.9'],
17
+ ['dm-serializer', '>=0.9.9'],
18
+ ['dm-aggregates', '>=0.9.9'],
19
+ ['dm-validations', '>=0.9.9'],
20
+ ['dm-predefined', '>=0.1.0'],
21
+ ['parameters', '>=0.1.3'],
22
+ ['contextify', '>=0.1.0'],
23
+ ['reverse-require', '>=0.3.1'],
24
+ ['repertoire', '>=0.1.2']
25
+ ]
27
26
  end
28
27
 
29
28
  # vim: syntax=Ruby
data/TODO.txt CHANGED
@@ -1,12 +1,11 @@
1
1
  == TODO
2
2
 
3
- === Ronin 0.1.3:
3
+ === Ronin 0.1.5:
4
4
 
5
5
  * Add diagonstic logging of this format:
6
6
 
7
7
  [*] Message
8
8
 
9
-
10
9
  === Ronin 0.2.0:
11
10
 
12
11
  * Create an IO proxy class and RPC Service for proxying io.
@@ -21,14 +21,14 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/extensions'
25
24
  require 'ronin/config'
25
+ require 'ronin/extensions'
26
26
  require 'ronin/formatting'
27
27
  require 'ronin/chars'
28
28
  require 'ronin/path'
29
29
  require 'ronin/network'
30
- require 'ronin/web'
31
30
  require 'ronin/models'
31
+ require 'ronin/ui'
32
32
  require 'ronin/ronin'
33
33
  require 'ronin/version'
34
34
 
@@ -25,3 +25,4 @@ require 'ronin/extensions/meta'
25
25
  require 'ronin/extensions/hash'
26
26
  require 'ronin/extensions/uri'
27
27
  require 'ronin/extensions/string'
28
+ require 'ronin/extensions/file'
@@ -0,0 +1,33 @@
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
+ class File
25
+
26
+ #
27
+ # Writes the specified _data_ to the specified _path_.
28
+ #
29
+ def File.write(path,data)
30
+ File.open(path,'w') { |file| file.write(data) }
31
+ end
32
+
33
+ end
@@ -21,6 +21,8 @@
21
21
  #++
22
22
  #
23
23
 
24
+ require 'ronin/formatting/extensions/text'
25
+
24
26
  require 'uri'
25
27
  require 'cgi'
26
28
 
@@ -66,4 +68,14 @@ class String
66
68
  CGI.unescape(self)
67
69
  end
68
70
 
71
+ #
72
+ # Returns the HTTP hexidecimal encoded form of the string.
73
+ #
74
+ # "hello".format_http
75
+ # # => "hello"
76
+ #
77
+ def format_http(options={})
78
+ format_bytes(options) { |c| sprintf("%%%x",c) }
79
+ end
80
+
69
81
  end
@@ -38,16 +38,16 @@ class String
38
38
  included = (options[:included] || Ronin::Chars.all)
39
39
  excluded = (options[:excluded] || [])
40
40
 
41
- formatted = included - excluded
41
+ targeted = included - excluded
42
42
  formatted = ''
43
43
 
44
44
  self.each_byte do |b|
45
45
  c = b.chr
46
46
 
47
- if formatted.include?(c)
48
- formatted_chars << block.call(c)
47
+ if targeted.include_byte?(b)
48
+ formatted << block.call(c)
49
49
  else
50
- formatted_chars << c
50
+ formatted << c
51
51
  end
52
52
  end
53
53
 
@@ -49,6 +49,14 @@ module Ronin
49
49
 
50
50
  # The class type property
51
51
  property :type, Discriminator
52
+
53
+ #
54
+ # Finds the first resource by conditions, or initializes a new
55
+ # resource with the attributes if none found.
56
+ #
57
+ def self.first_or_new(query,attributes={})
58
+ first(query) || new(query.merge(attributes))
59
+ end
52
60
  end
53
61
  end
54
62
  end
@@ -22,6 +22,8 @@
22
22
  #
23
23
 
24
24
  module Ronin
25
- class ObjectContextNotFound < RuntimeError
25
+ module Objectify
26
+ class ObjectContextNotFound < RuntimeError
27
+ end
26
28
  end
27
29
  end
@@ -22,6 +22,8 @@
22
22
  #
23
23
 
24
24
  module Ronin
25
- class UnknownObject < RuntimeError
25
+ module Objectify
26
+ class UnknownObjectContext < RuntimeError
27
+ end
26
28
  end
27
29
  end
@@ -31,8 +31,11 @@ module Ronin
31
31
 
32
32
  setup_session do
33
33
  parameter :host, :description => 'Telnet host'
34
- parameter :port, :value => Network::Telnet.default_port,
35
- :description => 'Telnet port'
34
+ parameter :port,
35
+ :default => lambda {
36
+ Ronin::Network::Telnet.default_port
37
+ },
38
+ :description => 'Telnet port'
36
39
 
37
40
  parameter :telnet_user, :description => 'Telnet user'
38
41
  parameter :telnet_password, :description => 'Telnet password'
@@ -21,5 +21,4 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/web/extensions'
25
- require 'ronin/web/web'
24
+ require 'ronin/translators/translator'
@@ -21,5 +21,5 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/hexdump/hexdump'
25
- require 'ronin/hexdump/extensions'
24
+ require 'ronin/ui/console'
25
+ require 'ronin/ui/hexdump'
@@ -21,5 +21,5 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/hexdump/extensions/file'
25
- require 'ronin/hexdump/extensions/kernel'
24
+ require 'ronin/ui/hexdump/hexdump'
25
+ require 'ronin/ui/hexdump/extensions'
@@ -0,0 +1,25 @@
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/hexdump/extensions/file'
25
+ require 'ronin/ui/hexdump/extensions/kernel'
@@ -21,7 +21,7 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/hexdump/hexdump'
24
+ require 'ronin/ui/hexdump/hexdump'
25
25
 
26
26
  class File
27
27
 
@@ -30,7 +30,7 @@ class File
30
30
  # to the given _output_ stream.
31
31
  #
32
32
  def self.hexdump(path,output=STDOUT)
33
- Ronin::Hexdump.dump(self.open(path),output)
33
+ Ronin::UI::Hexdump.dump(self.open(path),output)
34
34
  end
35
35
 
36
36
  end
@@ -21,13 +21,13 @@
21
21
  #++
22
22
  #
23
23
 
24
- require 'ronin/hexdump/hexdump'
24
+ require 'ronin/ui/hexdump/hexdump'
25
25
 
26
26
  module Kernel
27
27
  #
28
28
  # Hexdumps the specified _object_ to the given _output_ stream.
29
29
  #
30
30
  def hexdump(object,output=STDOUT)
31
- Ronin::Hexdump.dump(object,output)
31
+ Ronin::UI::Hexdump.dump(object,output)
32
32
  end
33
33
  end
@@ -0,0 +1,78 @@
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
+ module Ronin
25
+ module UI
26
+ module Hexdump
27
+ #
28
+ # Hexdumps the specified _object_ to the given _output_ stream.
29
+ #
30
+ def Hexdump.dump(object,output=STDOUT)
31
+ index = 0
32
+ offset = 0
33
+ hex_segment = nil
34
+ print_segment = nil
35
+
36
+ segment = lambda {
37
+ output.printf(
38
+ "%.8x %s |%s|\n",
39
+ index,
40
+ hex_segment.join(' ').ljust(47).insert(23,' '),
41
+ print_segment
42
+ )
43
+ }
44
+
45
+ object.each_byte do |b|
46
+ if offset == 0
47
+ hex_segment = []
48
+ print_segment = []
49
+ end
50
+
51
+ hex_segment << ("%.2x" % b)
52
+
53
+ print_segment[offset] = case b
54
+ when (0x20..0x7e)
55
+ b.chr
56
+ else
57
+ '.'
58
+ end
59
+
60
+ offset += 1
61
+
62
+ if (offset >= 16)
63
+ segment.call
64
+
65
+ offset = 0
66
+ index += 16
67
+ end
68
+ end
69
+
70
+ unless offset == 0
71
+ segment.call
72
+ end
73
+
74
+ return nil
75
+ end
76
+ end
77
+ end
78
+ end