ronin-support 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +11 -0
  3. data/.github/workflows/ruby.yml +28 -0
  4. data/.ruby-version +1 -0
  5. data/.yardopts +1 -1
  6. data/ChangeLog.md +28 -0
  7. data/Gemfile +6 -7
  8. data/README.md +53 -32
  9. data/Rakefile +1 -2
  10. data/gemspec.yml +16 -7
  11. data/lib/ronin/binary.rb +5 -5
  12. data/lib/ronin/binary/hexdump.rb +5 -5
  13. data/lib/ronin/binary/hexdump/parser.rb +5 -5
  14. data/lib/ronin/binary/struct.rb +5 -5
  15. data/lib/ronin/binary/template.rb +7 -7
  16. data/lib/ronin/extensions.rb +5 -5
  17. data/lib/ronin/extensions/enumerable.rb +5 -5
  18. data/lib/ronin/extensions/file.rb +37 -31
  19. data/lib/ronin/extensions/ip_addr.rb +6 -7
  20. data/lib/ronin/extensions/kernel.rb +5 -5
  21. data/lib/ronin/extensions/meta.rb +5 -5
  22. data/lib/ronin/extensions/regexp.rb +5 -5
  23. data/lib/ronin/extensions/resolv.rb +5 -5
  24. data/lib/ronin/extensions/string.rb +5 -5
  25. data/lib/ronin/formatting.rb +5 -5
  26. data/lib/ronin/formatting/binary.rb +5 -5
  27. data/lib/ronin/formatting/digest.rb +5 -5
  28. data/lib/ronin/formatting/extensions.rb +5 -5
  29. data/lib/ronin/formatting/extensions/binary.rb +5 -5
  30. data/lib/ronin/formatting/extensions/binary/array.rb +6 -6
  31. data/lib/ronin/formatting/extensions/binary/base64.rb +5 -5
  32. data/lib/ronin/formatting/extensions/binary/file.rb +5 -5
  33. data/lib/ronin/formatting/extensions/binary/float.rb +6 -6
  34. data/lib/ronin/formatting/extensions/binary/integer.rb +6 -6
  35. data/lib/ronin/formatting/extensions/binary/string.rb +6 -6
  36. data/lib/ronin/formatting/extensions/digest.rb +5 -5
  37. data/lib/ronin/formatting/extensions/digest/file.rb +5 -5
  38. data/lib/ronin/formatting/extensions/digest/string.rb +5 -5
  39. data/lib/ronin/formatting/extensions/html.rb +5 -5
  40. data/lib/ronin/formatting/extensions/html/integer.rb +5 -5
  41. data/lib/ronin/formatting/extensions/html/string.rb +7 -7
  42. data/lib/ronin/formatting/extensions/http.rb +5 -5
  43. data/lib/ronin/formatting/extensions/http/integer.rb +6 -6
  44. data/lib/ronin/formatting/extensions/http/string.rb +7 -7
  45. data/lib/ronin/formatting/extensions/sql.rb +5 -5
  46. data/lib/ronin/formatting/extensions/sql/string.rb +15 -13
  47. data/lib/ronin/formatting/extensions/text.rb +5 -5
  48. data/lib/ronin/formatting/extensions/text/array.rb +5 -5
  49. data/lib/ronin/formatting/extensions/text/string.rb +5 -5
  50. data/lib/ronin/formatting/html.rb +5 -5
  51. data/lib/ronin/formatting/http.rb +5 -5
  52. data/lib/ronin/formatting/sql.rb +5 -5
  53. data/lib/ronin/formatting/text.rb +5 -5
  54. data/lib/ronin/fuzzing.rb +5 -5
  55. data/lib/ronin/fuzzing/extensions.rb +5 -5
  56. data/lib/ronin/fuzzing/extensions/string.rb +5 -5
  57. data/lib/ronin/fuzzing/fuzzer.rb +5 -5
  58. data/lib/ronin/fuzzing/fuzzing.rb +7 -7
  59. data/lib/ronin/fuzzing/mutator.rb +5 -5
  60. data/lib/ronin/fuzzing/repeater.rb +5 -5
  61. data/lib/ronin/fuzzing/template.rb +5 -5
  62. data/lib/ronin/mixin.rb +2 -2
  63. data/lib/ronin/network.rb +5 -5
  64. data/lib/ronin/network/dns.rb +5 -5
  65. data/lib/ronin/network/esmtp.rb +5 -5
  66. data/lib/ronin/network/extensions.rb +5 -5
  67. data/lib/ronin/network/extensions/dns.rb +5 -5
  68. data/lib/ronin/network/extensions/dns/net.rb +5 -5
  69. data/lib/ronin/network/extensions/esmtp.rb +5 -5
  70. data/lib/ronin/network/extensions/esmtp/net.rb +5 -5
  71. data/lib/ronin/network/extensions/http.rb +5 -5
  72. data/lib/ronin/network/extensions/http/net.rb +5 -5
  73. data/lib/ronin/network/extensions/http/uri/http.rb +5 -5
  74. data/lib/ronin/network/extensions/imap.rb +5 -5
  75. data/lib/ronin/network/extensions/imap/net.rb +5 -5
  76. data/lib/ronin/network/extensions/pop3.rb +5 -5
  77. data/lib/ronin/network/extensions/pop3/net.rb +5 -5
  78. data/lib/ronin/network/extensions/smtp.rb +5 -5
  79. data/lib/ronin/network/extensions/smtp/net.rb +5 -5
  80. data/lib/ronin/network/extensions/ssl.rb +5 -5
  81. data/lib/ronin/network/extensions/ssl/net.rb +5 -5
  82. data/lib/ronin/network/extensions/tcp.rb +5 -5
  83. data/lib/ronin/network/extensions/tcp/net.rb +5 -5
  84. data/lib/ronin/network/extensions/telnet.rb +5 -5
  85. data/lib/ronin/network/extensions/telnet/net.rb +5 -5
  86. data/lib/ronin/network/extensions/udp.rb +5 -5
  87. data/lib/ronin/network/extensions/udp/net.rb +5 -5
  88. data/lib/ronin/network/ftp.rb +5 -5
  89. data/lib/ronin/network/http.rb +5 -5
  90. data/lib/ronin/network/http/exceptions.rb +5 -5
  91. data/lib/ronin/network/http/exceptions/unknown_request.rb +5 -5
  92. data/lib/ronin/network/http/http.rb +52 -57
  93. data/lib/ronin/network/http/proxy.rb +5 -5
  94. data/lib/ronin/network/imap.rb +5 -5
  95. data/lib/ronin/network/mixins.rb +5 -5
  96. data/lib/ronin/network/mixins/dns.rb +5 -5
  97. data/lib/ronin/network/mixins/esmtp.rb +5 -5
  98. data/lib/ronin/network/mixins/ftp.rb +5 -5
  99. data/lib/ronin/network/mixins/http.rb +7 -7
  100. data/lib/ronin/network/mixins/imap.rb +5 -5
  101. data/lib/ronin/network/mixins/mixin.rb +5 -5
  102. data/lib/ronin/network/mixins/pop3.rb +5 -5
  103. data/lib/ronin/network/mixins/smtp.rb +5 -5
  104. data/lib/ronin/network/mixins/ssl.rb +5 -5
  105. data/lib/ronin/network/mixins/tcp.rb +5 -5
  106. data/lib/ronin/network/mixins/telnet.rb +5 -5
  107. data/lib/ronin/network/mixins/udp.rb +5 -5
  108. data/lib/ronin/network/mixins/unix.rb +5 -5
  109. data/lib/ronin/network/network.rb +5 -5
  110. data/lib/ronin/network/pop3.rb +5 -5
  111. data/lib/ronin/network/proxy.rb +5 -5
  112. data/lib/ronin/network/smtp.rb +5 -5
  113. data/lib/ronin/network/smtp/email.rb +6 -6
  114. data/lib/ronin/network/smtp/smtp.rb +5 -5
  115. data/lib/ronin/network/ssl.rb +7 -7
  116. data/lib/ronin/network/tcp.rb +5 -5
  117. data/lib/ronin/network/tcp/proxy.rb +5 -5
  118. data/lib/ronin/network/tcp/tcp.rb +32 -23
  119. data/lib/ronin/network/telnet.rb +7 -5
  120. data/lib/ronin/network/udp.rb +5 -5
  121. data/lib/ronin/network/udp/proxy.rb +5 -5
  122. data/lib/ronin/network/udp/udp.rb +28 -26
  123. data/lib/ronin/network/unix.rb +7 -7
  124. data/lib/ronin/path.rb +32 -36
  125. data/lib/ronin/spec/ui/output.rb +5 -5
  126. data/lib/ronin/support.rb +5 -5
  127. data/lib/ronin/support/inflector.rb +5 -5
  128. data/lib/ronin/support/support.rb +5 -5
  129. data/lib/ronin/support/version.rb +6 -6
  130. data/lib/ronin/templates.rb +5 -5
  131. data/lib/ronin/templates/erb.rb +5 -5
  132. data/lib/ronin/templates/template.rb +5 -5
  133. data/lib/ronin/ui/output.rb +5 -5
  134. data/lib/ronin/ui/output/helpers.rb +5 -5
  135. data/lib/ronin/ui/output/output.rb +17 -21
  136. data/lib/ronin/ui/output/terminal.rb +5 -5
  137. data/lib/ronin/ui/output/terminal/color.rb +5 -5
  138. data/lib/ronin/ui/output/terminal/raw.rb +5 -5
  139. data/lib/ronin/ui/shell.rb +5 -5
  140. data/lib/ronin/wordlist.rb +7 -7
  141. data/ronin-support.gemspec +1 -0
  142. data/spec/binary/hexdump/parser_spec.rb +22 -22
  143. data/spec/binary/struct_spec.rb +56 -56
  144. data/spec/binary/template_spec.rb +106 -104
  145. data/spec/extensions/enumerable_spec.rb +4 -4
  146. data/spec/extensions/file_spec.rb +12 -14
  147. data/spec/extensions/ip_addr_spec.rb +30 -30
  148. data/spec/extensions/kernel_spec.rb +7 -7
  149. data/spec/extensions/regexp_spec.rb +69 -69
  150. data/spec/extensions/resolv_spec.rb +2 -2
  151. data/spec/extensions/string_spec.rb +30 -29
  152. data/spec/formatting/binary/array_spec.rb +2 -2
  153. data/spec/formatting/binary/base64_spec.rb +8 -8
  154. data/spec/formatting/binary/float_spec.rb +6 -4
  155. data/spec/formatting/binary/integer_spec.rb +25 -25
  156. data/spec/formatting/binary/string_spec.rb +32 -30
  157. data/spec/formatting/digest/string_spec.rb +5 -5
  158. data/spec/formatting/html/integer_spec.rb +6 -6
  159. data/spec/formatting/html/string_spec.rb +10 -10
  160. data/spec/formatting/http/integer_spec.rb +3 -3
  161. data/spec/formatting/http/string_spec.rb +5 -5
  162. data/spec/formatting/sql/string_spec.rb +21 -19
  163. data/spec/formatting/text/array_spec.rb +15 -15
  164. data/spec/formatting/text/string_spec.rb +33 -33
  165. data/spec/fuzzing/extensions/string_spec.rb +11 -11
  166. data/spec/fuzzing/fuzzer_spec.rb +15 -15
  167. data/spec/fuzzing/fuzzing_spec.rb +5 -5
  168. data/spec/fuzzing/mutator_spec.rb +15 -15
  169. data/spec/fuzzing/repeater_spec.rb +7 -7
  170. data/spec/fuzzing/template_spec.rb +11 -11
  171. data/spec/mixin_spec.rb +10 -12
  172. data/spec/network/dns_spec.rb +34 -32
  173. data/spec/network/ftp_spec.rb +9 -9
  174. data/spec/network/http/http_spec.rb +237 -144
  175. data/spec/network/http/proxy_spec.rb +37 -37
  176. data/spec/network/network_spec.rb +1 -1
  177. data/spec/network/proxy_spec.rb +19 -19
  178. data/spec/network/smtp/email_spec.rb +14 -14
  179. data/spec/network/ssl_spec.rb +9 -9
  180. data/spec/network/tcp/proxy_spec.rb +9 -7
  181. data/spec/network/tcp/tcp_spec.rb +161 -118
  182. data/spec/network/telnet_spec.rb +5 -5
  183. data/spec/network/udp/udp_spec.rb +123 -96
  184. data/spec/network/unix_spec.rb +24 -25
  185. data/spec/path_spec.rb +43 -18
  186. data/spec/spec_helper.rb +0 -1
  187. data/spec/support/inflector_spec.rb +4 -4
  188. data/spec/support_spec.rb +1 -1
  189. data/spec/templates/erb_spec.rb +3 -3
  190. data/spec/templates/template_spec.rb +10 -10
  191. data/spec/ui/shell_spec.rb +15 -15
  192. data/spec/wordlist_spec.rb +19 -19
  193. metadata +408 -366
  194. data/.gemtest +0 -0
