rbkb 0.7.2 → 0.7.3

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 (69) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +21 -13
  4. data/bin/b64 +2 -2
  5. data/bin/bgrep +2 -2
  6. data/bin/blit +2 -2
  7. data/bin/c +2 -2
  8. data/bin/crc32 +2 -2
  9. data/bin/d64 +2 -2
  10. data/bin/dedump +2 -2
  11. data/bin/feed +2 -2
  12. data/bin/hexify +2 -2
  13. data/bin/len +2 -2
  14. data/bin/plugsrv +66 -76
  15. data/bin/rex +1 -2
  16. data/bin/rstrings +2 -2
  17. data/bin/slice +2 -2
  18. data/bin/telson +2 -2
  19. data/bin/unhexify +2 -2
  20. data/bin/urldec +2 -2
  21. data/bin/urlenc +2 -2
  22. data/bin/xor +2 -2
  23. data/lib/rbkb/cli/b64.rb +6 -7
  24. data/lib/rbkb/cli/bgrep.rb +16 -17
  25. data/lib/rbkb/cli/blit.rb +29 -31
  26. data/lib/rbkb/cli/chars.rb +1 -2
  27. data/lib/rbkb/cli/crc32.rb +8 -10
  28. data/lib/rbkb/cli/d64.rb +3 -4
  29. data/lib/rbkb/cli/dedump.rb +15 -18
  30. data/lib/rbkb/cli/feed.rb +58 -64
  31. data/lib/rbkb/cli/hexify.rb +15 -16
  32. data/lib/rbkb/cli/len.rb +19 -27
  33. data/lib/rbkb/cli/rstrings.rb +41 -44
  34. data/lib/rbkb/cli/slice.rb +8 -15
  35. data/lib/rbkb/cli/telson.rb +33 -37
  36. data/lib/rbkb/cli/unhexify.rb +10 -11
  37. data/lib/rbkb/cli/urldec.rb +8 -9
  38. data/lib/rbkb/cli/urlenc.rb +8 -8
  39. data/lib/rbkb/cli/xor.rb +13 -14
  40. data/lib/rbkb/cli.rb +52 -65
  41. data/lib/rbkb/extends/array.rb +7 -8
  42. data/lib/rbkb/extends/common.rb +3 -5
  43. data/lib/rbkb/extends/enumerable.rb +9 -9
  44. data/lib/rbkb/extends/float.rb +1 -2
  45. data/lib/rbkb/extends/numeric.rb +29 -30
  46. data/lib/rbkb/extends/object.rb +1 -2
  47. data/lib/rbkb/extends/string.rb +172 -189
  48. data/lib/rbkb/extends/symbol.rb +2 -4
  49. data/lib/rbkb/extends.rb +0 -1
  50. data/lib/rbkb/plug/blit.rb +66 -69
  51. data/lib/rbkb/plug/cli.rb +22 -25
  52. data/lib/rbkb/plug/feed_import.rb +17 -21
  53. data/lib/rbkb/plug/peer.rb +11 -13
  54. data/lib/rbkb/plug/plug.rb +83 -91
  55. data/lib/rbkb/plug/proxy.rb +4 -8
  56. data/lib/rbkb/plug/unix_domain.rb +12 -14
  57. data/lib/rbkb/plug.rb +5 -6
  58. data/lib/rbkb/version.rb +1 -1
  59. data/lib/rbkb.rb +2 -3
  60. data/rbkb.gemspec +3 -3
  61. data/test/disabled_test_cli_blit.rb +1 -2
  62. data/test/disabled_test_cli_feed.rb +1 -2
  63. data/test/disabled_test_cli_telson.rb +1 -2
  64. data/test/test_cli_crc32.rb +1 -1
  65. data/test/test_cli_dedump.rb +83 -79
  66. data/test/test_cli_len.rb +25 -24
  67. data/test/test_cli_slice.rb +22 -22
  68. data/test/test_cli_xor.rb +4 -4
  69. metadata +18 -23
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
1
+ require File.join(File.dirname(__FILE__), 'test_cli_helper.rb')
2
2
  require 'rbkb/cli/dedump'
