emonti-rbkb 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,7 +1,28 @@
1
+ == 0.6.8.1 / 2009-06-12
2
+ * Enhancements
3
+ * Added String.rotate_bytes per request for a rotation cypher by
4
+ wardwouts@github. I pilfered this implementation mostly from Timur Duehr.
5
+
6
+ == 0.6.8 / 2009-06-04
7
+ * Enhancements
8
+ * 0.6.8 is geared towards beginning to make rbkb compatible with ruby 1.9.x
9
+ (tested on 1.9.1). Had to sacrifice the 'uuid' helper method
10
+ since something happened to SHA1 in ruby 1.9. It may make a comeback if
11
+ anybody yells about this.
12
+ * Known Issues:
13
+ * There are problems with binary releases of eventmachine with 1.9.1 on win32
14
+ this does not appear to be caused by rbkb, however we're keeping an eye on
15
+ it. For now, this is causing the plug tools to crash and test cases to
16
+ fail on 1.9.1 win32.
17
+
1
18
  == 0.6.7
19
+ * Enhancements
20
+ * Http::Parameters was given the same treatement as headers got in 0.6.6.
21
+ Technically params are supposed to be unique, but we try to stay flexible
22
+ in Rbkb.
2
23
  * Bug-fix:
3
24
  * Fixed a silly typing bug in Http::Parameters.set_param introduced
4
- with 0.6.6
25
+ around 0.6.6
5
26
 
6
27
  == 0.6.6
7
28
  * Bug-fix:
@@ -11,7 +32,7 @@
11
32
  == 0.6.5.2
12
33
  * Enhancements
13
34
  * d64 and b64 now support the -f option for input files as rdoc indicates
14
- Thanks to Cory Scott for catching this doc error his patch.
35
+ Thanks to Cory Scott for catching this doc error and for his patch.
15
36
 
16
37
  == 0.6.5.1
17
38
  * Minor bug-fix
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = rbkb
2
2
 
3
- * http://www.github.com/emonti/rbkb
3
+ * http://emonti.github.com/rbkb
4
4
 
5
5
  == DESCRIPTION:
6
6
 
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ PROJ.name = 'rbkb'
22
22
  PROJ.authors = 'Eric Monti'
23
23
  PROJ.email = 'emonti@matasano.com'
24
24
  PROJ.description = 'Rbkb is a collection of ruby-based pen-testing and reversing tools. Inspired by Matasano Blackbag.'
25
- PROJ.url = 'http://github.com/emonti/rbkb'
25
+ PROJ.url = 'http://emonti.github.com/rbkb'
26
26
  PROJ.version = Rbkb::VERSION
27
27
  PROJ.rubyforge.name = 'rbkb'
28
28
  PROJ.readme_file = 'README.rdoc'
data/lib/rbkb/cli.rb CHANGED
@@ -180,9 +180,9 @@ module Rbkb::Cli
180
180
  @opts[lkey] =
181
181
  if($2[0,1] == '-')
182
182
  $2[1..-1].hex_to_num * -1
183
- else
183
+ else
184
184
  $2.hex_to_num
185
- end
185
+ end
186
186
  end
187
187
  end
188
188
  end
data/lib/rbkb/extends.rb CHANGED
@@ -4,18 +4,12 @@
4
4
  require "stringio"
5
5
  require 'zlib'
6
6
  require 'open3'
7
- require 'sha1'
8
7
 
9
8
  module Rbkb
10
9
  DEFAULT_BYTE_ORDER=:big
11
10
  HEXCHARS = [("0".."9").to_a, ("a".."f").to_a].flatten
12
11
  end
13
12
 
14
- # Generates a "universally unique identifier"
15
- def uuid
16
- (SHA1::sha1(rand.to_s)).to_s
17
- end
18
-
19
13
  # Generates a random alphanumeric string of 'size' bytes (8 by default)
20
14
  def random_string(size = 8)