@@ -4,21 +4,21 @@ require 'ronin/extensions/enumerable'
4
4
  describe Enumerable do
5
5
  describe "#map_hash" do
6
6
  it "should map elements to a Hash" do
7
- [1, 2, 3].map_hash { |i| i ** 2 }.should == {
7
+ expect([1, 2, 3].map_hash { |i| i ** 2 }).to eq({
8
8
  1 => 1,
9
9
  2 => 4,
10
10
  3 => 9
11
- }
11
+ })
12
12
  end
13
13
 
14
14
  it "should not map the same element twice" do
15
- [1, 2, 2].map_hash { |i| rand }.keys.should =~ [1, 2]
15
+ expect([1, 2, 2].map_hash { |i| rand }.keys).to match_array([1, 2])
16
16
  end
17
17
 
18
18
  it "should set the default_proc of the Hash" do
19
19
  hash = [].map_hash { |i| i ** 2 }
20
20
 
21
- hash[3].should == 9
21
+ expect(hash[3]).to eq(9)
22
22
  end
23
23
  end
24
24
  end
@@ -7,20 +7,19 @@ describe File do
7
7
  subject { File }
8
8
 
9
9
  it "should provide File.escape_path" do
10
- subject.should respond_to(:escape_path)
10
+ expect(subject).to respond_to(:escape_path)
11
11
  end