3
3
 
4
4
  class TestCliDedump < Test::Unit::TestCase
@@ -7,112 +7,116 @@ class TestCliDedump < Test::Unit::TestCase
7
7
  def setup
8
8
  @cli_class = Rbkb::Cli::Dedump
9
9
  super()
10
- @tst_string = "this is a \x00\n\n\ntest\x01\x02\xff\x00"
11
- @tst_dump = <<_EOF_
12
- 00000000 74 68 69 73 20 69 73 20 61 20 00 0a 0a 0a 74 65 |this is a ....te|
13
- 00000010 73 74 01 02 ff 00 |st....|
14
- 00000016
15
- _EOF_
16
-
17
- @bigtst_string = "\000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\e\034\035\036\037 !\"\#.$.%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" * 3
18
- @bigtst_dump = <<_EOF_
19
- 00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
20
- 00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
21
- 00000020 20 21 22 23 2e 24 2e 25 26 27 28 29 2a 2b 2c 2d | !"#.$.%&'()*+,-|
22
- 00000030 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d |./0123456789:;<=|
23
- 00000040 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d |>?@ABCDEFGHIJKLM|
24
- 00000050 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d |NOPQRSTUVWXYZ[\]|
25
- 00000060 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d |^_`abcdefghijklm|
26
- 00000070 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d |nopqrstuvwxyz{|}|
27
- 00000080 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d |~...............|
28
- 00000090 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d |................|
29
- 000000a0 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad |................|
30
- 000000b0 ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd |................|
31
- 000000c0 be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd |................|
32
- 000000d0 ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd |................|
33
- 000000e0 de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed |................|
34
- 000000f0 ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd |................|
35
- 00000100 fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d |................|
36
- 00000110 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d |................|
37
- 00000120 1e 1f 20 21 22 23 2e 24 2e 25 26 27 28 29 2a 2b |.. !"#.$.%&'()*+|
38
- 00000130 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b |,-./0123456789:;|
39
- 00000140 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b |<=>?@ABCDEFGHIJK|
40
- 00000150 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b |LMNOPQRSTUVWXYZ[|
41
- 00000160 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b |\]^_`abcdefghijk|
42
- 00000170 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b |lmnopqrstuvwxyz{|
43
- 00000180 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b ||}~.............|
44
- 00000190 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b |................|
45
- 000001a0 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab |................|
46
- 000001b0 ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb |................|
47
- 000001c0 bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb |................|
48
- 000001d0 cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db |................|
49
- 000001e0 dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb |................|
50
- 000001f0 ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb |................|
51
- 00000200 fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b |................|
52
- 00000210 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b |................|
53
- 00000220 1c 1d 1e 1f 20 21 22 23 2e 24 2e 25 26 27 28 29 |.... !"#.$.%&'()|
54
- 00000230 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 |*+,-./0123456789|
55
- 00000240 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 |:;<=>?@ABCDEFGHI|
56
- 00000250 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 |JKLMNOPQRSTUVWXY|
57
- 00000260 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 |Z[\]^_`abcdefghi|
58
- 00000270 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 |jklmnopqrstuvwxy|
59
- 00000280 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 |z{|}~...........|
60
- 00000290 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 |................|
61
- 000002a0 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 |................|
62
- 000002b0 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 |................|
63
- 000002c0 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 |................|
64
- 000002d0 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 |................|
65
- 000002e0 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 |................|
66
- 000002f0 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 |................|
67
- 00000300 fa fb fc fd fe ff |......|
68
- 00000306
69
- _EOF_
10
+ @tst_string = "this is a \x00\n\n\ntest\x01\x02\xff\x00".force_to_binary
11
+ @tst_dump = <<~_EOF_
12
+ 00000000 74 68 69 73 20 69 73 20 61 20 00 0a 0a 0a 74 65 |this is a ....te|
13
+ 00000010 73 74 01 02 ff 00 |st....|
14
+ 00000016
15
+ _EOF_
70
16
 
17
+ s = "\000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\e\034\035\036\037 !\"\#.$.%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" * 3
18
+ @bigtst_string = s.force_to_binary
19
+ @bigtst_dump = <<~_EOF_
20
+ 00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
21
+ 00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
22
+ 00000020 20 21 22 23 2e 24 2e 25 26 27 28 29 2a 2b 2c 2d | !"#.$.%&'()*+,-|
23
+ 00000030 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d |./0123456789:;<=|
24
+ 00000040 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d |>?@ABCDEFGHIJKLM|
25
+ 00000050 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d |NOPQRSTUVWXYZ[\]|
26
+ 00000060 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d |^_`abcdefghijklm|
27
+ 00000070 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d |nopqrstuvwxyz{|}|
28
+ 00000080 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d |~...............|
29
+ 00000090 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d |................|
30
+ 000000a0 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad |................|
31
+ 000000b0 ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd |................|
32
+ 000000c0 be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd |................|
33
+ 000000d0 ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd |................|
34
+ 000000e0 de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed |................|
35
+ 000000f0 ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd |................|
36
+ 00000100 fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d |................|
37
+ 00000110 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d |................|
38
+ 00000120 1e 1f 20 21 22 23 2e 24 2e 25 26 27 28 29 2a 2b |.. !"#.$.%&'()*+|
39
+ 00000130 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b |,-./0123456789:;|
40
+ 00000140 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b |<=>?@ABCDEFGHIJK|
41
+ 00000150 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b |LMNOPQRSTUVWXYZ[|
42
+ 00000160 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b |\]^_`abcdefghijk|
43
+ 00000170 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b |lmnopqrstuvwxyz{|
44
+ 00000180 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b ||}~.............|
45
+ 00000190 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b |................|
46
+ 000001a0 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab |................|
47
+ 000001b0 ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb |................|
48
+ 000001c0 bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb |................|
49
+ 000001d0 cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db |................|
50
+ 000001e0 dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb |................|
51
+ 000001f0 ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb |................|
52
+ 00000200 fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b |................|
53
+ 00000210 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b |................|
54
+ 00000220 1c 1d 1e 1f 20 21 22 23 2e 24 2e 25 26 27 28 29 |.... !"#.$.%&'()|
55
+ 00000230 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 |*+,-./0123456789|
56
+ 00000240 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 |:;<=>?@ABCDEFGHI|
57
+ 00000250 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 |JKLMNOPQRSTUVWXY|
58
+ 00000260 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 |Z[\]^_`abcdefghi|
59
+ 00000270 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 |jklmnopqrstuvwxy|
60
+ 00000280 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 |z{|}~...........|
61
+ 00000290 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 |................|
62
+ 000002a0 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 |................|
63
+ 000002b0 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 |................|
64
+ 000002c0 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 |................|
65
+ 000002d0 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 |................|
66
+ 000002e0 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 |................|
67
+ 000002f0 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 |................|
68
+ 00000300 fa fb fc fd fe ff |......|
69
+ 00000306
70
+ _EOF_
71
71
  end # setup
