emonti-rbkb 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.6.9 / 2009-09-01
2
+ * Enhancements
3
+ * telson and feed now support -s/--source address:port using TCP with
4
+ bind_connect via eventmachine
5
+ * random_string and random_alphanum added to String extensions
6
+ * Bug-Fix
7
+ * Plug's PeerList.find_peers was returning nil resulting in problems for
8
+ blit -l amongst other things.
9
+
1
10
  == 0.6.8.1 / 2009-06-12
2
11
  * Enhancements
3
12
  * Added String.rotate_bytes per request for a rotation cypher by
data/cli_usage.rdoc CHANGED
@@ -106,14 +106,15 @@ Feed can do the following things with minimum fuss:
106
106
  -v, --version Show version and exit
107
107
  -o, --output=FILE Output to file
108
108
  -l, --listen=(ADDR:?)PORT Server - on port (and addr?)
109
+ -s, --source=(ADDR:?)PORT Bind client on port and addr
109
110
  -b, --blit=(ADDR:)?PORT Where to listen for blit
110
111
  -i, --[no-]initiate Send the first message on connect
111
112
  -e, --[no-]end End connection when feed is exhausted
112
- -s, --[no-]step 'Continue' prompt between messages
113
+ --[no-]step 'Continue' prompt between messages
113
114
  -u, --udp Use UDP instead of TCP
114
115
  -r, --reconnect Attempt to reconnect endlessly.
115
116
  -q, --quiet Suppress verbose messages/dumps
116
- -S, --squelch-exhausted Squelch 'FEED EXHAUSTED' messages
117
+ -Q, --squelch-exhausted Squelch 'FEED EXHAUSTED' messages
117
118
  Sources: (can be combined)
118
119
  -f, --from-files=GLOB Import messages from raw files
119
120
  -x, --from-hex=FILE Import messages from hexdumps
@@ -121,6 +122,7 @@ Feed can do the following things with minimum fuss:
121
122
  -p, --from-pcap=FILE[:FILTER] Import messages from pcap
122
123
 
123
124
 
125
+
124
126
  === hexify
125
127
 
126
128
  Converts a string or raw data to hex characters. Input can be supplied via
@@ -215,16 +217,17 @@ Telson is for doing the following things with minimum fuss:
215
217
  of a conversation.
216
218
 
217
219
  Usage: telson [options] host:port
218
- -h, --help Show this message
219
- -v, --version Show version and exit
220
- -o, --output=FILE Output to file
221
- -q, --quiet Turn off verbose logging
222
- -d, --dump-format=hex/raw Output conversations in hexdump or raw
223
- -b, --blit=ADDR:PORT Where to listen for blit
224
- -u, --udp UDP mode
225
- -S, --start-tls Initiate TLS
226
- -r, --reconnect Attempt to reconnect endlessly.
227
- -s, --source=(ADDR:?)PORT Bind on port (and addr?)
220
+ -h, --help Show this message
221
+ -v, --version Show version and exit
222
+ -o, --output=FILE Output to file
223
+ -q, --quiet Turn off verbose logging
224
+ -d, --dump-format=hex/raw Output conversations in hexdump or raw
225
+ -b, --blit=ADDR:PORT Where to listen for blit
226
+ -u, --udp UDP mode
227
+ -S, --start-tls Initiate TLS
228
+ -r, --reconnect Attempt to reconnect endlessly.
229
+ -s, --source=(ADDR:?)PORT Bind client on port and addr
230
+
228
231
 
229
232
  === unhexify
230
233
 
data/lib/rbkb/cli/feed.rb CHANGED
@@ -35,7 +35,7 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
35
35
  @persist = false
36
36
  @transport = :TCP
37
37
  @svr_method = :start_server
38
- @cli_method = :connect
38
+ @cli_method = :bind_connect
39
39
  @blit_addr = Plug::Blit::DEFAULT_IPADDR
40
40
  @blit_port = Plug::Blit::DEFAULT_PORT
41
41
 
@@ -74,6 +74,15 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
74
74
  end
75
75
  end
76
76
 
77
+ arg.on("-s", "--source=(ADDR:?)PORT", "Bind client on port and addr") do |p|
78
+ if m=/^(?:([\w\.]+):)?(\d+)$/.match(p)
79
+ @local_addr = $1 if $1
80
+ @local_port = $2.to_i
81
+ else
82
+ bail("Invalid source argument: #{p.inspect}")
83
+ end
84
+ end
85
+
77
86
  arg.on("-b", "--blit=(ADDR:)?PORT", "Where to listen for blit") do |b|
78
87
  puts b
79
88
  unless(m=/^(?:([\w\._-]+):)?(\d+)$/.match(b))
@@ -91,7 +100,7 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
91
100
  @feed_opts[:close_at_end] = c
92
101
  end
93
102
 
94
- arg.on("-s", "--[no-]step", "'Continue' prompt between messages") do |s|
103
+ arg.on("--[no-]step", "'Continue' prompt between messages") do |s|
95
104
  @feed_opts[:step] = s
96
105
  end
97
106
 
@@ -149,14 +158,14 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
149
158
  @svr_method = @cli_method = :open_datagram_socket
150
159
  end
151
160
 
161
+ @local_port ||= 0
152
162
  # Prepare EventMachine arguments based on whether we are a client or server
153
- if @listen
154
- @evma_addr = @local_addr
155
- @evma_port = @local_port
163
+ if @listen # server
156
164
  @meth = @svr_method