21
15
  chars = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a
@@ -212,6 +206,18 @@ class String
212
206
  (self.dat_to_num ^ x)#.to_bytes
213
207
  end
214
208
 
209
+ # Byte rotation as found in lame ciphers.
210
+ # This was cribbed from Timur Duehr with only a minor change.
211
+ def rotate_bytes(k=0)
212
+ r = self.dup
213
+ i=0
214
+ self.each_byte do |b|
215
+ r[i] = ((b + k) % 384).chr
216
+ i+=1
217
+ end
218
+ return r
219
+ end
220
+
215
221
  # String randomizer
216
222
  def randomize ; self.split('').randomize.to_s ; end
217
223
 
@@ -322,17 +328,17 @@ class String
322
328
 
323
329
  dat=self
324
330
  if find.kind_of? Regexp
325
- search = lambda do |find, buf|
326
- if m = find.match(buf)
331
+ search = lambda do |m, buf|
332
+ if m = m.match(buf)
327
333
  mtch = m[0]
328
334
  off,endoff = m.offset(0)
329
335
  return off, endoff, mtch
330
336
  end
331
337
  end
332
338
  else
333
- search = lambda do |find, buf|
334
- if off = buf.index(find)
335
- return off, off+find.size, find
339
+ search = lambda do |s, buf|
340
+ if off = buf.index(s)
341
+ return off, off+s.size, s
336
342
  end
337
343
  end
338
344
  end
@@ -405,9 +411,12 @@ class String
405
411
  urx = /((?:#{prx}\x00){#{min}}(?:#{prx}\x00)*(?:\x00\x00)?)/
406
412
 
407
413
  rx = case (opts[:encoding] || :both).to_sym
408
- when :ascii : arx
409
- when :unicode : urx
410
- when :both : Regexp.union( arx, urx )
414
+ when :ascii
415
+ arx
416
+ when :unicode
417
+ urx
418
+ when :both
419
+ Regexp.union( arx, urx )
411
420
  else
412
421
  raise "Encoding must be :unicode, :ascii, or :both"
413
422
  end
@@ -61,7 +61,7 @@ module Rbkb::Http
61
61
  def content_length(hdrs=@headers)
62
62
  raise "headers is nil?" if not hdrs
63
63
  if( (not @opts[:ignore_content_length]) and
64
- hdrs.get_header_value("Content-Length").first =~ /^(\d+)$/ )
64
+ hdrs.get_header_value("Content-Length").to_s =~ /^(\d+)$/ )
65
65
 
66
66
  $1.to_i
67
67
  end
@@ -120,20 +120,33 @@ module Rbkb::Http
120
120
  self.map {|h,v| "#{h}: #{v}" }
121
121
  end
122
122
 
123
- def get_header(k)
123
+ def get_all(k)
124
124
  self.select {|h| h[0].downcase == k.downcase }
125
125
  end
126
126
 
127
- def get_header_value(k)
128
- get_header(k).map {|h| h[1]}
127
+ def get_all_values_for(k)
128
+ self.get_all(k).collect {|h,v| v }
129
+ end
130
+ alias all_values_for get_all_values_for
131
+
132
+ def get_header(k)
133
+ self.find {|h| h[0].downcase == k.downcase }
134
+ end
135
+
136
+ def get_value_for(k)
137
+ if h=self.get_header(k)
138
+ return h[1]
139
+ end
129
140
  end
141
+ alias get_header_value get_value_for
142
+ alias value_for get_value_for
130
143
 
131
144
  def delete_header(k)
132
145
  self.delete_if {|h| h[0].downcase == k.downcase }
133
146
  end
134
147
 
135
148
  def set_header(k,v)
136
- sel = get_header(k)
149
+ sel = get_all(k)
137
150
 
138
151
  if sel.empty?
139
152
  self << [k,v]
@@ -143,6 +156,7 @@ module Rbkb::Http
143
156
  return sel
144
157
  end
145
158
  end
159
+ alias set_all_for set_header
146
160
 
147
161
  # The to_raw method returns a raw string of headers as they appear
148
162
  # on the wire.
@@ -22,19 +22,22 @@ module Rbkb::Http
22
22
  self.select {|p| p[0] == k}
23
23
  end
24
24
 
25
+ def get_all_values_for(k)
26
+ self.get_all(k).collect {|p,v| v }
27
+ end
28
+ alias all_values_for get_all_values_for
29
+
25
30
  def get_param(k)
26
31
  self.find {|p| p[0] == k}
27
32
  end
28
33
 
29
34
  def get_value_for(k)
30
- if v=self.get(k)
31
- return v[1]
35
+ if p=self.get_param(k)
36
+ return p[1]
32
37
  end
33
38
  end
34
-
35
- def get_all_values_for(k)
36
- self.get_all(k).map {|p,v| v }
37
- end
39
+ alias get_param_value get_value_for
40
+ alias value_for get_value_for
38
41
 
39
42
  def set_param(k, v)
40
43
  if p=self.get_param(k)
@@ -42,7 +45,7 @@ module Rbkb::Http
42
45
  else
43
46
  p << [k,v]
44
47
  end
45
- return v
48
+ return [[k,v]]
46
49
  end
47
50
 
48
51
  def set_all_for(k, v)
@@ -67,7 +67,7 @@ module Rbkb::Http
67
67
  # opts parameter.
68
68
  def do_chunked_encoding?(hdrs=@headers)
69
69
  ( (not @opts[:ignore_chunked_encoding]) and
70
- (hdrs.get_header_value("Transfer-Encoding").first =~ /(?:^|\W)chunked(?:\W|$)/) )
70
+ (hdrs.get_header_value("Transfer-Encoding").to_s =~ /(?:^|\W)chunked(?:\W|$)/) )
71
71
  end