72
72
 
73
73
  def test_file_input_arg
74
- with_testfile do |fname, tf|
75
- tf.write @tst_dump; tf.close
74
+ with_testfile do |fname, tf|
75
+ tf.write @tst_dump
76
+ tf.close
76
77
  assert_equal 0, go_with_args([fname])
77
78
  assert_equal(@tst_string, @stdout_io.string)
78
79
  end
79
80
  end
80
81
 
81
82
  def test_stdin
82
- @stdin_io.write(@tst_dump) ; @stdin_io.rewind
83
+ @stdin_io.write(@tst_dump)
84
+ @stdin_io.rewind
83
85
  assert_equal 0, go_with_args
84
86
  assert_equal(@tst_string, @stdout_io.string)
85
87
  end
86
88
 
87
-
88
89
  def test_stdin_big
89
- @stdin_io.write(@bigtst_dump) ; @stdin_io.rewind
90
+ @stdin_io.write(@bigtst_dump)
91
+ @stdin_io.rewind
90
92
  assert_equal 0, go_with_args
91
93
  assert_equal(@bigtst_string, @stdout_io.string)
92
94
  end
93
95
 
94
96
  def test_bad_len
95
- len_dump = <<_EOF_
96
- 00000000 68 65 6c 75 |helu|
97
- 00000004 20 66 6f 6f | foo|
98
- 00000008
99
- _EOF_
97
+ len_dump = <<~_EOF_
98
+ 00000000 68 65 6c 75 |helu|
99
+ 00000004 20 66 6f 6f | foo|
100
+ 00000008
101
+ _EOF_
100
102
 