12
12
 
13
13
  describe "each_line" do
14
14
  let(:lines) { %w[one two three] }
15
+ let(:path) { Tempfile.new('ronin-support-File#each_line') }
15
16
 
16
- before(:all) do
17
- @file = Tempfile.new('ronin-support')
18
- @file.puts(*lines)
19
- @file.close
17
+ before do
18
+ File.open(path,'w') { |file| file.puts(*lines) }
20
19
  end
21
20
 
22
21
  it "should enumerate over each line in the file" do
23
- File.each_line(@file.path).to_a.should == lines
22
+ expect(File.each_line(path).to_a).to eq(lines)
24
23
  end
25
24
  end
26
25
 
@@ -35,29 +34,28 @@ describe File do
35
34
  let(:separator) { '|' }
36
35
  let(:newline) { "\r\n" }
37
36
  let(:lines) { rows.map { |row| row.join(separator) }.join(newline) }
37
+ let(:path) { Tempfile.new('ronin-support-File#each_row') }
38
38
 
39
- before(:all) do
40
- @file = Tempfile.new('ronin-support')
41
- @file.write(lines)
42
- @file.close
39
+ before do
40
+ File.open(path,'w') { |file| file.puts(*lines) }
43
41
  end
44
42
 
45
43
  it "should enumerate over each row from each line" do
46
- File.each_row(@file.path,separator).to_a.should == rows
44
+ expect(File.each_row(path,separator).to_a).to eq(rows)
47
45
  end
48
46
  end
49
47
 
50
48
  describe "escape_path" do
51
49
  it "should remove null-bytes" do
52
- File.escape_path("hello\0world\0").should == "helloworld"
50
+ expect(File.escape_path("hello\0world\0")).to eq("helloworld")
53
51
  end
54
52
 
55
53
  it "should escape home-dir expansions" do
56
- File.escape_path("hello/~world").should == "hello/\\~world"
54
+ expect(File.escape_path("hello/~world")).to eq("hello/\\~world")
57
55
  end
58
56
 
59
57
  it "should remove '.' and '..' directories" do
60
- File.escape_path("hello/./../world").should == "world"
58
+ expect(File.escape_path("hello/./../world")).to eq("world")
61
59
  end
62
60
  end
63
61
  end
@@ -7,47 +7,47 @@ describe IPAddr do
7
7
  it "should extract a single IPv4 address" do
8
8
  addr = '127.0.0.1'
9
9
 
10
- IPAddr.extract(addr,:ipv4).should == [addr]
10
+ expect(IPAddr.extract(addr,:ipv4)).to eq([addr])
11
11
  end
12
12
 
13
13
  it "should extract multiple IPv4 addresses" do
14
14
  addrs = %w[127.0.0.1 192.168.0.1]
15
15
  text = "#{addrs[0]} #{addrs[1]}"
16
16
 
17
- IPAddr.extract(text,:ipv4).should == addrs
17
+ expect(IPAddr.extract(text,:ipv4)).to eq(addrs)
18
18
  end