72
72
 
73
73
  # Returns a new Headers object extended as ResponseHeaders. This is the
data/lib/rbkb/http.rb CHANGED
@@ -5,10 +5,12 @@
5
5
 
6
6
  module Rbkb
7
7
  module Http
8
- VERSION = "0.0.2"
8
+ VERSION = "0.0.3"
9
9
  end
10
10
  end
11
11
 
12
+ require 'time' # gives us Time.httpdate parser and output methods
13
+
12
14
  require "rbkb/http/common.rb"
13
15
  require "rbkb/http/base.rb"
14
16
  require "rbkb/http/request.rb"
@@ -17,4 +19,3 @@ require "rbkb/http/headers.rb"
17
19
  require "rbkb/http/body.rb"
18
20
  require "rbkb/http/parameters.rb"
19
21
 
20
-
data/lib/rbkb.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module Rbkb
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '0.6.7'
5
+ VERSION = '0.6.8'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
data/rbkb.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rbkb}
5
- s.version = "0.6.7"
5
+ s.version = "0.6.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Eric Monti"]
9
- s.date = %q{2009-06-03}
9
+ s.date = %q{2009-06-17}
10
10
  s.description = %q{Rbkb is a collection of ruby-based pen-testing and reversing tools. Inspired by Matasano Blackbag.}
11
11
  s.email = %q{emonti@matasano.com}
12
12
  s.executables = ["b64", "bgrep", "blit", "c", "crc32", "d64", "dedump", "feed", "hexify", "len", "plugsrv", "rex", "rstrings", "slice", "telson", "unhexify", "urldec", "urlenc", "xor"]
13
13
  s.extra_rdoc_files = ["History.txt", "README.rdoc", "bin/b64", "bin/bgrep", "bin/blit", "bin/c", "bin/crc32", "bin/d64", "bin/dedump", "bin/feed", "bin/hexify", "bin/len", "bin/plugsrv", "bin/rex", "bin/rstrings", "bin/slice", "bin/telson", "bin/unhexify", "bin/urldec", "bin/urlenc", "bin/xor", "cli_usage.rdoc", "lib_usage.rdoc"]