101
- @stdin_io.write(len_dump) ; @stdin_io.rewind
102
- assert_equal 1, go_with_args(["-l", "2"])
103
- assert_equal("helu foo", @stdout_io.string)
103
+ @stdin_io.write(len_dump)
104
+ @stdin_io.rewind
105
+ assert_equal 1, go_with_args(['-l', '2'])
106
+ assert_equal('he', @stdout_io.string)
104
107
  end
105
108
 
106
- def test_bad_len
107
- @stdin_io.write(@bigtst_dump) ; @stdin_io.rewind
108
- assert_equal 1, go_with_args(["-l", "-4"])
109
+ def test_bad_len_shortlen
110
+ @stdin_io.write(@bigtst_dump)
111
+ @stdin_io.rewind
112
+ assert_equal 1, go_with_args(['-l', '-4'])
109
113
  assert_match(/length must be greater than zero/i, @stderr_io.string)
110
114
  end
111
115
 
112
116
  def test_bad_input
113
- @stdin_io.write("bad monkey") ; @stdin_io.rewind
117
+ @stdin_io.write('bad monkey')
118
+ @stdin_io.rewind
114
119
  assert_equal 1, go_with_args([])
115
120
  assert_match(/parse error/i, @stderr_io.string)
116
121
  end
117
-
118
122
  end
data/test/test_cli_len.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
1
+ require File.join(File.dirname(__FILE__), 'test_cli_helper.rb')
2
2
  require 'rbkb/cli/len'
3
3
 
4
4
  class TestCliLen < Test::Unit::TestCase
@@ -8,8 +8,8 @@ class TestCliLen < Test::Unit::TestCase
8
8
  @cli_class = Rbkb::Cli::Len
9
9
  super()
10
10
 
11
- @tst_in = "helu world"
12
- @bigtst_in = "A"*65536
11
+ @tst_in = 'helu world'.force_to_binary
12
+ @bigtst_in = ('A' * 65_536).force_to_binary
13
13
  end
14
14
 
15
15
  def test_string_arg
@@ -23,74 +23,75 @@ class TestCliLen < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  def test_stdin
26
- @stdin_io.write(@tst_in) ; @stdin_io.rewind
27
- assert_equal 0, go_with_args()
26
+ @stdin_io.write(@tst_in)
27
+ @stdin_io.rewind
28
+ assert_equal 0, go_with_args
28
29
  assert_equal("\x00\x00\x00\x0a" + @tst_in, @stdout_io.string)
29
30
  end
30
31
 
31
32
  def test_file_input_flag
32
- with_testfile do |fname, tf|
33
- tf.write @tst_in; tf.close
34
- assert_equal 0, go_with_args(["-f", fname])
33
+ with_testfile do |fname, tf|
34
+ tf.write @tst_in
35
+ tf.close
36
+ assert_equal 0, go_with_args(['-f', fname])
35
37
  assert_equal("\x00\x00\x00\x0a" + @tst_in, @stdout_io.string)
36
38
  end
37
39
  end
38
40
 
39
41
  def test_string_arg_swap
40
- assert_equal 0, go_with_args(["-x", @tst_in])
42
+ assert_equal 0, go_with_args(['-x', @tst_in])
41
43
  assert_equal("\x0a\x00\x00\x00" + @tst_in, @stdout_io.string)