19
19
 
20
20
  it "should extract IPv4 addresses from text" do
21
21
  addr = '127.0.0.1'
22
22
  text = "ip (#{addr})"
23
23
 
24
- IPAddr.extract(text,:ipv4).should == [addr]
24
+ expect(IPAddr.extract(text,:ipv4)).to eq([addr])
25
25
  end
26
26
 
27
27
  it "should ignore leading periods" do
28
28
  addr = '127.0.0.1'
29
29
  text = ".#{addr}"
30
30
 
31
- IPAddr.extract(text,:ipv4).should == [addr]
31
+ expect(IPAddr.extract(text,:ipv4)).to eq([addr])
32
32
  end
33
33
 
34
34
  it "should ignore tailing periods" do
35
35
  addr = '127.0.0.1'
36
36
  text = "#{addr}."
37
37
 
38
- IPAddr.extract(text,:ipv4).should == [addr]
38
+ expect(IPAddr.extract(text,:ipv4)).to eq([addr])
39
39
  end
40
40
 
41
41
  it "should ignore less than 3 octet IPv4 addresses" do
42
42
  text = '127.0.0. 1'
43
43
 
44
- IPAddr.extract(text,:ipv4).should be_empty
44
+ expect(IPAddr.extract(text,:ipv4)).to be_empty
45
45
  end
46
46
 
47
47
  it "should ignore IPv4 addresses with more than 3 diget octets" do
48
48
  text = '127.1111.0.1'
49
49
 
50
- IPAddr.extract(text,:ipv4).should be_empty
50
+ expect(IPAddr.extract(text,:ipv4)).to be_empty
51
51
  end
52
52
  end
53
53
 
@@ -55,42 +55,42 @@ describe IPAddr do
55
55
  it "should extract a single IPv6 address" do
56
56
  addr = 'fe80:0000:0000:0000:0204:61ff:fe9d:f156'
57
57
 
58
- IPAddr.extract(addr,:ipv6).should == [addr]
58
+ expect(IPAddr.extract(addr,:ipv6)).to eq([addr])
59
59
  end
60
60
 
61
61
  it "should extract multiple IPv6 addresses" do
62
62
  addrs = %w[::1 fe80:0000:0000:0000:0204:61ff:fe9d:f156]
63
63
  text = "#{addrs[0]} #{addrs[1]}"
64
64
 
65
- IPAddr.extract(text,:ipv6).should == addrs
65
+ expect(IPAddr.extract(text,:ipv6)).to eq(addrs)
66
66
  end
67
67
 
68
68
  it "should extract collapsed IPv6 addresses" do
69
69
  addr = 'fe80::0204:61ff:fe9d:f156'
70
70
  text = "ipv6: #{addr}"
71
71
 
72
- IPAddr.extract(text,:ipv6).should == [addr]
72
+ expect(IPAddr.extract(text,:ipv6)).to eq([addr])
73
73
  end
74
74
 
75
75
  it "should extract IPv6 addresses from text" do
76
76
  addr = 'fe80:0000:0000:0000:0204:61ff:fe9d:f156'
77
77
  text = "hello #{addr} world"
78
78
 
79
- IPAddr.extract(text,:ipv6).should == [addr]
79
+ expect(IPAddr.extract(text,:ipv6)).to eq([addr])
80
80
  end
81
81
 
82
82
  it "should extract trailing IPv4 suffixes" do
83
83
  addr = '::ffff:192.0.2.128'
84
84
  text = "#{addr} 1.1.1.1"
85
85
 
86
- IPAddr.extract(text,:ipv6).should == [addr]
86
+ expect(IPAddr.extract(text,:ipv6)).to eq([addr])
87
87
  end
88
88
 
89
89
  it "should extract short-hand IPv6 addresses" do
90
90
  addr = '::f0:0d'
91
91
  text = "ipv6: #{addr}"
92
92
 
93
- IPAddr.extract(text,:ipv6).should == [addr]
93
+ expect(IPAddr.extract(text,:ipv6)).to eq([addr])
94
94
  end
95
95
  end
96
96
 
@@ -99,13 +99,13 @@ describe IPAddr do
99
99
  ipv6 = '::1'
100
100
  text = "ipv4: #{ipv4}, ipv6: #{ipv6}"
101
101
 
102
- IPAddr.extract(text).should == [ipv4, ipv6]
102
+ expect(IPAddr.extract(text)).to eq([ipv4, ipv6])
103
103
  end
104
104
 
105
105
  it "should ignore non-IP addresses" do
106
106
  text = 'one: two.three.'
107
107
 
108
- IPAddr.extract(text).should be_empty
108
+ expect(IPAddr.extract(text)).to be_empty
109
109
  end
110
110
  end
111
111
 
@@ -117,20 +117,20 @@ describe IPAddr do
117
117
  it "should only iterate over one IP address for an address" do
118
118
  addresses = fixed_addr.map { |ip| IPAddr.new(ip) }
119
119
 
120
- addresses.length.should == 1
121
- fixed_addr.should include(addresses.first)
120
+ expect(addresses.length).to eq(1)
121
+ expect(fixed_addr).to include(addresses.first)
122
122
  end
123
123
 
124
124
  it "should iterate over all IP addresses contained within the IP range" do
125
125
  class_c.each do |ip|
126
- class_c.should include(IPAddr.new(ip))
126
+ expect(class_c).to include(IPAddr.new(ip))
127
127
  end
128
128
  end
129
129
 
130
130
  it "should return an Enumerator when no block is given" do
131
- class_c.each.all? { |ip|
131
+ expect(class_c.each.all? { |ip|
132
132
  class_c.include?(IPAddr.new(ip))
133
- }.should == true
133
+ }).to be(true)
134
134
  end
135
135
  end
136
136
 
@@ -141,43 +141,43 @@ describe IPAddr do
141
141
  it "should expand '*' ranges" do
