ronin 0.1.3 → 0.1.4

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 (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
@@ -23,5 +23,5 @@
23
23
 
24
24
  module Ronin
25
25
  # Ronin version
26
- VERSION = '0.1.3'
26
+ VERSION = '0.1.4'
27
27
  end
@@ -6,6 +6,7 @@ describe String do
6
6
  before(:all) do
7
7
  @raw_text = "x > y && y != 0"
8
8
  @html_encoded_text = "x > y && y != 0"
9
+ @html_formatted_text = "x > y && y != 0"
9
10
 
10
11
  @raw_html = "<p>Hello <strong>dude</strong></p>"
11
12
  @stripped_text = "Hello dude"
@@ -34,4 +35,12 @@ describe String do
34
35
  it "String#strip_html should strip any HTML from itself" do
35
36
  @raw_html.strip_html.should == @stripped_text
36
37
  end
38
+
39
+ it "should provide String#format_html" do
40
+ @raw_text.respond_to?('format_html').should == true
41
+ end
42
+
43
+ it "String#format_html should format each byte of the String" do
44
+ @raw_text.format_html.should == @html_formatted_text
45
+ end
37
46
  end
@@ -6,6 +6,7 @@ describe String do
6
6
  before(:all) do
7
7
  @uri_unencoded = "mod % 3"
8
8
  @uri_encoded = "mod%20%25%203"
9
+ @uri_http_encoded = "%6d%6f%64%20%25%20%33"
9
10
  @uri_unescaped = "x + y"
10
11
  @uri_escaped = "x+%2B+y"
11
12
  end
@@ -41,4 +42,12 @@ describe String do
41
42
  it "String#uri_unescape should URI unescape itself" do
42
43
  @uri_escaped.uri_unescape.should == @uri_unescaped
43
44
  end
45
+
46
+ it "should provide String#format_http" do
47
+ @uri_unencoded.respond_to?('format_http').should == true
48
+ end
49
+
50
+ it "String#format_http should format each byte of the String" do
51
+ @uri_unencoded.format_http.should == @uri_http_encoded
52
+ end
44
53
  end
@@ -4,18 +4,37 @@ require 'spec_helper'
4
4
 
5
5
  describe String do
6
6
  before(:all) do
7
- @string = ""
7
+ @string = "hello"
8
8
  end
9
9
 
10
10
  it "should provide String#format_chars" do
11
11
  @string.respond_to?('format_chars').should == true
12
12
  end
13
13
 
14
+ it "String#format_chars should format each character in the String" do
15
+ @string.format_chars { |c|
16
+ "_#{c}"
17
+ }.should == "_h_e_l_l_o"
18
+ end
19
+
14
20
  it "should provide String#format_bytes" do
15
21
  @string.respond_to?('format_bytes').should == true
16
22
  end
17
23
 
24
+ it "String#format_bytes should format each byte in the String" do
25
+ @string.format_bytes { |b|
26
+ sprintf("%%%x",b)
27
+ }.should == "%68%65%6c%6c%6f"
28
+ end
29
+
18
30
  it "should provide String#random_case" do
19
31
  @string.respond_to?('random_case').should == true
20
32
  end
33
+
34
+ it "String#random_case should randomly capitalize each character" do
35
+ new_string = @string.random_case
36
+
37
+ new_string.should_not == @string
38
+ new_string.downcase.should == @string
39
+ end
21
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -9,39 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-08 00:00:00 -08:00
12
+ date: 2009-01-22 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hpricot
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: mechanize
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: spidr
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 0.1.3
44
- version:
45
15
  - !ruby/object:Gem::Dependency
46
16
  name: dm-core
47
17
  type: :runtime
@@ -130,7 +100,7 @@ dependencies:
130
100
  requirements:
131
101
  - - ">="
132
102
  - !ruby/object:Gem::Version
133
- version: 0.1.2
103
+ version: 0.1.3
134
104
  version:
135
105
  - !ruby/object:Gem::Dependency
136
106
  name: contextify
@@ -170,7 +140,7 @@ dependencies:
170
140
  requirements:
171
141
  - - ">="
172
142
  - !ruby/object:Gem::Version
173
- version: 1.8.2
143
+ version: 1.8.3
174
144
  version:
175
145
  description: Ronin is a Ruby platform designed for information security and data exploration tasks. Ronin allows for the rapid development and distribution of code over many of the common Source-Code-Management (SCM) systems.
176
146
  email:
@@ -203,6 +173,7 @@ files:
203
173
  - lib/ronin/extensions/uri/query_params.rb
204
174
  - lib/ronin/extensions/uri/http.rb
205
175
  - lib/ronin/extensions/string.rb
176
+ - lib/ronin/extensions/file.rb
206
177
  - lib/ronin/formatting.rb
207
178
  - lib/ronin/formatting/digest.rb
208
179
  - lib/ronin/formatting/binary.rb
@@ -221,14 +192,10 @@ files:
221
192
  - lib/ronin/formatting/extensions/html/string.rb
222
193
  - lib/ronin/formatting/extensions/http.rb
223
194
  - lib/ronin/formatting/extensions/http/string.rb
224
- - lib/ronin/hexdump.rb
225
- - lib/ronin/hexdump/hexdump.rb
226
- - lib/ronin/hexdump/extensions.rb
227
- - lib/ronin/hexdump/extensions/file.rb
228
- - lib/ronin/hexdump/extensions/kernel.rb
229
195
  - lib/ronin/chars.rb
230
196
  - lib/ronin/chars/char_set.rb
231
197
  - lib/ronin/chars/chars.rb
198
+ - lib/ronin/translators.rb
232
199
  - lib/ronin/translators/translator.rb
233
200
  - lib/ronin/path.rb
234
201
  - lib/ronin/network.rb
@@ -275,16 +242,6 @@ files:
275
242
  - lib/ronin/rpc/service.rb
276
243
  - lib/ronin/rpc/console.rb
277
244
  - lib/ronin/rpc/shell.rb
278
- - lib/ronin/web.rb
279
- - lib/ronin/web/extensions.rb
280
- - lib/ronin/web/extensions/hpricot.rb
281
- - lib/ronin/web/extensions/hpricot/tag.rb
282
- - lib/ronin/web/extensions/hpricot/text.rb
283
- - lib/ronin/web/extensions/hpricot/comment.rb
284
- - lib/ronin/web/extensions/hpricot/elem.rb
285
- - lib/ronin/web/extensions/hpricot/container.rb
286
- - lib/ronin/web/extensions/hpricot/doc.rb
287
- - lib/ronin/web/web.rb
288
245
  - lib/ronin/sessions.rb
289
246
  - lib/ronin/sessions/session.rb
290
247
  - lib/ronin/sessions/tcp.rb
@@ -295,7 +252,6 @@ files:
295
252
  - lib/ronin/sessions/imap.rb
296
253
  - lib/ronin/sessions/telnet.rb
297
254
  - lib/ronin/sessions/http.rb
298
- - lib/ronin/sessions/web.rb
299
255
  - lib/ronin/database.rb
300
256
  - lib/ronin/database/exceptions.rb
301
257
  - lib/ronin/database/exceptions/invalid_config.rb
@@ -327,6 +283,12 @@ files:
327
283
  - lib/ronin/cache/extension.rb
328
284
  - lib/ronin/cache/cache.rb
329
285
  - lib/ronin/cache/ronin.rb
286
+ - lib/ronin/ui.rb
287
+ - lib/ronin/ui/hexdump.rb
288
+ - lib/ronin/ui/hexdump/hexdump.rb
289
+ - lib/ronin/ui/hexdump/extensions.rb
290
+ - lib/ronin/ui/hexdump/extensions/file.rb
291
+ - lib/ronin/ui/hexdump/extensions/kernel.rb
330
292
  - lib/ronin/ui/console.rb
331
293
  - lib/ronin/ui/shell.rb
332
294
  - lib/ronin/ui/command_line.rb
@@ -370,7 +332,6 @@ files:
370
332
  - spec/formatting/text_spec.rb
371
333
  - spec/code/reference_spec.rb
372
334
  - spec/code/symbol_table_spec.rb
373
- - spec/web/extensions/hpricot_spec.rb
374
335
  - spec/license_spec.rb
375
336
  - spec/path_spec.rb
376
337
  - spec/platform_spec.rb
@@ -1,76 +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
- module Ronin
25
- module Hexdump
26
- #
27
- # Hexdumps the specified _object_ to the given _output_ stream.
28
- #
29
- def Hexdump.dump(object,output=STDOUT)
30
- index = 0
31
- offset = 0
32
- hex_segment = nil
33
- print_segment = nil
34
-
35
- segment = lambda {
36
- output.printf(
37
- "%.8x %s |%s|\n",
38
- index,
39
- hex_segment.join(' ').ljust(47).insert(23,' '),
40
- print_segment
41
- )
42
- }
43
-
44
- object.each_byte do |b|
45
- if offset == 0
46
- hex_segment = []
47
- print_segment = []
48
- end
49
-
50
- hex_segment << ("%.2x" % b)
51
-
52
- print_segment[offset] = case b
53
- when (0x20..0x7e)
54
- b.chr
55
- else
56
- '.'
57
- end
58
-
59
- offset += 1
60
-
61
- if (offset >= 16)
62
- segment.call
63
-
64
- offset = 0
65
- index += 16
66
- end
67
- end
68
-
69
- unless offset == 0
70
- segment.call
71
- end
72
-
73
- return nil
74
- end
75
- end
76
- end
@@ -1,78 +0,0 @@
1
- #
2
- #--
3
- # Ronin - A ruby development platform designed for information security
4
- # and data 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/sessions/session'
25
- require 'ronin/web'
26
-
27
- module Ronin
28
- module Sessions
29
- module Web
30
- include Session
31
-
32
- setup_session do
33
- parameter :web_proxy, :value => Ronin::Web.proxy,
34
- :description => 'Web Proxy'
35
-
36
- parameter :web_user_agent, :value => Ronin::Web.user_agent,
37
- :description => 'Web User-Agent'
38
- end
39
-
40
- protected
41
-
42
- def web_agent(options={},&block)
43
- options[:proxy] ||= @web_proxy
44
- options[:user_agent] ||= @web_user_agent
45
-
46
- return Ronin::Web.agent(options,&block)
47
- end
48
-
49
- def web_get(uri,options={},&block)
50
- page = web_agent(options).get(uri)
51
-
52
- block.call(page) if block
53
- return page
54
- end
55
-
56
- def web_get_body(uri,options={},&block)
57
- body = web_agent(options).get(uri).body
58
-
59
- block.call(body) if block
60
- return body
61
- end
62
-
63
- def web_post(uri,options={},&block)
64
- page = web_agent(options).post(uri)
65
-
66
- block.call(page) if block
67
- return page
68
- end
69
-
70
- def web_post_body(uri,options={},&block)
71
- body = web_agent(options).post(uri).body
72
-
73
- block.call(body) if block
74
- return body
75
- end
76
- end
77
- end
78
- end
@@ -1 +0,0 @@
1
- require 'ronin/web/extensions/hpricot'
@@ -1,5 +0,0 @@
1
- require 'ronin/web/extensions/hpricot/comment'
2
- require 'ronin/web/extensions/hpricot/tag'
3
- require 'ronin/web/extensions/hpricot/container'
4
- require 'ronin/web/extensions/hpricot/elem'
5
- require 'ronin/web/extensions/hpricot/doc'
@@ -1,19 +0,0 @@
1
- require 'hpricot'
2
-
3
- module Hpricot
4
- class Comment
5
-
6
- #
7
- # Returns +true+ if the comment has the same content the _other_ comment,
8
- # returns +false+ otherwise.
9
- #
10
- def eql?(other)
11
- return false unless self.class == other.class
12
-
13
- return content == other.content
14
- end
15
-
16
- alias == eql?
17
-
18
- end
19
- end
@@ -1,46 +0,0 @@
1
- require 'hpricot'
2
-
3
- module Hpricot
4
- module Container
5
- #
6
- # Iterates over every sub-child, passing each to the specified _block_.
7
- #
8
- def every_child(&block)
9
- each_child do |child|
10
- block.call(child)
11
-
12
- if child.kind_of?(Hpricot::Container)
13
- child.every_child(&block)
14
- end
15
- end
16
-
17
- return self
18
- end
19
-
20
- #
21
- # Iterates over every text node, passing each to the specified _block_.
22
- #
23
- def all_text(&block)
24
- every_child do |child|
25
- block.call(child) if child.kind_of?(Text)
26
- end
27
- end
28
-
29
- #
30
- # Returns the number of all sub-children.
31
- #
32
- def count_children
33
- sum = 0
34
-
35
- every_child { |child| sum += 1 }
36
- return sum
37
- end
38
-
39
- #
40
- # Compares the number of sub-children with that of the _other_ element.
41
- #
42
- def <=>(other)
43
- count_children <=> other.count_children
44
- end
45
- end
46
- end