ronin-support 0.4.0.rc2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,137 @@
1
+ require 'spec_helper'
2
+ require 'ronin/network/dns'
3
+
4
+ require 'ipaddr'
5
+
6
+ describe Network::DNS do
7
+ let(:server) { '4.2.2.1' }
8
+
9
+ describe "nameserver" do
10
+ it "should be nil by default" do
11
+ subject.nameserver.should be_nil
12
+ end
13
+ end
14
+
15
+ describe "nameserver=" do
16
+ it "should accept Strings" do
17
+ subject.nameserver = server
18
+
19
+ subject.nameserver.should == server
20
+ end
21
+
22
+ it "should accept nil" do
23
+ subject.nameserver = server
24
+ subject.nameserver = nil
25
+
26
+ subject.nameserver.should be_nil
27
+ end
28
+
29
+ it "should convert non-nil values to Strings" do
30
+ subject.nameserver = IPAddr.new(server)
31
+
32
+ subject.nameserver.should == server
33
+ end
34
+ end
35
+
36
+ describe "#dns_resolver" do
37
+ subject do
38
+ obj = Object.new
39
+ obj.extend described_class
40
+ obj
41
+ end
42
+
43
+ it "should return Resolv when passed no nameserver" do
44
+ subject.dns_resolver(nil).should == Resolv
45
+ end
46
+
47
+ it "should return Resolv::DNS when passed a nameserver" do
48
+ subject.dns_resolver(server).should be_kind_of(Resolv::DNS)
49
+ end
50
+ end
51
+
52
+ describe "helper methods", :network do
53
+ let(:hostname) { 'example.com' }
54
+ let(:bad_hostname) { 'foo.bar' }
55
+ let(:address) { '192.0.43.10' }
56
+ let(:bad_address) { '0.0.0.0' }
57
+ let(:reverse_hostname) { '43-10.any.icann.org' }
58
+
59
+ subject do
60
+ obj = Object.new
61
+ obj.extend described_class
62
+ obj
63
+ end
64
+
65
+ describe "#dns_lookup" do
66
+ it "should lookup the address for a hostname" do
67
+ subject.dns_lookup(hostname).should == address
68
+ end
69
+
70
+ it "should return nil for unknown hostnames" do
71
+ subject.dns_lookup(bad_hostname).should be_nil
72
+ end
73
+
74
+ it "should accept non-String hostnames" do
75
+ subject.dns_lookup(hostname.to_sym).should == address
76
+ end
77
+
78
+ it "should accept an additional nameserver argument" do
79
+ subject.dns_lookup(hostname,server).should == address
80
+ end
81
+ end
82
+
83
+ describe "#dns_lookup_all" do
84
+ it "should lookup all addresses for a hostname" do
85
+ subject.dns_lookup_all(hostname).should == [address]
86
+ end
87
+
88
+ it "should return an empty Array for unknown hostnames" do
89
+ subject.dns_lookup_all(bad_hostname).should == []
90
+ end
91
+
92
+ it "should accept non-String hostnames" do
93
+ subject.dns_lookup_all(hostname.to_sym).should == [address]
94
+ end
95
+
96
+ it "should accept an additional nameserver argument" do
97
+ subject.dns_lookup_all(hostname,server).should == [address]
98
+ end
99
+ end
100
+
101
+ describe "#dns_reverse_lookup" do
102
+ it "should lookup the address for a hostname" do
103
+ subject.dns_reverse_lookup(address).should == reverse_hostname
104
+ end
105
+
106
+ it "should return nil for unknown hostnames" do
107
+ subject.dns_reverse_lookup(bad_address).should be_nil
108
+ end
109
+
110
+ it "should accept non-String addresses" do
111
+ subject.dns_reverse_lookup(IPAddr.new(address)).should == reverse_hostname
112
+ end
113
+
114
+ it "should accept an additional nameserver argument" do
115
+ subject.dns_reverse_lookup(address,server).should == reverse_hostname
116
+ end
117
+ end
118
+
119
+ describe "#dns_reverse_lookup_all" do
120
+ it "should lookup all addresses for a hostname" do
121
+ subject.dns_reverse_lookup_all(address).should == [reverse_hostname]
122
+ end
123
+
124
+ it "should return an empty Array for unknown hostnames" do
125
+ subject.dns_reverse_lookup_all(bad_address).should == []
126
+ end
127
+
128
+ it "should accept non-String addresses" do
129
+ subject.dns_reverse_lookup_all(IPAddr.new(address)).should == [reverse_hostname]
130
+ end
131
+
132
+ it "should accept an additional nameserver argument" do
133
+ subject.dns_reverse_lookup_all(address,server).should == [reverse_hostname]
134
+ end
135
+ end
136
+ end
137
+ end
@@ -74,7 +74,7 @@ describe Wordlist do
74
74
  wordlist = described_class.new(words)