142
142
  octets = IPAddr.each("10.1.1.*").map { |ip| ip.split('.',4).last }
143
143
 
144
- octets.should == ('1'..'254').to_a
144
+ expect(octets).to eq(('1'..'254').to_a)
145
145
  end
146
146
 
147
147
  it "should expend 'i-j' ranges" do
148
148
  octets = IPAddr.each("10.1.1.10-20").map { |ip| ip.split('.',4).last }
149
149
 
150
- octets.should == ('10'..'20').to_a
150
+ expect(octets).to eq(('10'..'20').to_a)
151
151
  end
152
152
 
153
153
  it "should expand 'i,j,k' ranges" do
154
154
  octets = IPAddr.each("10.1.1.1,2,3").map { |ip| ip.split('.',4).last }
155
155
 
156
- octets.should == ['1', '2', '3']
156
+ expect(octets).to eq(['1', '2', '3'])
157
157
  end
158
158
 
159
159
  it "should expand combination 'i,j-k' ranges" do
160
160
  octets = IPAddr.each("10.1.1.1,3-4").map { |ip| ip.split('.',4).last }
161
161
 
162
- octets.should == ['1', '3', '4']
162
+ expect(octets).to eq(['1', '3', '4'])
163
163
  end
164
164
 
165
165
  it "should iterate over all IP addresses in an IPv4 range" do
166
166
  IPAddr.each(ipv4_range) do |ip|
167
- ip.should =~ /^10\.1\.[1-5]\.1$/
167
+ expect(ip).to match(/^10\.1\.[1-5]\.1$/)
168
168
  end
169
169
  end
170
170
 
171
171
  it "should iterate over all IP addresses in an IPv6 range" do
172
172
  IPAddr.each(ipv6_range) do |ip|
173
- ip.should =~ /^::ff::0[2-9a]::c3$/
173
+ expect(ip).to match(/^::ff::0[2-9a]::c3$/)
174
174
  end
175
175
  end
176
176
 
177
177
  it "should return an Enumerator when no block is given" do
178
178
  ips = IPAddr.each(ipv4_range)
179
179
 
180
- ips.all? { |ip| ip =~ /^10\.1\.[1-5]\.1$/ }.should == true
180
+ expect(ips.all? { |ip| ip =~ /^10\.1\.[1-5]\.1$/ }).to be(true)
181
181
  end
182
182
  end
183
183
  end
@@ -189,15 +189,15 @@ describe IPAddr do
189
189
  let(:nameserver) { '4.2.2.1' }
190
190
 
191
191
  it "should lookup the host-name for an IP" do
192
- ip.lookup.should include('localhost')
192
+ expect(ip.lookup).to include('localhost')
193
193
  end
194
194
 
195
195
  it "may lookup host-names via other nameservers" do
196
- ip.lookup(nameserver).should be_empty
196
+ expect(ip.lookup(nameserver)).to be_empty
197
197
  end
198
198
 
199
199
  it "should return an empty Array for unknown IP addresses" do
200
- bad_ip.lookup.should be_empty
200
+ expect(bad_ip.lookup).to be_empty
201
201
  end
202
202
  end
203
203
  end
@@ -3,28 +3,28 @@ require 'ronin/extensions/kernel'
3
3
 
4
4
  describe Kernel do
5
5
  it "should provide Kernel#try" do
6
- Kernel.should respond_to('try')
6
+ expect(Kernel).to respond_to('try')
7
7
  end
8
8
 
9
9
  describe "#try" do
10
10
  it "should return the result of the block if nothing is raised" do
11
- try { 2 + 2 }.should == 4
11
+ expect(try { 2 + 2 }).to eq(4)
12
12
  end
13
13
 
14
14
  it "should return nil if an exception is raised" do
15
- try { 2 + 'a' }.should be_nil
15
+ expect(try { 2 + 'a' }).to be_nil
16
16
  end
17
17
 
18
18
  it "should rescue RuntimeError exceptions" do
19
- lambda {
19
+ expect {
20
20
  try { raise(RuntimeError,"something happened",caller) }
21
- }.should_not raise_error(RuntimeError)
21
+ }.not_to raise_error
22
22
  end
23
23
 
24
24
  it "should rescue StandardError exceptions" do
25
- lambda {
25
+ expect {
26
26
  try { raise(StandardError,"not allowed to do that",caller) }
27
- }.should_not raise_error(StandardError)
27
+ }.not_to raise_error
28
28
  end
29
29
  end
30
30
  end
@@ -8,29 +8,29 @@ describe Regexp do
8
8
  subject { Regexp::WORD }
9
9
 
10
10
  it "should not match single letters" do
11
- subject.match('A').should be_nil
11
+ expect(subject.match('A')).to be_nil
12
12
  end
13
13
 
14
14
  it "should not match numeric letters" do
15
- subject.match("123#{word}123")[0].should == word
15
+ expect(subject.match("123#{word}123")[0]).to eq(word)
16
16
  end
17
17
 
18
18
  it "should not include ending periods" do
19
- subject.match("#{word}.")[0].should == word
19
+ expect(subject.match("#{word}.")[0]).to eq(word)
20
20
  end
21
21
 
22
22
  it "should not include leading punctuation" do
23
- subject.match("'#{word}")[0].should == word
23
+ expect(subject.match("'#{word}")[0]).to eq(word)
24
24
  end
25
25
 
26
26
  it "should not include tailing punctuation" do
27
- subject.match("#{word}'")[0].should == word
27
+ expect(subject.match("#{word}'")[0]).to eq(word)
28
28
  end
29
29
 
30
30
  it "should include punctuation in the middle of the word" do
31
31
  name = "O'Brian"
32
32
 
33
- subject.match(name)[0].should == name
33
+ expect(subject.match(name)[0]).to eq(name)
34
34
  end