165
+ addr_args = [@local_addr, @local_port]
157
166
  @feed_opts[:kind] = :server
158
167
  @feed_opts[:no_stop_on_unbind] = true
159
- else
168
+ else # client
160
169
 
161
170
  ## Get target/listen argument for client mode
162
171
  unless (m = /^([\w\.]+):(\d+)$/.match(tgt=@argv.shift))
@@ -167,11 +176,9 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
167
176
  @target_port = m[2].to_i
168
177
 
169
178
  if @transport == :UDP
170
- @evma_addr = @local_addr
171
- @evma_port = @local_port || 0
179
+ addr_args = [@local_addr, @local_port]
172
180
  else
173
- @evma_addr = @target_addr
174
- @evma_port = @target_port
181
+ addr_args = [@local_addr, @local_port, @target_addr, @target_port]
175
182
  end
176
183
 
177
184
  @meth = @cli_method
@@ -182,8 +189,7 @@ class Rbkb::Cli::Feed < Rbkb::Cli::Executable
182
189
 
183
190
  @em_args=[
184
191
  @meth,
185
- @evma_addr,
186
- @evma_port,
192
+ addr_args,
187
193
  Plug::ArrayFeeder,
188
194
  @transport,
189
195
  @feed_opts
@@ -20,7 +20,6 @@ class Rbkb::Cli::Telson < Rbkb::Cli::PlugCli
20
20
  this.local_port = 0
21
21
  end
22
22
 
23
- @srced = false
24
23
  @persist = false
25
24
  end
26
25
 
@@ -32,13 +31,12 @@ class Rbkb::Cli::Telson < Rbkb::Cli::PlugCli
32
31
  @persist=true
33
32
  end
34
33
 
35
- arg.on("-s", "--source=(ADDR:?)PORT", "Bind on port (and addr?)") do |p|
34
+ arg.on("-s", "--source=(ADDR:?)PORT", "Bind client on port and addr") do |p|
36
35
  if m=/^(?:([\w\.]+):)?(\d+)$/.match(p)
37
36
  @local_addr = $1 if $1
38
37
  @local_port = $2.to_i
39
- @srced = true
40
38
  else
41
- bail("Invalid listen argument: #{p.inspect}")
39
+ bail("Invalid source argument: #{p.inspect}")
42
40
  end
43
41
  end
44
42
  end
@@ -54,23 +52,30 @@ class Rbkb::Cli::Telson < Rbkb::Cli::PlugCli
54
52
 
55
53
  def go(*args)
56
54
  super(*args)
57
-
58
55
  loop do
59
56
  EventMachine.run {
60
57
  if @transport == :TCP
61
- bail("Sorry: --source only works with UDP.") if @srced
62
-
63
- c=EventMachine.connect(@target_addr, @target_port, Plug::Telson, @transport, @plug_opts)
64
58
 
59
+ c=EventMachine.bind_connect( @local_addr,
60
+ @local_port,
61
+ @target_addr,
62
+ @target_port,
63
+ Plug::Telson,
64
+ @transport,
65
+ @plug_opts )
65
66
  elsif @transport == :UDP
66
- c=EventMachine.open_datagram_socket( @local_addr, @local_port, Plug::Telson, @transport, @plug_opts)
67
+ c=EventMachine.open_datagram_socket( @local_addr,
68
+ @local_port,
69
+ Plug::Telson,
70
+ @transport,
71
+ @plug_opts )
72
+
67
73
  c.peers.add_peer_manually(@target_addr, @target_port)
68
74
 
69
75
  ### someday maybe raw or others?
70
76
  else
71
77
  raise "bad transport protocol"
72
78
  end
73
-
74
79
  EventMachine.start_server(@blit_addr, @blit_port, Plug::Blit, @blit_proto, c)
75
80
  Plug::UI::verbose("** BLITSRV-#{@blit_addr}:#{@blit_port}(TCP) Started") # XXX
76
81
  }
data/lib/rbkb/extends.rb CHANGED
@@ -11,11 +11,16 @@ module Rbkb
11
11
  end
12
12
 
13
13
  # Generates a random alphanumeric string of 'size' bytes (8 by default)
14
- def random_string(size = 8)
14
+ def random_alphanum(size = 8)
15
15
  chars = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a
16
16
  (1..size).collect{|a| chars[rand(chars.size)]}.join
17
17
  end
18
18
 
19
+ # Generates a random string of 'size' bytes (8 by default)
20
+ def random_string(size = 8)
21
+ chars = (0..255).map {|c| c.chr }
22
+ (1..size).collect {|a| char[rand(chars.size)]}
23
+ end
19
24
 
20
25
  # Simple syntactic sugar to pass any object to a block
21
26
  def with(x)
@@ -45,7 +45,6 @@ module Plug
45
45
 
46
46
  def find_peer(addr)
47
47
  self.find {|p| p.addr == addr }
48
- return nil
49
48
  end
50
49
 
51
50
  def add_peer(addr)
data/lib/rbkb.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module Rbkb
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '0.6.8'
5
+ VERSION = '0.6.9'
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,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rbkb}
5
- s.version = "0.6.8"
5
+ s.version = "0.6.9"
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-17}
9
+ s.date = %q{2009-09-01}
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"]
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.8
4
+ version: 0.6.9
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-17 00:00:00 -07:00
12
+ date: 2009-09-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency