ronin-support 0.1.0 → 0.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +24 -0
- data/Gemfile +9 -1
- data/README.md +6 -3
- data/gemspec.yml +3 -1
- data/lib/ronin/extensions.rb +2 -1
- data/lib/ronin/extensions/file.rb +4 -0
- data/lib/ronin/extensions/ip_addr.rb +8 -0
- data/lib/ronin/extensions/kernel.rb +2 -0
- data/lib/ronin/extensions/string.rb +50 -11
- data/lib/ronin/formatting/extensions/binary.rb +2 -0
- data/lib/ronin/formatting/extensions/binary/file.rb +12 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +6 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +20 -0
- data/lib/ronin/formatting/extensions/digest/file.rb +14 -0
- data/lib/ronin/formatting/extensions/digest/string.rb +8 -0
- data/lib/ronin/formatting/extensions/html.rb +21 -0
- data/lib/ronin/formatting/extensions/html/integer.rb +126 -0
- data/lib/ronin/formatting/extensions/html/string.rb +184 -0
- data/lib/ronin/formatting/extensions/http/integer.rb +7 -1
- data/lib/ronin/formatting/extensions/http/string.rb +10 -0
- data/lib/ronin/formatting/extensions/text.rb +2 -0
- data/lib/ronin/formatting/extensions/text/array.rb +10 -0
- data/lib/ronin/formatting/extensions/text/string.rb +44 -12
- data/lib/ronin/formatting/html.rb +20 -0
- data/lib/ronin/mixin.rb +89 -0
- data/lib/ronin/network/extensions/esmtp/net.rb +6 -0
- data/lib/ronin/network/extensions/http/net.rb +124 -51
- data/lib/ronin/network/extensions/imap/net.rb +4 -0
- data/lib/ronin/network/extensions/pop3/net.rb +4 -0
- data/lib/ronin/network/extensions/smtp/net.rb +73 -2
- data/lib/ronin/network/extensions/ssl/net.rb +4 -0
- data/lib/ronin/network/extensions/tcp/net.rb +16 -0
- data/lib/ronin/network/extensions/telnet/net.rb +4 -0
- data/lib/ronin/network/extensions/udp/net.rb +12 -0
- data/lib/ronin/network/http/http.rb +50 -29
- data/lib/ronin/network/http/proxy.rb +26 -0
- data/lib/ronin/network/imap.rb +4 -0
- data/lib/ronin/network/network.rb +2 -0
- data/lib/ronin/network/pop3.rb +4 -0
- data/lib/ronin/network/smtp/email.rb +43 -14
- data/lib/ronin/network/smtp/smtp.rb +6 -0
- data/lib/ronin/network/ssl.rb +2 -0
- data/lib/ronin/network/telnet.rb +16 -0
- data/lib/ronin/path.rb +6 -0
- data/lib/ronin/support/inflector.rb +3 -1
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/templates/erb.rb +4 -0
- data/lib/ronin/templates/template.rb +10 -0
- data/spec/extensions/string_spec.rb +4 -4
- data/spec/formatting/html/integer_spec.rb +66 -0
- data/spec/formatting/html/string_spec.rb +103 -0
- data/spec/formatting/http/string_spec.rb +1 -1
- data/spec/formatting/text/string_spec.rb +18 -66
- data/spec/mixin_spec.rb +53 -0
- data/spec/network/http/http_spec.rb +0 -7
- data/spec/network/http/proxy_spec.rb +2 -2
- data/spec/network/smtp/email_spec.rb +100 -0
- data/spec/path_spec.rb +13 -13
- data/spec/templates/helpers/data.rb +1 -1
- metadata +52 -33
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ronin/network/smtp/email'
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
describe Network::SMTP::Email do
|
7
|
+
describe "#initialize" do
|
8
|
+
it "should default 'date' to Time.now" do
|
9
|
+
email = Network::SMTP::Email.new
|
10
|
+
|
11
|
+
email.date.should_not be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should accept a String body" do
|
15
|
+
body = 'hello'
|
16
|
+
email = Network::SMTP::Email.new(:body => body)
|
17
|
+
|
18
|
+
email.body.should == [body]
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should accept an Array body" do
|
22
|
+
body = ['hello', 'world']
|
23
|
+
email = Network::SMTP::Email.new(:body => body)
|
24
|
+
|
25
|
+
email.body.should == body
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should default 'body' to an empty Array" do
|
29
|
+
email = Network::SMTP::Email.new
|
30
|
+
|
31
|
+
email.body.should be_empty
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#to_s" do
|
36
|
+
subject { Network::SMTP::Email.new }
|
37
|
+
|
38
|
+
it "should add the 'from'" do
|
39
|
+
subject.from = 'joe@example.com'
|
40
|
+
|
41
|
+
subject.to_s.should include("From: joe@example.com\n\r")
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when formatting 'to'" do
|
45
|
+
it "should accept an Array of addresses" do
|
46
|
+
subject.to = ['alice@example.com', 'joe@example.com']
|
47
|
+
|
48
|
+
subject.to_s.should include("To: alice@example.com, joe@example.com\n\r")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should accept a String" do
|
52
|
+
subject.to = 'joe@example.com'
|
53
|
+
|
54
|
+
subject.to_s.should include("To: joe@example.com\n\r")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should add the 'subject'" do
|
59
|
+
subject.subject = 'Hello'
|
60
|
+
|
61
|
+
subject.to_s.should include("Subject: Hello\n\r")
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should add the 'date'" do
|
65
|
+
subject.date = Date.parse('Sun Apr 24 17:22:55 PDT 2011')
|
66
|
+
|
67
|
+
subject.to_s.should include("Date: #{subject.date}\n\r")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should add the 'message_id'" do
|
71
|
+
subject.message_id = '1234'
|
72
|
+
|
73
|
+
subject.to_s.should include("Message-Id: <#{subject.message_id}>\n\r")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should add additional headers" do
|
77
|
+
subject.headers['X-Foo'] = 'Bar'
|
78
|
+
subject.headers['X-Baz'] = 'Quix'
|
79
|
+
|
80
|
+
lines = subject.to_s.split("\n\r")
|
81
|
+
|
82
|
+
lines.should include('X-Foo: Bar')
|
83
|
+
lines.should include('X-Baz: Quix')
|
84
|
+
end
|
85
|
+
|
86
|
+
context "when formatting 'body'" do
|
87
|
+
it "should append each line with a CRLF" do
|
88
|
+
subject.body = ['hello', 'world']
|
89
|
+
|
90
|
+
subject.to_s.should include("hello\n\rworld")
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should add a CRLF before the body" do
|
94
|
+
subject.body = ['hello', 'world']
|
95
|
+
|
96
|
+
subject.to_s.should include("\n\rhello")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/spec/path_spec.rb
CHANGED
@@ -2,22 +2,22 @@ require 'spec_helper'
|
|
2
2
|
require 'ronin/path'
|
3
3
|
|
4
4
|
describe Path do
|
5
|
+
subject { described_class }
|
6
|
+
|
5
7
|
let(:n) { 7 }
|
6
8
|
|
7
9
|
it "should inherit from Pathname" do
|
8
|
-
|
10
|
+
subject.superclass.should == Pathname
|
9
11
|
end
|
10
12
|
|
11
13
|
it "should provide the root path" do
|
12
|
-
path =
|
14
|
+
path = subject.root
|
13
15
|
|
14
16
|
path.should.class == Path
|
15
17
|
path.to_s.should == '/'
|
16
18
|
end
|
17
19
|
|
18
20
|
describe "up" do
|
19
|
-
subject { Path }
|
20
|
-
|
21
21
|
it "should be able to traverse up 0 directories" do
|
22
22
|
subject.up(0).should == File::SEPARATOR
|
23
23
|
end
|
@@ -50,33 +50,33 @@ describe Path do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "#join" do
|
53
|
-
|
53
|
+
subject { Path.new('base') }
|
54
54
|
|
55
55
|
it "should join with sub-paths" do
|
56
56
|
sub_path = File.join('one','two')
|
57
|
-
expected = [
|
57
|
+
expected = [subject, sub_path].join(File::SEPARATOR)
|
58
58
|
|
59
|
-
|
59
|
+
subject.join(sub_path).to_s.should == expected
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should join with a sub-directory" do
|
63
63
|
sub_directory = 'three'
|
64
|
-
expected = [
|
64
|
+
expected = [subject, sub_directory].join(File::SEPARATOR)
|
65
65
|
|
66
|
-
|
66
|
+
subject.join(sub_directory).to_s.should == expected
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should not collapse directory traversals" do
|
70
70
|
traversal = Path.up(n)
|
71
|
-
expected = [
|
71
|
+
expected = [subject, traversal].join(File::SEPARATOR)
|
72
72
|
|
73
|
-
|
73
|
+
subject.join(traversal).to_s.should == expected
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should filter out extra directory separators" do
|
77
|
-
expected = [
|
77
|
+
expected = [subject, 'sub'].join(File::SEPARATOR)
|
78
78
|
|
79
|
-
|
79
|
+
subject.join('/','sub','/').to_s.should == expected
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should join with the root path" do
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.2.0.rc1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-05-14 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: chars
|
@@ -25,47 +24,55 @@ dependencies:
|
|
25
24
|
prerelease: false
|
26
25
|
version_requirements: *id001
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
27
|
+
name: hexdump
|
29
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
29
|
none: false
|
31
30
|
requirements:
|
32
31
|
- - ~>
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: "0.
|
33
|
+
version: "0.1"
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: *id002
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
38
|
+
name: combinatorics
|
40
39
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.5.2
|
46
42
|
- - ~>
|
47
43
|
- !ruby/object:Gem::Version
|
48
|
-
version: "0.
|
44
|
+
version: "0.3"
|
49
45
|
type: :runtime
|
50
46
|
prerelease: false
|
51
47
|
version_requirements: *id003
|
52
48
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
49
|
+
name: uri-query_params
|
54
50
|
requirement: &id004 !ruby/object:Gem::Requirement
|
55
51
|
none: false
|
56
52
|
requirements:
|
57
53
|
- - ">="
|
58
54
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.2
|
55
|
+
version: 0.5.2
|
60
56
|
- - ~>
|
61
57
|
- !ruby/object:Gem::Version
|
62
|
-
version: "0.
|
58
|
+
version: "0.5"
|
63
59
|
type: :runtime
|
64
60
|
prerelease: false
|
65
61
|
version_requirements: *id004
|
66
62
|
- !ruby/object:Gem::Dependency
|
67
|
-
name:
|
63
|
+
name: data_paths
|
68
64
|
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - "="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.3.0.rc1
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: *id005
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: bundler
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
69
76
|
none: false
|
70
77
|
requirements:
|
71
78
|
- - ~>
|
@@ -73,10 +80,10 @@ dependencies:
|
|
73
80
|
version: 1.0.10
|
74
81
|
type: :development
|
75
82
|
prerelease: false
|
76
|
-
version_requirements: *
|
83
|
+
version_requirements: *id006
|
77
84
|
- !ruby/object:Gem::Dependency
|
78
85
|
name: yard
|
79
|
-
requirement: &
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
80
87
|
none: false
|
81
88
|
requirements:
|
82
89
|
- - ~>
|
@@ -84,7 +91,7 @@ dependencies:
|
|
84
91
|
version: 0.6.4
|
85
92
|
type: :development
|
86
93
|
prerelease: false
|
87
|
-
version_requirements: *
|
94
|
+
version_requirements: *id007
|
88
95
|
description: Ronin Support is a support library for Ronin. Ronin Support contains many of the convenience methods used by Ronin and additional libraries.
|
89
96
|
email:
|
90
97
|
- postmodern.mod3@gmail.com
|
@@ -125,14 +132,19 @@ files:
|
|
125
132
|
- lib/ronin/formatting/extensions/digest.rb
|
126
133
|
- lib/ronin/formatting/extensions/digest/file.rb
|
127
134
|
- lib/ronin/formatting/extensions/digest/string.rb
|
135
|
+
- lib/ronin/formatting/extensions/html.rb
|
136
|
+
- lib/ronin/formatting/extensions/html/integer.rb
|
137
|
+
- lib/ronin/formatting/extensions/html/string.rb
|
128
138
|
- lib/ronin/formatting/extensions/http.rb
|
129
139
|
- lib/ronin/formatting/extensions/http/integer.rb
|
130
140
|
- lib/ronin/formatting/extensions/http/string.rb
|
131
141
|
- lib/ronin/formatting/extensions/text.rb
|
132
142
|
- lib/ronin/formatting/extensions/text/array.rb
|
133
143
|
- lib/ronin/formatting/extensions/text/string.rb
|
144
|
+
- lib/ronin/formatting/html.rb
|
134
145
|
- lib/ronin/formatting/http.rb
|
135
146
|
- lib/ronin/formatting/text.rb
|
147
|
+
- lib/ronin/mixin.rb
|
136
148
|
- lib/ronin/network.rb
|
137
149
|
- lib/ronin/network/esmtp.rb
|
138
150
|
- lib/ronin/network/extensions.rb
|
@@ -206,13 +218,17 @@ files:
|
|
206
218
|
- spec/formatting/binary/integer_spec.rb
|
207
219
|
- spec/formatting/binary/string_spec.rb
|
208
220
|
- spec/formatting/digest/string_spec.rb
|
221
|
+
- spec/formatting/html/integer_spec.rb
|
222
|
+
- spec/formatting/html/string_spec.rb
|
209
223
|
- spec/formatting/http/integer_spec.rb
|
210
224
|
- spec/formatting/http/string_spec.rb
|
211
225
|
- spec/formatting/text/array_spec.rb
|
212
226
|
- spec/formatting/text/string_spec.rb
|
227
|
+
- spec/mixin_spec.rb
|
213
228
|
- spec/network/http/http_spec.rb
|
214
229
|
- spec/network/http/proxy_spec.rb
|
215
230
|
- spec/network/network_spec.rb
|
231
|
+
- spec/network/smtp/email_spec.rb
|
216
232
|
- spec/network/ssl_spec.rb
|
217
233
|
- spec/path_spec.rb
|
218
234
|
- spec/spec_helper.rb
|
@@ -225,7 +241,6 @@ files:
|
|
225
241
|
- spec/templates/helpers/data/includes/_relative.erb
|
226
242
|
- spec/templates/helpers/data/templates/example.erb
|
227
243
|
- spec/templates/template_spec.rb
|
228
|
-
has_rdoc: yard
|
229
244
|
homepage: http://github.com/ronin-ruby/ronin-support
|
230
245
|
licenses:
|
231
246
|
- LGPL-3
|
@@ -249,28 +264,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
264
|
requirements: []
|
250
265
|
|
251
266
|
rubyforge_project: ronin-support
|
252
|
-
rubygems_version: 1.
|
267
|
+
rubygems_version: 1.8.1
|
253
268
|
signing_key:
|
254
269
|
specification_version: 3
|
255
270
|
summary: A support library for Ronin.
|
256
271
|
test_files:
|
257
|
-
- spec/
|
258
|
-
- spec/
|
259
|
-
- spec/path_spec.rb
|
260
|
-
- spec/network/ssl_spec.rb
|
272
|
+
- spec/network/network_spec.rb
|
273
|
+
- spec/network/smtp/email_spec.rb
|
261
274
|
- spec/network/http/http_spec.rb
|
262
275
|
- spec/network/http/proxy_spec.rb
|
263
|
-
- spec/network/
|
264
|
-
- spec/
|
276
|
+
- spec/network/ssl_spec.rb
|
277
|
+
- spec/templates/erb_spec.rb
|
278
|
+
- spec/templates/template_spec.rb
|
265
279
|
- spec/support/inflector_spec.rb
|
266
|
-
- spec/
|
267
|
-
- spec/extensions/ip_addr_spec.rb
|
280
|
+
- spec/path_spec.rb
|
268
281
|
- spec/extensions/file_spec.rb
|
269
282
|
- spec/extensions/kernel_spec.rb
|
270
|
-
- spec/
|
271
|
-
- spec/
|
272
|
-
- spec/
|
273
|
-
- spec/formatting/binary/string_spec.rb
|
283
|
+
- spec/extensions/string_spec.rb
|
284
|
+
- spec/extensions/ip_addr_spec.rb
|
285
|
+
- spec/mixin_spec.rb
|
274
286
|
- spec/formatting/binary/integer_spec.rb
|
275
|
-
- spec/formatting/
|
287
|
+
- spec/formatting/binary/string_spec.rb
|
288
|
+
- spec/formatting/html/integer_spec.rb
|
289
|
+
- spec/formatting/html/string_spec.rb
|
290
|
+
- spec/formatting/digest/string_spec.rb
|
276
291
|
- spec/formatting/text/array_spec.rb
|
292
|
+
- spec/formatting/text/string_spec.rb
|
293
|
+
- spec/formatting/http/integer_spec.rb
|
294
|
+
- spec/formatting/http/string_spec.rb
|
295
|
+
- spec/support_spec.rb
|