35
35
  end
36
36
 
@@ -38,13 +38,13 @@ describe Regexp do
38
38
  subject { Regexp::OCTET }
39
39
 
40
40
  it "should match 0 - 255" do
41
- (0..255).all? { |n|
41
+ expect((0..255).all? { |n|
42
42
  subject.match(n.to_s)[0] == n.to_s
43
- }.should be_true
43
+ }).to be(true)
44
44
  end
45
45
 
46
46
  it "should not match numbers greater than 255" do
47
- subject.match('256')[0].should == '25'
47
+ expect(subject.match('256')[0]).to eq('25')
48
48
  end
49
49
  end
50
50
 
@@ -54,7 +54,7 @@ describe Regexp do
54
54
  it "should match six hexadecimal bytes" do
55
55
  mac = '12:34:56:78:9a:bc'
56
56
 
57
- subject.match(mac)[0].should == mac
57
+ expect(subject.match(mac)[0]).to eq(mac)
58
58
  end
59
59
  end
60
60
 
@@ -64,37 +64,37 @@ describe Regexp do
64
64
  it "should match valid addresses" do
65
65
  ip = '127.0.0.1'
66
66
 
67
- subject.match(ip)[0].should == ip
67
+ expect(subject.match(ip)[0]).to eq(ip)
68
68
  end
69
69
 
70
70
  it "should match the Any address" do
71
71
  ip = '0.0.0.0'
72
72
 
73
- subject.match(ip)[0].should == ip
73
+ expect(subject.match(ip)[0]).to eq(ip)
74
74
  end
75
75
 
76
76
  it "should match the broadcast address" do
77
77
  ip = '255.255.255.255'
78
78
 
79
- subject.match(ip)[0].should == ip
79
+ expect(subject.match(ip)[0]).to eq(ip)
80
80
  end
81
81
 
82
82
  it "should match addresses with netmasks" do
83
83
  ip = '10.1.1.1/24'
84
84
 
85
- subject.match(ip)[0].should == ip
85
+ expect(subject.match(ip)[0]).to eq(ip)
86
86
  end
87
87
 
88
88
  it "should not match addresses with octets > 255" do
89
89
  ip = '10.1.256.1'
90
90
 
91
- subject.match(ip).should be_nil
91
+ expect(subject.match(ip)).to be_nil
92
92
  end
93
93
 
94
94
  it "should not match addresses with more than three digits per octet" do
95
95
  ip = '10.1111.1.1'
96
96
 
97
- subject.match(ip).should be_nil
97
+ expect(subject.match(ip)).to be_nil
98
98
  end
99
99
  end
100
100
 
@@ -104,25 +104,25 @@ describe Regexp do
104
104
  it "should match valid IPv6 addresses" do
105
105
  ip = '2001:db8:85a3:0:0:8a2e:370:7334'
106
106
 
107
- subject.match(ip)[0].should == ip
107
+ expect(subject.match(ip)[0]).to eq(ip)
108
108
  end
109
109
 
110
110
  it "should match IPv6 addresses with netmasks" do
111
111
  ip = '2001:db8:1234::/48'
112
112
 
113
- subject.match(ip)[0].should == ip
113
+ expect(subject.match(ip)[0]).to eq(ip)
114
114
  end
115
115
 
116
116
  it "should match truncated IPv6 addresses" do
117
117
  ip = '2001:db8:85a3::8a2e:370:7334'
118
118
 
119
- subject.match(ip)[0].should == ip
119
+ expect(subject.match(ip)[0]).to eq(ip)
120
120
  end
121
121
 
122
122
  it "should match IPv4-mapped IPv6 addresses" do
123
123
  ip = '::ffff:192.0.2.128'
124
124
 
125
- subject.match(ip)[0].should == ip
125
+ expect(subject.match(ip)[0]).to eq(ip)
126
126
  end
127
127
  end
128
128
 
@@ -132,13 +132,13 @@ describe Regexp do
132
132
  it "should match IPv4 addresses" do
133
133
  ip = '10.1.1.1'
134
134
 
135
- subject.match(ip)[0].should == ip
135
+ expect(subject.match(ip)[0]).to eq(ip)
136
136
  end
137
137
 
138
138
  it "should match IPv6 addresses" do
139
139
  ip = '2001:db8:85a3:0:0:8a2e:370:7334'
140
140
 
141
- subject.match(ip)[0].should == ip
141
+ expect(subject.match(ip)[0]).to eq(ip)
142
142
  end
143
143
  end
144
144
 
@@ -148,15 +148,15 @@ describe Regexp do
148
148
  it "should match valid hostnames" do
149
149
  hostname = 'www.google.com'
150
150
 
151
- subject.match(hostname)[0].should == hostname
151
+ expect(subject.match(hostname)[0]).to eq(hostname)
152
152
  end
153
153
 
154
154
  it "should not match hostnames without a TLD" do
155
- subject.match('foo').should be_nil
155
+ expect(subject.match('foo')).to be_nil
156
156
  end
157
157
 
158
158
  it "should not match hostnames with unknown TLDs" do
159
- subject.match('foo.zzz').should be_nil
159
+ expect(subject.match('foo.zzz')).to be_nil
160
160
  end
161
161
  end
162
162
 
@@ -166,31 +166,31 @@ describe Regexp do
166
166
  it "should match valid user-names" do
167
167
  username = 'alice1234'
168
168
 
169
- subject.match(username)[0].should == username
169
+ expect(subject.match(username)[0]).to eq(username)
170
170
  end
171
171
 
172
172
  it "should match user-names containing '_' characters" do
173
173
  username = 'alice_1234'
174
174
 
175
- subject.match(username)[0].should == username
175
+ expect(subject.match(username)[0]).to eq(username)
176
176
  end
177
177
 
178
178
  it "should match user-names containing '.' characters" do
179
179
  username = 'alice.1234'