42
44
  end
43
45
 
44
-
45
46
  def test_big_string_arg_swap
46
- assert_equal 0, go_with_args(["-x", @bigtst_in])
47
+ assert_equal 0, go_with_args(['-x', @bigtst_in])
47
48
  assert_equal("\x00\x00\x01\x00" + @bigtst_in, @stdout_io.string)
48
49
  end
49
50
 
50
51
  def test_big_string_arg_total
51
- assert_equal 0, go_with_args(["-t", @bigtst_in])
52
+ assert_equal 0, go_with_args(['-t', @bigtst_in])
52
53
  assert_equal("\x00\x01\x00\x04" + @bigtst_in, @stdout_io.string)
53
54
  end
54
55
 
55
56
  def test_big_string_arg_static_len
56
- assert_equal 0, go_with_args(["-l3", @bigtst_in])
57
+ assert_equal 0, go_with_args(['-l3', @bigtst_in])
57
58
  assert_equal("\x00\x00\x00\x03" + @bigtst_in, @stdout_io.string)
58
59
  end
59
60
 
60
61
  def test_big_string_arg_static_len_negative
61
- assert_equal 0, go_with_args(["-l", "-3", @bigtst_in])
62
- assert_equal("\xff\xff\xff\xfd" + @bigtst_in, @stdout_io.string)
62
+ assert_equal 0, go_with_args(['-l', '-3', @bigtst_in])
63
+ tstdata = ("\xff\xff\xff\xfd" + @bigtst_in).force_to_binary
64
+ assert_equal(tstdata, @stdout_io.string)
63
65
  end
64
66
 
65
67
  def test_big_string_arg_static_len_negative_short
66
- assert_equal 0, go_with_args(["-l", "-3", "-s2", @bigtst_in])
67
- assert_equal("\xff\xfd" + @bigtst_in, @stdout_io.string)
68
+ assert_equal 0, go_with_args(['-l', '-3', '-s2', @bigtst_in])
69
+ tstdata = ("\xff\xfd" + @bigtst_in).force_to_binary
70
+ assert_equal(tstdata, @stdout_io.string)
68
71
  end
69
72
 
70
73
  def test_big_string_arg_nudge
71
- assert_equal 0, go_with_args(["-n5", @bigtst_in])
74
+ assert_equal 0, go_with_args(['-n5', @bigtst_in])
72
75
  assert_equal("\x00\x01\x00\x05" + @bigtst_in, @stdout_io.string)
73
76
  end
74
77
 
75
78
  def test_big_string_arg_byte
76
- assert_equal 0, go_with_args(["-s1", @tst_in])
79
+ assert_equal 0, go_with_args(['-s1', @tst_in])
77
80
  assert_equal("\x0a" + @tst_in, @stdout_io.string)
78
81
  end
79
82
 
80
83
  def test_big_string_arg_byte_wrap
81
- assert_equal 0, go_with_args(["-s1", @bigtst_in])
84
+ assert_equal 0, go_with_args(['-s1', @bigtst_in])
82
85
  assert_equal("\x00" + @bigtst_in, @stdout_io.string)
83
86
  end
84
87
 
85
-
86
88
  def test_big_string_arg_short
87
- assert_equal 0, go_with_args(["-s2", @tst_in])
89
+ assert_equal 0, go_with_args(['-s2', @tst_in])
88
90
  assert_equal("\x00\x0a" + @tst_in, @stdout_io.string)
89
91
  end
90
92
 
91
93
  def test_big_string_arg_short_wrap
92
- assert_equal 0, go_with_args(["-s2", @bigtst_in])
94
+ assert_equal 0, go_with_args(['-s2', @bigtst_in])
93
95
  assert_equal("\x00\x00" + @bigtst_in, @stdout_io.string)
94
96
  end
95
-
96
97
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
1
+ require File.join(File.dirname(__FILE__), 'test_cli_helper.rb')
2
2
  require 'rbkb/cli/slice'