14
14
  s.files = ["History.txt", "README.rdoc", "Rakefile", "bin/b64", "bin/bgrep", "bin/blit", "bin/c", "bin/crc32", "bin/d64", "bin/dedump", "bin/feed", "bin/hexify", "bin/len", "bin/plugsrv", "bin/rex", "bin/rstrings", "bin/slice", "bin/telson", "bin/unhexify", "bin/urldec", "bin/urlenc", "bin/xor", "cli_usage.rdoc", "doctor-bag.jpg", "lib/rbkb.rb", "lib/rbkb/cli.rb", "lib/rbkb/cli/b64.rb", "lib/rbkb/cli/bgrep.rb", "lib/rbkb/cli/blit.rb", "lib/rbkb/cli/chars.rb", "lib/rbkb/cli/crc32.rb", "lib/rbkb/cli/d64.rb", "lib/rbkb/cli/dedump.rb", "lib/rbkb/cli/feed.rb", "lib/rbkb/cli/hexify.rb", "lib/rbkb/cli/len.rb", "lib/rbkb/cli/rstrings.rb", "lib/rbkb/cli/slice.rb", "lib/rbkb/cli/telson.rb", "lib/rbkb/cli/unhexify.rb", "lib/rbkb/cli/urldec.rb", "lib/rbkb/cli/urlenc.rb", "lib/rbkb/cli/xor.rb", "lib/rbkb/extends.rb", "lib/rbkb/http.rb", "lib/rbkb/http/base.rb", "lib/rbkb/http/body.rb", "lib/rbkb/http/common.rb", "lib/rbkb/http/headers.rb", "lib/rbkb/http/parameters.rb", "lib/rbkb/http/request.rb", "lib/rbkb/http/response.rb", "lib/rbkb/plug.rb", "lib/rbkb/plug/blit.rb", "lib/rbkb/plug/cli.rb", "lib/rbkb/plug/feed_import.rb", "lib/rbkb/plug/peer.rb", "lib/rbkb/plug/plug.rb", "lib/rbkb/plug/proxy.rb", "lib/rbkb/plug/unix_domain.rb", "lib_usage.rdoc", "rbkb.gemspec", "spec/rbkb_spec.rb", "spec/spec_helper.rb", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test/test_cli_b64.rb", "test/test_cli_bgrep.rb", "test/test_cli_blit.rb", "test/test_cli_chars.rb", "test/test_cli_crc32.rb", "test/test_cli_d64.rb", "test/test_cli_dedump.rb", "test/test_cli_feed.rb", "test/test_cli_helper.rb", "test/test_cli_hexify.rb", "test/test_cli_len.rb", "test/test_cli_rstrings.rb", "test/test_cli_slice.rb", "test/test_cli_telson.rb", "test/test_cli_unhexify.rb", "test/test_cli_urldec.rb", "test/test_cli_urlenc.rb", "test/test_cli_xor.rb", "test/test_helper.rb", "test/test_http.rb", "test/test_http_helper.rb", "test/test_http_request.rb", "test/test_http_response.rb", "test/test_rbkb.rb"]
15
- s.homepage = %q{http://github.com/emonti/rbkb}
15
+ s.homepage = %q{http://emonti.github.com/rbkb}
16
16
  s.rdoc_options = ["--line-numbers", "--main", "README.rdoc"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{rbkb}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emonti-rbkb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Monti
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-03 00:00:00 -07:00
12
+ date: 2009-06-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -182,7 +182,7 @@ files:
182
182
  - test/test_http_response.rb
183
183
  - test/test_rbkb.rb
184
184
  has_rdoc: false
185
- homepage: http://github.com/emonti/rbkb
185
+ homepage: http://emonti.github.com/rbkb
186
186
  post_install_message:
187
187
  rdoc_options:
188
188
  - --line-numbers