180
180
 
181
- subject.match(username)[0].should == username
181
+ expect(subject.match(username)[0]).to eq(username)
182
182
  end
183
183
 
184
184
  it "should not match user-names beginning with numbers" do
185
- subject.match('1234bob')[0].should == 'bob'
185
+ expect(subject.match('1234bob')[0]).to eq('bob')
186
186
  end
187
187
 
188
188
  it "should not match user-names containing spaces" do
189
- subject.match('alice eve')[0].should == 'alice'
189
+ expect(subject.match('alice eve')[0]).to eq('alice')
190
190
  end
191
191
 
192
192
  it "should not match user-names containing other symbols" do
193
- subject.match('alice^eve')[0].should == 'alice'
193
+ expect(subject.match('alice^eve')[0]).to eq('alice')
194
194
  end
195
195
  end
196
196
 
@@ -200,7 +200,7 @@ describe Regexp do
200
200
  it "should match valid email addresses" do
201
201
  email = 'alice@example.com'
202
202
 
203
- subject.match(email)[0].should == email
203
+ expect(subject.match(email)[0]).to eq(email)
204
204
  end
205
205
  end
206
206
 
@@ -210,25 +210,25 @@ describe Regexp do
210
210
  it "should match 111-2222" do
211
211
  number = '111-2222'
212
212
 
213
- subject.match(number)[0].should == number
213
+ expect(subject.match(number)[0]).to eq(number)
214
214
  end
215
215
 
216
216
  it "should match 111-2222x9" do
217
217
  number = '111-2222x9'
218
218
 
219
- subject.match(number)[0].should == number
219
+ expect(subject.match(number)[0]).to eq(number)
220
220
  end
221
221
 
222
222
  it "should match 800-111-2222" do
223
223
  number = '800-111-2222'
224
224
 
225
- subject.match(number)[0].should == number
225
+ expect(subject.match(number)[0]).to eq(number)
226
226
  end
227
227
 
228
228
  it "should match 1-800-111-2222" do
229
229
  number = '1-800-111-2222'
230
230
 
231
- subject.match(number)[0].should == number
231
+ expect(subject.match(number)[0]).to eq(number)
232
232
  end
233
233
  end
234
234
 
@@ -238,23 +238,23 @@ describe Regexp do
238
238
  it "should match Strings beginning with a '_' character" do
239
239
  identifier = '_foo'
240
240
 
241
- subject.match(identifier)[0].should == identifier
241
+ expect(subject.match(identifier)[0]).to eq(identifier)
242
242
  end
243
243
 
244
244
  it "should match Strings ending with a '_' character" do
245
245
  identifier = 'foo_'
246
246
 
247
- subject.match(identifier)[0].should == identifier
247
+ expect(subject.match(identifier)[0]).to eq(identifier)
248
248
  end
249
249
 
250
250
  it "should not match Strings beginning with numberic characters" do
251
- subject.match('1234foo')[0].should == 'foo'
251
+ expect(subject.match('1234foo')[0]).to eq('foo')
252
252
  end
253
253
 
254
254
  it "should not match Strings not containing any alpha characters" do
255
255
  identifier = '_1234_'
256
256
 
257
- subject.match(identifier).should be_nil
257
+ expect(subject.match(identifier)).to be_nil
258
258
  end
259
259
  end
260
260
 
@@ -264,15 +264,15 @@ describe Regexp do
264
264
  it "should match the '.' separator character" do
265
265
  ext = '.txt'
266
266
 
267
- subject.match(ext)[0].should == ext
267
+ expect(subject.match(ext)[0]).to eq(ext)
268
268
  end
269
269
 
270
270
  it "should not allow '_' characters" do
271
- subject.match('.foo_bar')[0].should == '.foo'
271
+ expect(subject.match('.foo_bar')[0]).to eq('.foo')
272
272
  end
273
273
 
274
274
  it "should not allow '-' characters" do
275
- subject.match('.foo-bar')[0].should == '.foo'
275
+ expect(subject.match('.foo-bar')[0]).to eq('.foo')
276
276
  end
277
277
  end
278
278
 
@@ -282,13 +282,13 @@ describe Regexp do
282
282
  it "should match file names" do
283
283
  filename = 'foo_bar'
284
284
 
285
- subject.match(filename)[0].should == filename
285
+ expect(subject.match(filename)[0]).to eq(filename)
286
286
  end
287
287
 
288
288
  it "should match '\\' escapped characters" do
289
289
  filename = 'foo\\ bar'
290
290
 
291
- subject.match(filename)[0].should == filename
291
+ expect(subject.match(filename)[0]).to eq(filename)
292
292
  end
293
293
  end
294
294
 
@@ -298,7 +298,7 @@ describe Regexp do
298
298
  it "should match the filename and extension" do
299
299
  filename = 'foo_bar.txt'
300
300
 
301
- subject.match(filename)[0].should == filename
301
+ expect(subject.match(filename)[0]).to eq(filename)
302
302
  end
303
303
  end
304
304
 
@@ -308,19 +308,19 @@ describe Regexp do
308
308
  it "should match directory names" do
309
309
  dir = 'foo_bar'
310
310
 
311
- subject.match(dir)[0].should == dir
311
+ expect(subject.match(dir)[0]).to eq(dir)
312
312
  end
313
313
 
314
314
  it "should match '.'" do
315
315
  dir = '.'
316
316
 
317
- subject.match(dir)[0].should == dir
317
+ expect(subject.match(dir)[0]).to eq(dir)
318
318
  end
319
319
 
320
320
  it "should match '..'" do
321
321
  dir = '..'
322
322
 
323
- subject.match(dir)[0].should == dir
323
+ expect(subject.match(dir)[0]).to eq(dir)
324
324
  end
325
325
  end
326
326
 
@@ -330,7 +330,7 @@ describe Regexp do
330
330
  it "should match multiple directories" do