3
3
 
4
4
  class TestCliSlice < Test::Unit::TestCase
@@ -7,67 +7,67 @@ class TestCliSlice < Test::Unit::TestCase
7
7
  def setup
8
8
  @cli_class = Rbkb::Cli::Slice
9
9
  super()
10
- @rawdat = (0..255).map {|x| x.chr}.join
11
- @stdin_io.write(@rawdat) ; @stdin_io.rewind
10
+ @rawdat = (0..255).map { |x| x.chr }.join
11
+ @stdin_io.write(@rawdat)
12
+ @stdin_io.rewind
12
13
  end
13
14
 
14
- def test_stdin
15
- assert_equal 0, go_with_args(%w{0})
15
+ def test_stdin
16
+ assert_equal 0, go_with_args(%w[0])
16
17
  assert_equal @rawdat, @stdout_io.string
17
18
  end
18
19
 
19
20
  def test_start_from_end_negative_size
20
- assert_equal 0, go_with_args(%w(-- -10))
21
+ assert_equal 0, go_with_args(%w[-- -10])
21
22
  assert_equal(@rawdat[-10..-1], @stdout_io.string)
22
23
  end
23
24
 
24
25
  def test_file_input_opt
25
- with_testfile do |fname, tf|
26
- tf.write @rawdat; tf.close
27
- assert_equal 0, go_with_args(["-f", fname, "0"])
26
+ with_testfile do |fname, tf|
27
+ tf.write @rawdat
28
+ tf.close
29
+ assert_equal 0, go_with_args(['-f', fname, '0'])
28
30
  assert_equal(@rawdat, @stdout_io.string)
29
31
  end
30
32
  end
31
33
 
32
34
  def test_bad_start
33
- assert_equal 1, go_with_args(%w{foo})
35
+ assert_equal 1, go_with_args(%w[foo])
34
36
  assert_match(/invalid start length/i, @stderr_io.string)
35
37
  end
36
38
 
37
39
  def test_start_from_end_zero
38
- assert_equal 0, go_with_args(%w(-r 256))
39
- assert_equal("", @stdout_io.string)
40
+ assert_equal 0, go_with_args(%w[-r 256])
41
+ assert_equal('', @stdout_io.string)
40
42
  end
41
43
 
42
44
  def test_start_from_end_one
43
- assert_equal 0, go_with_args(%w(-r 255))
44
- assert_equal("\xff", @stdout_io.string)
45
+ assert_equal 0, go_with_args(%w[-r 255])
46
+ assert_equal("\xff".force_to_binary, @stdout_io.string)
45
47
  end
46
48
 
47
49
  def test_start_from_overflow
48
- assert_equal 0, go_with_args(%w(-r 2000))
49
- assert_equal("", @stdout_io.string)
50
+ assert_equal 0, go_with_args(%w[-r 2000])
51
+ assert_equal('', @stdout_io.string)
50
52
  end
51
53
 
52
54
  def test_range_start_end
53
- assert_equal 0, go_with_args(%w(-r 10:20))
55
+ assert_equal 0, go_with_args(%w[-r 10:20])
54
56
  assert_equal(@rawdat[10..20], @stdout_io.string)
55
57
  end
56
58
 
57
59
  def test_range_start_and_end
58
- assert_equal 0, go_with_args(%w(-r 10:20))
60
+ assert_equal 0, go_with_args(%w[-r 10:20])
59
61
  assert_equal(@rawdat[10..20], @stdout_io.string)
60
62
  end
61
63
 
62
64
  def test_range_start_and_end_with_negative_end
63
- assert_equal 0, go_with_args(%w(-r 0:-20))
65
+ assert_equal 0, go_with_args(%w[-r 0:-20])
64
66
  assert_equal(@rawdat[0..-20], @stdout_io.string)
65
67
  end
66
68
 
67
-
68
69
  def test_range_start_and_end_hex
69
- assert_equal 0, go_with_args(%w(-x 0a:14))
70
+ assert_equal 0, go_with_args(%w[-x 0a:14])
70
71
  assert_equal(@rawdat[10..20], @stdout_io.string)