75
75
  wordlist.mutations['o'] = ['0']
76
76
 
77
- wordlist.to_a.should == %w[foo f0o fo0 f00 bar baz]
77
+ wordlist.to_a.should =~ %w[foo f0o fo0 f00 bar baz]
78
78
  end
79
79
  end
80
80
 
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.rc2
5
- prerelease: 6
4
+ version: 0.4.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-23 00:00:00.000000000 Z
12
+ date: 2012-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chars
16
- requirement: &20344600 !ruby/object:Gem::Requirement
16
+ requirement: &21873340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20344600
24
+ version_requirements: *21873340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hexdump
27
- requirement: &20343920 !ruby/object:Gem::Requirement
27
+ requirement: &21872300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20343920
35
+ version_requirements: *21872300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: combinatorics
38
- requirement: &20343320 !ruby/object:Gem::Requirement
38
+ requirement: &21871660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *20343320
46
+ version_requirements: *21871660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: uri-query_params
49
- requirement: &20342700 !ruby/object:Gem::Requirement
49
+ requirement: &21837140 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.6'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *20342700
57
+ version_requirements: *21837140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: data_paths
60
- requirement: &20341880 !ruby/object:Gem::Requirement
60
+ requirement: &21834740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0.3'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *20341880
68
+ version_requirements: *21834740
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: parameters
71
- requirement: &20340860 !ruby/object:Gem::Requirement
71
+ requirement: &21831580 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0.4'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *20340860
79
+ version_requirements: *21831580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: bundler
82
- requirement: &20338400 !ruby/object:Gem::Requirement
82
+ requirement: &21758280 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '1.0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *20338400
90
+ version_requirements: *21758280
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: yard
93
- requirement: &20337460 !ruby/object:Gem::Requirement
93
+ requirement: &21752700 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.7.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *20337460
101
+ version_requirements: *21752700
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: yard-parameters
104
- requirement: &20336720 !ruby/object:Gem::Requirement
104
+ requirement: &21749860 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 0.1.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *20336720
112
+ version_requirements: *21749860
113
113
  description: Ronin Support is a support library for Ronin. Ronin Support contains
114
114
  many of the convenience methods used by Ronin and additional libraries.
115
115
  email: postmodern.mod3@gmail.com
@@ -170,6 +170,7 @@ files:
170
170
  - lib/ronin/fuzzing/fuzzing.rb
171
171
  - lib/ronin/mixin.rb
172
172
  - lib/ronin/network.rb
173
+ - lib/ronin/network/dns.rb
173
174
  - lib/ronin/network/esmtp.rb
174
175
  - lib/ronin/network/extensions.rb
175
176
  - lib/ronin/network/extensions/esmtp.rb
@@ -198,6 +199,7 @@ files:
198
199
  - lib/ronin/network/http/proxy.rb
199
200
  - lib/ronin/network/imap.rb
200
201
  - lib/ronin/network/mixins.rb
202
+ - lib/ronin/network/mixins/dns.rb
201
203
  - lib/ronin/network/mixins/esmtp.rb
202
204
  - lib/ronin/network/mixins/http.rb
203
205
  - lib/ronin/network/mixins/imap.rb
@@ -276,6 +278,7 @@ files:
276
278
  - spec/formatting/text/string_spec.rb
277
279
  - spec/fuzzing/string_spec.rb
278
280
  - spec/mixin_spec.rb
281
+ - spec/network/dns_spec.rb
279
282
  - spec/network/http/http_spec.rb
280
283
  - spec/network/http/proxy_spec.rb
281
284
  - spec/network/network_spec.rb
@@ -319,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
322
  version: '0'
320
323
  requirements: []
321
324
  rubyforge_project:
322
- rubygems_version: 1.8.10
325
+ rubygems_version: 1.8.16
323
326
  signing_key:
324
327
  specification_version: 3
325
328
  summary: A support library for Ronin.
@@ -343,6 +346,7 @@ test_files:
343
346
  - spec/formatting/text/string_spec.rb
344
347
  - spec/fuzzing/string_spec.rb
345
348
  - spec/mixin_spec.rb
349
+ - spec/network/dns_spec.rb
346
350
  - spec/network/http/http_spec.rb
347
351
  - spec/network/http/proxy_spec.rb
348
352
  - spec/network/network_spec.rb