331
331
  path = 'foo/./bar/../baz'
332
332
 
333
- subject.match(path)[0].should == path
333
+ expect(subject.match(path)[0]).to eq(path)
334
334
  end
335
335
  end
336
336
 
@@ -340,19 +340,19 @@ describe Regexp do
340
340
  it "should match absolute paths" do
341
341
  path = '/foo/bar/baz'
342
342
 
343
- subject.match(path)[0].should == path
343
+ expect(subject.match(path)[0]).to eq(path)
344
344
  end
345
345
 
346
346
  it "should match trailing '/' characters" do
347
347
  path = '/foo/bar/baz/'
348
348
 
349
- subject.match(path)[0].should == path
349
+ expect(subject.match(path)[0]).to eq(path)
350
350
  end
351
351
 
352
352
  it "should not match relative directories" do
353
353
  path = '/foo/./bar/../baz'
354
354
 
355
- subject.match(path)[0].should == '/foo/'
355
+ expect(subject.match(path)[0]).to eq('/foo/')
356
356
  end
357
357
  end
358
358
 
@@ -362,13 +362,13 @@ describe Regexp do
362
362
  it "should match relative paths" do
363
363
  path = 'foo/./bar/../baz'
364
364
 
365
- subject.match(path)[0].should == path
365
+ expect(subject.match(path)[0]).to eq(path)
366
366
  end
367
367
 
368
368
  it "should match absolute paths" do
369
369
  path = '/foo/bar/baz'
370
370
 
371
- subject.match(path)[0].should == path
371
+ expect(subject.match(path)[0]).to eq(path)
372
372
  end
373
373
  end
374
374
 
@@ -378,7 +378,7 @@ describe Regexp do
378
378
  it "should match multiple directories" do
379
379
  path = 'foo\\.\\bar\\..\\baz'
380
380
 
381
- subject.match(path)[0].should == path
381
+ expect(subject.match(path)[0]).to eq(path)
382
382
  end
383
383
  end
384
384
 
@@ -388,19 +388,19 @@ describe Regexp do
388
388
  it "should match absolute paths" do
389
389
  path = 'C:\\foo\\bar\\baz'
390
390
 
391
- subject.match(path)[0].should == path
391
+ expect(subject.match(path)[0]).to eq(path)
392
392
  end
393
393
 
394
394
  it "should match trailing '/' characters" do
395
395
  path = 'C:\\foo\\bar\\baz\\'
396
396
 
397
- subject.match(path)[0].should == path
397
+ expect(subject.match(path)[0]).to eq(path)
398
398
  end
399
399
 
400
400
  it "should not match relative directories" do
401
401
  path = 'C:\\foo\\.\\bar\\..\\baz'
402
402
 
403
- subject.match(path)[0].should == 'C:\\foo\\'
403
+ expect(subject.match(path)[0]).to eq('C:\\foo\\')
404
404
  end
405
405
  end
406
406
 
@@ -410,13 +410,13 @@ describe Regexp do
410
410
  it "should match relative paths" do
411
411
  path = 'foo\\.\\bar\\..\\baz'
412
412
 
413
- subject.match(path)[0].should == path
413
+ expect(subject.match(path)[0]).to eq(path)
414
414
  end
415
415
 
416
416
  it "should match absolute paths" do
417
417
  path = 'C:\\foo\\bar\\baz'
418
418
 
419
- subject.match(path)[0].should == path
419
+ expect(subject.match(path)[0]).to eq(path)
420
420
  end
421
421
  end
422
422
 
@@ -426,13 +426,13 @@ describe Regexp do
426
426
  it "should match relative UNIX paths" do
427
427
  path = 'foo/./bar/../baz'
428
428
 
429
- subject.match(path)[0].should == path
429
+ expect(subject.match(path)[0]).to eq(path)
430
430
  end
431
431
 
432
432
  it "should match relative Windows paths" do
433
433
  path = 'foo\\.\\bar\\..\\baz'
434
434
 
435
- subject.match(path)[0].should == path
435
+ expect(subject.match(path)[0]).to eq(path)
436
436
  end
437
437
  end
438
438
 
@@ -442,13 +442,13 @@ describe Regexp do
442
442
  it "should match absolute UNIX paths" do
443
443
  path = '/foo/bar/baz'
444
444
 
445
- subject.match(path)[0].should == path
445
+ expect(subject.match(path)[0]).to eq(path)
446
446
  end
447
447
 
448
448
  it "should match absolute Windows paths" do
449
449
  path = 'C:\\foo\\bar\\baz'
450
450
 
451
- subject.match(path)[0].should == path
451
+ expect(subject.match(path)[0]).to eq(path)
452
452
  end
453
453
  end
454
454
 
@@ -458,25 +458,25 @@ describe Regexp do
458
458
  it "should match relative UNIX paths" do
459
459
  path = 'foo/./bar/../baz'
460
460
 
461
- subject.match(path)[0].should == path
461
+ expect(subject.match(path)[0]).to eq(path)
462
462
  end
463
463
 
464
464
  it "should match absolute UNIX paths" do
465
465
  path = '/foo/bar/baz'
466
466
 
467
- subject.match(path)[0].should == path
467
+ expect(subject.match(path)[0]).to eq(path)
468
468
  end
469
469
 
470
470
  it "should match relative Windows paths" do
471
471
  path = 'foo\\.\\bar\\..\\baz'
472
472
 
473
- subject.match(path)[0].should == path
473
+ expect(subject.match(path)[0]).to eq(path)
474
474
  end
475
475
 
476
476
  it "should match absolute Windows paths" do
477
477
  path = 'C:\\foo\\bar\\baz'
478
478
 
479
- subject.match(path)[0].should == path
479
+ expect(subject.match(path)[0]).to eq(path)
480
480
  end
481
481
  end
482
482
  end