71
72
  end
72
-
73
73
  end
data/test/test_cli_xor.rb CHANGED
@@ -14,12 +14,12 @@ class TestCliXor < Test::Unit::TestCase
14
14
  @tst_xored = "\036\027E\022\016\032\001\v\021\022K\030\001\vE\027\016\v\nN\026\004\b\v\026\032"
15
15
  end
16
16
 
17
- def test_string_arg_str_key
17
+ def test_string_arg_str_key_s_flag
18
18
  assert_equal 0, go_with_args(["-s", @tst_key_str, @tst_dat])
19
19
  assert_equal @tst_xored, @stdout_io.string
20
20
  end
21
21
 
22
- def test_string_arg_str_key
22
+ def test_string_arg_str_key_x_flag
23
23
  assert_equal 0, go_with_args(["-x", @tst_key_hex, @tst_dat])
24
24
  assert_equal @tst_xored, @stdout_io.string
25
25
  end
@@ -34,12 +34,12 @@ class TestCliXor < Test::Unit::TestCase
34
34
  assert_equal "\x00"*10, @stdout_io.string
35
35
  end
36
36
 
37
- def test_string_arg_str_key_reverse
37
+ def test_string_arg_str_key_reverse_s_flag
38
38
  assert_equal 0, go_with_args(["-s", @tst_key_str, @tst_xored])
39
39
  assert_equal @tst_dat, @stdout_io.string
40
40
  end
41
41
 
42
- def test_string_arg_str_key_reverse
42
+ def test_string_arg_str_key_reverse_x_flag
43
43
  assert_equal 0, go_with_args(["-x", @tst_key_hex, @tst_xored])
44
44
  assert_equal @tst_dat, @stdout_io.string
45
45
  end
metadata CHANGED
@@ -1,55 +1,54 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbkb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Monti
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2014-07-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ~>
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.3'
18
+ version: '0'
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ~>
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '1.3'
25
+ version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - ~>
30
+ - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '0'
32
+ version: '13'
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - ~>
37
+ - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: '13'
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: rspec
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - ~>
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
47
  type: :development
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - ~>
51
+ - - ">="
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
54
  description: Rbkb is a collection of ruby-based pen-testing and reversing tools. Inspired
@@ -79,9 +78,9 @@ executables:
79
78
  extensions: []
80
79
  extra_rdoc_files: []
81
80
  files:
82
- - .bnsignore
83
- - .gitignore
84
- - .rspec
81
+ - ".bnsignore"
82
+ - ".gitignore"
83
+ - ".rspec"
85
84
  - Gemfile
86
85
  - Gemfile.lock
87
86
  - History.txt
@@ -196,24 +195,21 @@ homepage: http://emonti.github.com/rbkb
196
195
  licenses:
197
196
  - MIT
198
197
  metadata: {}
199
- post_install_message:
200
198
  rdoc_options: []
201
199
  require_paths:
202
200
  - lib
203
201
  required_ruby_version: !ruby/object:Gem::Requirement
204
202
  requirements:
205
- - - '>='
203
+ - - ">="
206
204
  - !ruby/object:Gem::Version
207
205
  version: '0'
208
206
  required_rubygems_version: !ruby/object:Gem::Requirement
209
207
  requirements:
210
- - - '>='
208
+ - - ">="
211
209
  - !ruby/object:Gem::Version
212
210
  version: '0'
213
211
  requirements: []
214
- rubyforge_project:
215
- rubygems_version: 2.2.2
216
- signing_key:
212
+ rubygems_version: 3.6.9
217
213
  specification_version: 4
218
214
  summary: Rbkb is a collection of ruby-based pen-testing and reversing tools
219
215
  test_files:
@@ -239,4 +235,3 @@ test_files:
239
235
  - test/test_cli_urlenc.rb
240
236
  - test/test_cli_xor.rb
241
237
  - test/test_helper.rb
242
- has_rdoc: