emonti-rbkb 0.6.2.1 → 0.6.6
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.
- data/History.txt +32 -0
- data/README.rdoc +10 -7
- data/Rakefile +47 -0
- data/bin/feed +5 -0
- data/bin/plugsrv +3 -3
- data/cli_usage.rdoc +44 -9
- data/doctor-bag.jpg +0 -0
- data/lib/rbkb.rb +47 -2
- data/lib/rbkb/cli.rb +8 -6
- data/lib/rbkb/cli/b64.rb +5 -0
- data/lib/rbkb/cli/bgrep.rb +14 -9
- data/lib/rbkb/cli/chars.rb +2 -1
- data/lib/rbkb/cli/crc32.rb +4 -1
- data/lib/rbkb/cli/d64.rb +3 -0
- data/lib/rbkb/cli/dedump.rb +5 -3
- data/lib/rbkb/cli/feed.rb +223 -0
- data/lib/rbkb/cli/hexify.rb +3 -3
- data/lib/rbkb/cli/len.rb +12 -9
- data/lib/rbkb/cli/rstrings.rb +13 -10
- data/lib/rbkb/cli/slice.rb +1 -0
- data/lib/rbkb/cli/telson.rb +21 -57
- data/lib/rbkb/cli/unhexify.rb +2 -6
- data/lib/rbkb/cli/urldec.rb +1 -0
- data/lib/rbkb/cli/urlenc.rb +1 -0
- data/lib/rbkb/extends.rb +41 -6
- data/lib/rbkb/http.rb +20 -0
- data/lib/rbkb/http/base.rb +172 -0
- data/lib/rbkb/http/body.rb +214 -0
- data/lib/rbkb/http/common.rb +74 -0
- data/lib/rbkb/http/headers.rb +356 -0
- data/lib/rbkb/http/parameters.rb +101 -0
- data/lib/rbkb/http/request.rb +58 -0
- data/lib/rbkb/http/response.rb +86 -0
- data/lib/rbkb/plug.rb +3 -3
- data/lib/rbkb/plug/cli.rb +83 -0
- data/lib/rbkb/plug/feed_import.rb +74 -0
- data/lib/rbkb/plug/plug.rb +36 -19
- data/lib/rbkb/plug/unix_domain.rb +75 -0
- data/rbkb.gemspec +38 -0
- data/spec/rbkb_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +34 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +292 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/test/test_cli_b64.rb +35 -0
- data/test/test_cli_bgrep.rb +137 -0
- data/test/test_cli_blit.rb +11 -0
- data/test/test_cli_chars.rb +21 -0
- data/test/test_cli_crc32.rb +108 -0
- data/test/test_cli_d64.rb +22 -0
- data/test/test_cli_dedump.rb +118 -0
- data/test/test_cli_feed.rb +11 -0
- data/test/test_cli_helper.rb +96 -0
- data/test/test_cli_hexify.rb +63 -0
- data/test/test_cli_len.rb +96 -0
- data/test/test_cli_rstrings.rb +15 -0
- data/test/test_cli_slice.rb +73 -0
- data/test/test_cli_telson.rb +11 -0
- data/test/test_cli_unhexify.rb +43 -0
- data/test/test_cli_urldec.rb +50 -0
- data/test/test_cli_urlenc.rb +44 -0
- data/test/test_cli_xor.rb +71 -0
- data/test/test_helper.rb +5 -0
- data/test/test_http.rb +27 -0
- data/test/test_http_helper.rb +60 -0
- data/test/test_http_request.rb +136 -0
- data/test/test_http_response.rb +222 -0
- data/test/test_rbkb.rb +19 -0
- metadata +127 -21
data/History.txt
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
== 0.6.6
|
2
|
+
* Bug-fix:
|
3
|
+
* Http library improperly made headers unique by name. The library has
|
4
|
+
been changed so that headers no longer tries to pretend to be a hash.
|
5
|
+
|
6
|
+
== 0.6.5.2
|
7
|
+
* Enhancements
|
8
|
+
* d64 and b64 now support the -f option for input files as rdoc indicates
|
9
|
+
Thanks to Cory Scott for catching this doc error his patch.
|
10
|
+
|
11
|
+
== 0.6.5.1
|
12
|
+
* Minor bug-fix
|
13
|
+
* fixed a problem with the gem, version bump is for github visibility
|
14
|
+
|
15
|
+
== 0.6.5 / 2009-03-24
|
16
|
+
|
17
|
+
* Enhancements
|
18
|
+
* Added a http protocol library (Rbkb::Http)
|
19
|
+
* Added TLS support to telson (-S/--start-tls in cli)
|
20
|
+
* Added raw dump output to telson (-d raw/hex in cli : hex is default)
|
21
|
+
|
22
|
+
== 0.6.4 / 2009-03-20
|
23
|
+
|
24
|
+
* Enhancements
|
25
|
+
* Added unit tests for all cli utilities. Most are fairly complete.
|
26
|
+
|
27
|
+
== 0.6.3 / 2009-03-10
|
28
|
+
|
29
|
+
* Enhancements
|
30
|
+
* Started using bones to help manage this mess. History.txt is born!
|
31
|
+
* begun adding test cases for cli utils
|
32
|
+
* crc32 takes an optional filename argument as first arg
|
data/README.rdoc
CHANGED
@@ -34,7 +34,7 @@ the things in 'bkb' have not yet made it to 'rbkb' (and may not).
|
|
34
34
|
=== Command Line Tools
|
35
35
|
|
36
36
|
The tools almost all support '-h', but I'll admit this only goes so far.
|
37
|
-
See
|
37
|
+
See cli_usage.rdoc for usage and a bit of extra info on the various tools.
|
38
38
|
|
39
39
|
When I get some spare time, I'll try and do up some examples of using all
|
40
40
|
the tools.
|
@@ -69,7 +69,7 @@ Ruby BlackBag has a similar set of network tools:
|
|
69
69
|
Much of rbkb is implemented as a bunch of monkeypatches to Array, String,
|
70
70
|
Numeric and other base classes. If this suits your fancy (some people despise
|
71
71
|
monkeypatches, this is not their fancy) then you can 'require "rbkb"' from
|
72
|
-
your irb sessions and own scripts. See '
|
72
|
+
your irb sessions and own scripts. See 'lib_usage.rdoc' for more info.
|
73
73
|
|
74
74
|
|
75
75
|
== REQUIREMENTS:
|
@@ -106,18 +106,21 @@ either add them to your PATH or copy/symlink them somewhere else like
|
|
106
106
|
|
107
107
|
=== Manual installation:
|
108
108
|
|
109
|
-
|
109
|
+
git clone git://github.com/emonti/rbkb.git
|
110
|
+
cd rbkb
|
111
|
+
rake gem:install
|
112
|
+
|
113
|
+
|
114
|
+
or ... you can also install manually without rubygems.
|
110
115
|
|
111
116
|
You can access the rbkb project at github. You'll want git installed:
|
112
117
|
|
113
|
-
|
114
|
-
cd rbkb
|
115
|
-
cp -r wxirb/lib/* /usr/lib/ruby/1.8/site_ruby/1.8 # or another ruby libdir
|
118
|
+
cp -r rbkb/lib/* /usr/lib/ruby/1.8/site_ruby/1.8 # or another ruby libdir
|
116
119
|
cp bin/* ~/bin # or wherever else in your PATH
|
117
120
|
|
118
121
|
Run this to generate docs with rdoc the same way the gem would have:
|
119
122
|
|
120
|
-
|
123
|
+
rake doc:rdoc
|
121
124
|
|
122
125
|
== LICENSE:
|
123
126
|
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
3
|
+
# are where the options are used.
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'bones'
|
7
|
+
Bones.setup
|
8
|
+
rescue LoadError
|
9
|
+
begin
|
10
|
+
load 'tasks/setup.rb'
|
11
|
+
rescue LoadError
|
12
|
+
raise RuntimeError, '### please install the "bones" gem ###'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
ensure_in_path 'lib'
|
17
|
+
require 'rbkb'
|
18
|
+
|
19
|
+
task :default => 'test:run'
|
20
|
+
|
21
|
+
PROJ.name = 'rbkb'
|
22
|
+
PROJ.authors = 'Eric Monti'
|
23
|
+
PROJ.email = 'emonti@matasano.com'
|
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'
|
26
|
+
PROJ.version = Rbkb::VERSION
|
27
|
+
PROJ.rubyforge.name = 'rbkb'
|
28
|
+
PROJ.readme_file = 'README.rdoc'
|
29
|
+
|
30
|
+
PROJ.spec.opts << '--color'
|
31
|
+
|
32
|
+
PROJ.rdoc.opts << '--line-numbers'
|
33
|
+
|
34
|
+
#PROJ.rdoc.opts << '--diagram'
|
35
|
+
PROJ.notes.tags << "X"+"XX" # muhah! so we don't note our-self
|
36
|
+
|
37
|
+
# exclude rcov.rb and external libs from rcov report
|
38
|
+
PROJ.rcov.opts += [
|
39
|
+
"--exclude", "rcov.rb",
|
40
|
+
"--exclude", "eventmachine",
|
41
|
+
"--exclude", "pcap_misc.rb",
|
42
|
+
"--exclude", "pcaplet.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
depend_on 'eventmachine', '>= 0.12.0'
|
46
|
+
|
47
|
+
# EOF
|
data/bin/feed
ADDED
data/bin/plugsrv
CHANGED
@@ -50,13 +50,13 @@ class BlitPlug
|
|
50
50
|
##----------------------------------------
|
51
51
|
|
52
52
|
def dispatch_rcv(snder, data)
|
53
|
-
data #
|
53
|
+
data # for now
|
54
54
|
end
|
55
55
|
|
56
56
|
##----------------------------------------
|
57
57
|
|
58
58
|
def dispatch_close(snder)
|
59
|
-
nil #
|
59
|
+
nil # for now
|
60
60
|
end
|
61
61
|
|
62
62
|
##----------------------------------------
|
@@ -183,7 +183,7 @@ end
|
|
183
183
|
#
|
184
184
|
# Get option arguments
|
185
185
|
opts = OptionParser.new do |opts|
|
186
|
-
opts.banner = "Usage: #{$0} [options] target:tport[@[laddr:]lport]\n",
|
186
|
+
opts.banner = "Usage: #{File.basename $0} [options] target:tport[@[laddr:]lport]\n",
|
187
187
|
" <target:tport> = the address of the target service\n",
|
188
188
|
" <@laddr:lport> = optional address and port to listen on\n"
|
189
189
|
|
data/cli_usage.rdoc
CHANGED
@@ -7,13 +7,11 @@ usage information. Examples to come.
|
|
7
7
|
|
8
8
|
Base64 encode data supplied via an argument, file, or standard input.
|
9
9
|
|
10
|
-
|
10
|
+
Usage: b64 [options] <data | blank for stdin>
|
11
11
|
-h, --help Show this message
|
12
12
|
-v, --version Show version and exit
|
13
13
|
-f, --file FILENAME Input from FILENAME
|
14
|
-
|
15
|
-
Output options:
|
16
|
-
-l, --length LEN Encode in lines of LEN characters
|
14
|
+
-l, --length LEN Output LEN chars per line
|
17
15
|
|
18
16
|
|
19
17
|
=== bgrep
|
@@ -70,7 +68,7 @@ Generates a crc32 checksum for data provided via stdin or file
|
|
70
68
|
|
71
69
|
Base64 decode an encoded chunk supplied via argument, file, or standard input.
|
72
70
|
|
73
|
-
|
71
|
+
Usage: d64 [options] <data | blank for stdin>
|
74
72
|
-h, --help Show this message
|
75
73
|
-v, --version Show version and exit
|
76
74
|
-f, --file FILENAME Input from FILENAME
|
@@ -87,6 +85,42 @@ by Unix utilities like 'xxd' as well as 'hexdump -C'.
|
|
87
85
|
-l, --length LEN Bytes per line in hexdump (default: 16)
|
88
86
|
|
89
87
|
|
88
|
+
=== feed
|
89
|
+
|
90
|
+
This is a plug-board message feeder from static data sources.
|
91
|
+
The "feed" handles messages opaquely and just plays them as a server or
|
92
|
+
client in the given sequence.
|
93
|
+
|
94
|
+
Feed can do the following things with minimum fuss:
|
95
|
+
* Import messages from files, yaml, or pcap
|
96
|
+
* Inject custom/modified messages with "blit"
|
97
|
+
* Run as a server or client using UDP or TCP
|
98
|
+
* Bootstrap protocols without a lot of work up front
|
99
|
+
* Skip uninteresting messages and focus attention on the fun ones.
|
100
|
+
* Replay conversations for relatively unfamiliar protocols.
|
101
|
+
* Observe client/server behaviors using different messages at
|
102
|
+
various phases of a conversation.
|
103
|
+
|
104
|
+
Usage: feed [options] host:port
|
105
|
+
-h, --help Show this message
|
106
|
+
-v, --version Show version and exit
|
107
|
+
-o, --output=FILE Output to file
|
108
|
+
-l, --listen=(ADDR:?)PORT Server - on port (and addr?)
|
109
|
+
-b, --blit=(ADDR:)?PORT Where to listen for blit
|
110
|
+
-i, --[no-]initiate Send the first message on connect
|
111
|
+
-e, --[no-]end End connection when feed is exhausted
|
112
|
+
-s, --[no-]step 'Continue' prompt between messages
|
113
|
+
-u, --udp Use UDP instead of TCP
|
114
|
+
-r, --reconnect Attempt to reconnect endlessly.
|
115
|
+
-q, --quiet Suppress verbose messages/dumps
|
116
|
+
-S, --squelch-exhausted Squelch 'FEED EXHAUSTED' messages
|
117
|
+
Sources: (can be combined)
|
118
|
+
-f, --from-files=GLOB Import messages from raw files
|
119
|
+
-x, --from-hex=FILE Import messages from hexdumps
|
120
|
+
-y, --from-yaml=FILE Import messages from yaml
|
121
|
+
-p, --from-pcap=FILE[:FILTER] Import messages from pcap
|
122
|
+
|
123
|
+
|
90
124
|
=== hexify
|
91
125
|
|
92
126
|
Converts a string or raw data to hex characters. Input can be supplied via
|
@@ -183,14 +217,15 @@ Telson is for doing the following things with minimum fuss:
|
|
183
217
|
Usage: telson [options] host:port
|
184
218
|
-h, --help Show this message
|
185
219
|
-v, --version Show version and exit
|
186
|
-
-
|
187
|
-
-b, --blit=ADDR:PORT Where to listen for blit
|
188
|
-
-o, --output=FILE Output to file instead of screen
|
220
|
+
-o, --output=FILE Output to file
|
189
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
|
190
226
|
-r, --reconnect Attempt to reconnect endlessly.
|
191
227
|
-s, --source=(ADDR:?)PORT Bind on port (and addr?)
|
192
228
|
|
193
|
-
|
194
229
|
=== unhexify
|
195
230
|
|
196
231
|
unhexify converts a string of hex bytes back to raw data. Input can be
|
data/doctor-bag.jpg
ADDED
Binary file
|
data/lib/rbkb.rb
CHANGED
@@ -1,6 +1,51 @@
|
|
1
|
+
|
1
2
|
module Rbkb
|
2
|
-
|
3
|
-
|
3
|
+
|
4
|
+
# :stopdoc:
|
5
|
+
VERSION = '0.6.6'
|
6
|
+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
7
|
+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
8
|
+
# :startdoc:
|
9
|
+
|
10
|
+
# Returns the version string for the library.
|
11
|
+
#
|
12
|
+
def self.version
|
13
|
+
VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns the library path for the module. If any arguments are given,
|
17
|
+
# they will be joined to the end of the libray path using
|
18
|
+
# <tt>File.join</tt>.
|
19
|
+
#
|
20
|
+
def self.libpath( *args )
|
21
|
+
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the lpath for the module. If any arguments are given,
|
25
|
+
# they will be joined to the end of the path using
|
26
|
+
# <tt>File.join</tt>.
|
27
|
+
#
|
28
|
+
def self.path( *args )
|
29
|
+
args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Utility method used to require all files ending in .rb that lie in the
|
33
|
+
# directory below this file that has the same name as the filename passed
|
34
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
35
|
+
# the _filename_ does not have to be equivalent to the directory.
|
36
|
+
#
|
37
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
38
|
+
dir ||= ::File.basename(fname, '.*')
|
39
|
+
search_me = ::File.expand_path(
|
40
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
41
|
+
|
42
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
43
|
+
end
|
44
|
+
|
45
|
+
end # module Rbkb
|
46
|
+
|
47
|
+
#Rbkb.require_all_libs_relative_to(__FILE__)
|
4
48
|
|
5
49
|
require 'rbkb/extends'
|
6
50
|
|
51
|
+
# EOF
|
data/lib/rbkb/cli.rb
CHANGED
@@ -5,6 +5,7 @@ require 'optparse'
|
|
5
5
|
# See README.rdoc for license information
|
6
6
|
#
|
7
7
|
module Rbkb::Cli
|
8
|
+
|
8
9
|
# Rbkb::Cli::Executable is an abstract class for creating command line
|
9
10
|
# executables using the Ruby Black Bag framework.
|
10
11
|
class Executable
|
@@ -36,8 +37,9 @@ module Rbkb::Cli
|
|
36
37
|
@stderr ||= param.delete(:stderr) || STDERR
|
37
38
|
@stdin ||= param.delete(:stdin) || STDIN
|
38
39
|
@opts ||= param.delete(:opts) || {}
|
39
|
-
|
40
|
+
@parser_got_range=nil
|
40
41
|
yield self if block_given?
|
42
|
+
make_parser()
|
41
43
|
end
|
42
44
|
|
43
45
|
|
@@ -45,7 +47,7 @@ module Rbkb::Cli
|
|
45
47
|
def exit(ret)
|
46
48
|
@exit_status = ret
|
47
49
|
if defined? Rbkb::Cli::TESTING
|
48
|
-
|
50
|
+
throw(((ret==0)? :exit_zero : :exit_err), ret)
|
49
51
|
else
|
50
52
|
Kernel.exit(ret)
|
51
53
|
end
|
@@ -81,7 +83,8 @@ module Rbkb::Cli
|
|
81
83
|
end
|
82
84
|
|
83
85
|
@oparse.on("-v", "--version", "Show version and exit") do
|
84
|
-
|
86
|
+
@stdout.puts("Ruby BlackBag version #{Rbkb::VERSION}")
|
87
|
+
self.exit(0)
|
85
88
|
end
|
86
89
|
|
87
90
|
return @oparse
|
@@ -104,9 +107,8 @@ module Rbkb::Cli
|
|
104
107
|
# executables. The base method just slurps in an optional argv and
|
105
108
|
# runs 'parse' if it hasn't already
|
106
109
|
def go(argv=nil)
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
+
@exit_status = nil
|
111
|
+
@argv = argv if argv
|
110
112
|
|
111
113
|
parse
|
112
114
|
|
data/lib/rbkb/cli/b64.rb
CHANGED
@@ -10,6 +10,8 @@ class Rbkb::Cli::B64 < Rbkb::Cli::Executable
|
|
10
10
|
arg = @oparse
|
11
11
|
arg.banner += " <data | blank for stdin>"
|
12
12
|
|
13
|
+
add_std_file_opt(:indat)
|
14
|
+
|
13
15
|
arg.on("-l", "--length LEN", Numeric, "Output LEN chars per line") do |l|
|
14
16
|
bail("length must be > 0") unless l > 0
|
15
17
|
@opts[:len] = l
|
@@ -19,12 +21,15 @@ class Rbkb::Cli::B64 < Rbkb::Cli::Executable
|
|
19
21
|
def parse(*args)
|
20
22
|
super(*args)
|
21
23
|
parse_string_argument(:indat)
|
24
|
+
parse_file_argument(:indat)
|
22
25
|
parse_catchall()
|
26
|
+
@opts[:indat] ||= @stdin.read
|
23
27
|
end
|
24
28
|
|
25
29
|
def go(*args)
|
26
30
|
super(*args)
|
27
31
|
@stdout << @opts[:indat].b64(opts[:len]).chomp + "\n"
|
32
|
+
self.exit(0)
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
data/lib/rbkb/cli/bgrep.rb
CHANGED
@@ -6,9 +6,11 @@ require 'rbkb/cli'
|
|
6
6
|
# searches for a binary string in input. string can be provided 'hexified'
|
7
7
|
class Rbkb::Cli::Bgrep < Rbkb::Cli::Executable
|
8
8
|
def initialize(*args)
|
9
|
-
super(*args)
|
10
|
-
|
11
|
-
|
9
|
+
super(*args) do |this|
|
10
|
+
this.opts[:start_off] ||= 0
|
11
|
+
this.opts[:end_off] ||= -1
|
12
|
+
this.opts[:include_fname] ||= true
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def make_parser
|
@@ -28,8 +30,9 @@ class Rbkb::Cli::Bgrep < Rbkb::Cli::Executable
|
|
28
30
|
@opts[:align] = a
|
29
31
|
end
|
30
32
|
|
31
|
-
arg.on("-n", "--[no-]filename",
|
32
|
-
|
33
|
+
arg.on("-n", "--[no-]filename",
|
34
|
+
"Toggle filenames. (Default: #{@opts[:include_fname]})") do |n|
|
35
|
+
@opts[:include_fname] = n
|
33
36
|
end
|
34
37
|
return arg
|
35
38
|
end
|
@@ -66,16 +69,18 @@ class Rbkb::Cli::Bgrep < Rbkb::Cli::Executable
|
|
66
69
|
|
67
70
|
loop do
|
68
71
|
dat.bgrep(@find, @opts[:align]) do |hit_start, hit_end, match|
|
69
|
-
|
72
|
+
@stdout.write "#{fname}:" if fname and @opts[:include_fname]
|
70
73
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
@stdout.write(
|
75
|
+
"#{(hit_start).to_hex.rjust(8,"0")}:"+
|
76
|
+
"#{(hit_end).to_hex.rjust(8,"0")}:b:"+
|
77
|
+
"#{match.inspect}\n")
|
74
78
|
end
|
75
79
|
|
76
80
|
break unless fname=@argv.shift
|
77
81
|
dat = do_file_read(fname)
|
78
82
|
end
|
83
|
+
self.exit(0)
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
data/lib/rbkb/cli/chars.rb
CHANGED
@@ -12,12 +12,13 @@ class Rbkb::Cli::Chars < Rbkb::Cli::Executable
|
|
12
12
|
|
13
13
|
def parse(*args)
|
14
14
|
super(*args)
|
15
|
-
bail_args @argv.join unless @argv.size == 2
|
15
|
+
bail_args @argv.join(' ') unless @argv.size == 2
|
16
16
|
end
|
17
17
|
|
18
18
|
def go(*args)
|
19
19
|
super(*args)
|
20
20
|
@stdout << @argv[1] * @argv[0].to_i
|
21
|
+
self.exit(0)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
data/lib/rbkb/cli/crc32.rb
CHANGED
@@ -12,13 +12,15 @@ class Rbkb::Cli::Crc32 < Rbkb::Cli::Executable
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def make_parser()
|
15
|
-
super()
|
15
|
+
arg = super()
|
16
|
+
arg.banner += " [filename]"
|
16
17
|
add_std_file_opt(:indat)
|
17
18
|
add_range_opts(:first, :last)
|
18
19
|
end
|
19
20
|
|
20
21
|
def parse(*args)
|
21
22
|
super(*args)
|
23
|
+
parse_file_argument(:indat)
|
22
24
|
parse_catchall()
|
23
25
|
end
|
24
26
|
|
@@ -26,6 +28,7 @@ class Rbkb::Cli::Crc32 < Rbkb::Cli::Executable
|
|
26
28
|
super(*args)
|
27
29
|
@opts[:indat] ||= @stdin.read()
|
28
30
|
@stdout.puts @opts[:indat][ @opts[:first] .. @opts[:last] ].crc32.to_hex
|
31
|
+
self.exit(0)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|