ronin-support 0.1.0.pre1

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 (127) hide show
  1. data/.document +4 -0
  2. data/.rspec +1 -0
  3. data/.yardopts +1 -0
  4. data/COPYING.txt +504 -0
  5. data/ChangeLog.md +4 -0
  6. data/Gemfile +23 -0
  7. data/README.md +98 -0
  8. data/Rakefile +29 -0
  9. data/gemspec.yml +20 -0
  10. data/lib/ronin/extensions.rb +28 -0
  11. data/lib/ronin/extensions/file.rb +63 -0
  12. data/lib/ronin/extensions/ip_addr.rb +220 -0
  13. data/lib/ronin/extensions/kernel.rb +45 -0
  14. data/lib/ronin/extensions/meta.rb +22 -0
  15. data/lib/ronin/extensions/meta/object.rb +24 -0
  16. data/lib/ronin/extensions/string.rb +200 -0
  17. data/lib/ronin/formatting.rb +26 -0
  18. data/lib/ronin/formatting/binary.rb +22 -0
  19. data/lib/ronin/formatting/digest.rb +22 -0
  20. data/lib/ronin/formatting/extensions.rb +25 -0
  21. data/lib/ronin/formatting/extensions/binary.rb +24 -0
  22. data/lib/ronin/formatting/extensions/binary/file.rb +35 -0
  23. data/lib/ronin/formatting/extensions/binary/integer.rb +147 -0
  24. data/lib/ronin/formatting/extensions/binary/string.rb +363 -0
  25. data/lib/ronin/formatting/extensions/digest.rb +23 -0
  26. data/lib/ronin/formatting/extensions/digest/file.rb +117 -0
  27. data/lib/ronin/formatting/extensions/digest/string.rb +80 -0
  28. data/lib/ronin/formatting/extensions/http.rb +23 -0
  29. data/lib/ronin/formatting/extensions/http/integer.rb +57 -0
  30. data/lib/ronin/formatting/extensions/http/string.rb +102 -0
  31. data/lib/ronin/formatting/extensions/text.rb +23 -0
  32. data/lib/ronin/formatting/extensions/text/array.rb +125 -0
  33. data/lib/ronin/formatting/extensions/text/string.rb +206 -0
  34. data/lib/ronin/formatting/http.rb +22 -0
  35. data/lib/ronin/formatting/text.rb +22 -0
  36. data/lib/ronin/network.rb +29 -0
  37. data/lib/ronin/network/esmtp.rb +22 -0
  38. data/lib/ronin/network/extensions.rb +29 -0
  39. data/lib/ronin/network/extensions/esmtp.rb +22 -0
  40. data/lib/ronin/network/extensions/esmtp/net.rb +100 -0
  41. data/lib/ronin/network/extensions/http.rb +22 -0
  42. data/lib/ronin/network/extensions/http/net.rb +661 -0
  43. data/lib/ronin/network/extensions/imap.rb +22 -0
  44. data/lib/ronin/network/extensions/imap/net.rb +124 -0
  45. data/lib/ronin/network/extensions/pop3.rb +22 -0
  46. data/lib/ronin/network/extensions/pop3/net.rb +92 -0
  47. data/lib/ronin/network/extensions/smtp.rb +22 -0
  48. data/lib/ronin/network/extensions/smtp/net.rb +110 -0
  49. data/lib/ronin/network/extensions/ssl.rb +22 -0
  50. data/lib/ronin/network/extensions/ssl/net.rb +147 -0
  51. data/lib/ronin/network/extensions/tcp.rb +22 -0
  52. data/lib/ronin/network/extensions/tcp/net.rb +304 -0
  53. data/lib/ronin/network/extensions/telnet.rb +22 -0
  54. data/lib/ronin/network/extensions/telnet/net.rb +156 -0
  55. data/lib/ronin/network/extensions/udp.rb +22 -0
  56. data/lib/ronin/network/extensions/udp/net.rb +226 -0
  57. data/lib/ronin/network/http.rb +24 -0
  58. data/lib/ronin/network/http/exceptions.rb +22 -0
  59. data/lib/ronin/network/http/exceptions/unknown_request.rb +29 -0
  60. data/lib/ronin/network/http/http.rb +290 -0
  61. data/lib/ronin/network/http/proxy.rb +307 -0
  62. data/lib/ronin/network/imap.rb +49 -0
  63. data/lib/ronin/network/network.rb +41 -0
  64. data/lib/ronin/network/pop3.rb +49 -0
  65. data/lib/ronin/network/smtp.rb +24 -0
  66. data/lib/ronin/network/smtp/email.rb +143 -0
  67. data/lib/ronin/network/smtp/smtp.rb +68 -0
  68. data/lib/ronin/network/ssl.rb +47 -0
  69. data/lib/ronin/network/tcp.rb +22 -0
  70. data/lib/ronin/network/telnet.rb +109 -0
  71. data/lib/ronin/network/udp.rb +22 -0
  72. data/lib/ronin/path.rb +132 -0
  73. data/lib/ronin/support.rb +28 -0
  74. data/lib/ronin/support/inflector.rb +40 -0
  75. data/lib/ronin/support/version.rb +27 -0
  76. data/lib/ronin/templates.rb +23 -0
  77. data/lib/ronin/templates/erb.rb +75 -0
  78. data/lib/ronin/templates/template.rb +161 -0
  79. data/ronin-support.gemspec +10 -0
  80. data/spec/extensions/file_spec.rb +24 -0
  81. data/spec/extensions/ip_addr_spec.rb +171 -0
  82. data/spec/extensions/kernel_spec.rb +30 -0
  83. data/spec/extensions/string_spec.rb +177 -0
  84. data/spec/formatting/binary/helpers/hexdumps.rb +16 -0
  85. data/spec/formatting/binary/helpers/hexdumps/ascii.bin +0 -0
  86. data/spec/formatting/binary/helpers/hexdumps/hexdump_decimal_shorts.txt +17 -0
  87. data/spec/formatting/binary/helpers/hexdumps/hexdump_hex_bytes.txt +17 -0
  88. data/spec/formatting/binary/helpers/hexdumps/hexdump_hex_shorts.txt +17 -0
  89. data/spec/formatting/binary/helpers/hexdumps/hexdump_octal_bytes.txt +17 -0
  90. data/spec/formatting/binary/helpers/hexdumps/hexdump_octal_shorts.txt +17 -0
  91. data/spec/formatting/binary/helpers/hexdumps/hexdump_repeated.txt +6 -0
  92. data/spec/formatting/binary/helpers/hexdumps/od_decimal_bytes.txt +17 -0
  93. data/spec/formatting/binary/helpers/hexdumps/od_decimal_ints.txt +17 -0
  94. data/spec/formatting/binary/helpers/hexdumps/od_decimal_quads.txt +17 -0
  95. data/spec/formatting/binary/helpers/hexdumps/od_decimal_shorts.txt +17 -0
  96. data/spec/formatting/binary/helpers/hexdumps/od_hex_bytes.txt +17 -0
  97. data/spec/formatting/binary/helpers/hexdumps/od_hex_ints.txt +17 -0
  98. data/spec/formatting/binary/helpers/hexdumps/od_hex_quads.txt +17 -0
  99. data/spec/formatting/binary/helpers/hexdumps/od_hex_shorts.txt +17 -0
  100. data/spec/formatting/binary/helpers/hexdumps/od_octal_bytes.txt +17 -0
  101. data/spec/formatting/binary/helpers/hexdumps/od_octal_ints.txt +17 -0
  102. data/spec/formatting/binary/helpers/hexdumps/od_octal_quads.txt +17 -0
  103. data/spec/formatting/binary/helpers/hexdumps/od_octal_shorts.txt +17 -0
  104. data/spec/formatting/binary/helpers/hexdumps/od_repeated.txt +6 -0
  105. data/spec/formatting/binary/helpers/hexdumps/repeated.bin +1 -0
  106. data/spec/formatting/binary/integer_spec.rb +140 -0
  107. data/spec/formatting/binary/string_spec.rb +306 -0
  108. data/spec/formatting/digest/string_spec.rb +82 -0
  109. data/spec/formatting/http/integer_spec.rb +42 -0
  110. data/spec/formatting/http/string_spec.rb +76 -0
  111. data/spec/formatting/text/array_spec.rb +105 -0
  112. data/spec/formatting/text/string_spec.rb +180 -0
  113. data/spec/network/http/http_spec.rb +280 -0
  114. data/spec/network/http/proxy_spec.rb +150 -0
  115. data/spec/network/network_spec.rb +8 -0
  116. data/spec/network/ssl_spec.rb +14 -0
  117. data/spec/path_spec.rb +84 -0
  118. data/spec/spec_helper.rb +4 -0
  119. data/spec/support_spec.rb +8 -0
  120. data/spec/templates/classes/example_erb.rb +11 -0
  121. data/spec/templates/classes/example_template.rb +35 -0
  122. data/spec/templates/erb_spec.rb +21 -0
  123. data/spec/templates/helpers/data.rb +9 -0
  124. data/spec/templates/helpers/data/includes/_relative.erb +1 -0
  125. data/spec/templates/helpers/data/templates/example.erb +1 -0
  126. data/spec/templates/template_spec.rb +54 -0
  127. metadata +286 -0
@@ -0,0 +1,206 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'chars'
23
+
24
+ class String
25
+
26
+ #
27
+ # Creates a new String by formatting each byte.
28
+ #
29
+ # @param [Hash] options
30
+ # Additional options.
31
+ #
32
+ # @option options [Array, Range] :include (0x00..0xff)
33
+ # The bytes to format.
34
+ #
35
+ # @option options [Array, Range] :exclude
36
+ # The bytes not to format.
37
+ #
38
+ # @yield [byte]
39
+ # The block which will return the formatted version of each byte
40
+ # within the String.
41
+ #
42
+ # @yieldparam [Integer] byte
43
+ # The byte to format.
44
+ #
45
+ # @return [String]
46
+ # The formatted version of the String.
47
+ #
48
+ def format_bytes(options={})
49
+ included = (options[:include] || (0x00..0xff))
50
+ excluded = (options[:exclude] || [])
51
+
52
+ formatted = ''
53
+
54
+ self.each_byte do |b|
55
+ c = b.chr
56
+
57
+ if ((included.include?(b) || included.include?(c)) \
58
+ && !(excluded.include?(b) || excluded.include?(c)))
59
+ formatted << yield(b)
60
+ else
61
+ formatted << b
62
+ end
63
+ end
64
+
65
+ return formatted
66
+ end
67
+
68
+ #
69
+ # Creates a new String by formatting each character.
70
+ #
71
+ # @param [Hash] options
72
+ # Additional options.
73
+ #
74
+ # @option options [Array, Range] :include (0x00..0xff)
75
+ # The bytes to format.
76
+ #
77
+ # @option options [Array, Range] :exclude
78
+ # The bytes not to format.
79
+ #
80
+ # @yield [char]
81
+ # The block which will return the formatted version of each character
82
+ # within the String.
83
+ #
84
+ # @yieldparam [String] char
85
+ # The character to format.
86
+ #
87
+ # @return [String]
88
+ # The formatted version of the String.
89
+ #
90
+ def format_chars(options={})
91
+ format_bytes(options) { |b| yield b.chr }
92
+ end
93
+
94
+ #
95
+ # Creates a new String by randomizing the case of each character in the
96
+ # String.
97
+ #
98
+ # @param [Hash] options
99
+ # Additional options.
100
+ #
101
+ # @option options [Array, Range] :include (0x00..0xff)
102
+ # The bytes to format.
103
+ #
104
+ # @option options [Array, Range] :exclude
105
+ # The bytes not to format.
106
+ #
107
+ # @option options [Float] :probability (0.5)
108
+ # The probability that a character will have it's case changed.
109
+ #
110
+ # @example
111
+ # "get out your checkbook".random_case
112
+ # # => "gEt Out YOur CHEckbook"
113
+ #
114
+ def random_case(options={})
115
+ prob = (options[:probability] || 0.5)
116
+
117
+ format_chars(options) do |c|
118
+ if rand <= prob
119
+ c.swapcase
120
+ else
121
+ c
122
+ end
123
+ end
124
+ end
125
+
126
+ #
127
+ # Inserts data before the occurrence of a pattern.
128
+ #
129
+ # @param [String, Regexp] pattern
130
+ # The pattern to search for.
131
+ #
132
+ # @param [String] data
133
+ # The data to insert before the pattern.
134
+ #
135
+ # @return [String]
136
+ # The new modified String.
137
+ #
138
+ def insert_before(pattern,data)
139
+ string = self.dup
140
+ index = string.index(pattern)
141
+
142
+ string.insert(index,data) if index
143
+ return string
144
+ end
145
+
146
+ #
147
+ # Inserts data after the occurrence of a pattern.
148
+ #
149
+ # @param [String, Regexp] pattern
150
+ # The pattern to search for.
151
+ #
152
+ # @param [String] data
153
+ # The data to insert after the pattern.
154
+ #
155
+ # @return [String]
156
+ # The new modified String.
157
+ #
158
+ def insert_after(pattern,data)
159
+ string = self.dup
160
+ match = string.match(pattern)
161
+
162
+ if match
163
+ index = match.end(match.length - 1)
164
+
165
+ string.insert(index,data)
166
+ end
167
+
168
+ return string
169
+ end
170
+
171
+ #
172
+ # Creates a new String by padding the String with repeating text,
173
+ # out to a specified length.
174
+ #
175
+ # @param [String] padding
176
+ # The text to pad the new String with.
177
+ #
178
+ # @param [String] max_length
179
+ # The maximum length to pad the new String out to.
180
+ #
181
+ # @return [String]
182
+ # The padded version of the String.
183
+ #
184
+ # @example
185
+ # "hello".pad('A',50)
186
+ # # => "helloAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
187
+ #
188
+ def pad(padding,max_length=self.length)
189
+ padding = padding.to_s
190
+
191
+ if max_length >= self.length
192
+ max_length -= self.length
193
+ else
194
+ max_length = 0
195
+ end
196
+
197
+ padded = self + (padding * (max_length / padding.length))
198
+
199
+ unless (remaining = max_length % padding.length) == 0
200
+ padded << padding[0...remaining]
201
+ end
202
+
203
+ return padded
204
+ end
205
+
206
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/formatting/extensions/http'
@@ -0,0 +1,22 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/formatting/extensions/text'
@@ -0,0 +1,29 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/network/tcp'
23
+ require 'ronin/network/udp'
24
+ require 'ronin/network/smtp'
25
+ require 'ronin/network/esmtp'
26
+ require 'ronin/network/pop3'
27
+ require 'ronin/network/imap'
28
+ require 'ronin/network/telnet'
29
+ require 'ronin/network/http'
@@ -0,0 +1,22 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/network/extensions/esmtp'
@@ -0,0 +1,29 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/network/extensions/tcp'
23
+ require 'ronin/network/extensions/udp'
24
+ require 'ronin/network/extensions/smtp'
25
+ require 'ronin/network/extensions/esmtp'
26
+ require 'ronin/network/extensions/pop3'
27
+ require 'ronin/network/extensions/imap'
28
+ require 'ronin/network/extensions/telnet'
29
+ require 'ronin/network/extensions/http'
@@ -0,0 +1,22 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/network/extensions/esmtp/net'
@@ -0,0 +1,100 @@
1
+ #
2
+ # Ronin - A Ruby platform for exploit development and security research.
3
+ #
4
+ # Copyright (c) 2006-2010 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
+ # Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/network/extensions/smtp'
23
+
24
+ module Net
25
+ #
26
+ # @see Ronin::Network::SMTP.message
27
+ #
28
+ def Net.esmtp_message(options={},&block)
29
+ Net.smtp_message(options,&block)
30
+ end
31
+
32
+ #
33
+ # Creates a connection to the ESMTP server.
34
+ #
35
+ # @param [String] host
36
+ # The host to connect to.
37
+ #
38
+ # @param [Hash] options
39
+ # Additional options.
40
+ #
41
+ # @option options [Integer] :port (Ronin::Network::SMTP.default_port)
42
+ # The port to connect to.
43
+ #
44
+ # @option options [String] :helo
45
+ # The HELO domain.
46
+ #
47
+ # @option options [Symbol] :auth
48
+ # The type of authentication to use. Can be either `:login`, `:plain`,
49
+ # or `:cram_md5`.
50
+ #
51
+ # @option options [String] :user
52
+ # The user-name to authenticate with.
53
+ #
54
+ # @option options [String] :password
55
+ # The password to authenticate with.
56
+ #
57
+ # @yield [session]
58
+ # If a block is given, it will be passed an ESMTP enabled session
59
+ # object.
60
+ #
61
+ # @yieldparam [Net::SMTP] session
62
+ # The ESMTP session.
63
+ #
64
+ # @return [Net::SMTP]
65
+ # The ESMTP enabled session.
66
+ #
67
+ def Net.esmtp_connect(host,options={})
68
+ session = Net.smtp_connect(host,options)
69
+ session.esmtp = true
70
+
71
+ yield session if block_given?
72
+ return session
73
+ end
74
+
75
+ #
76
+ # Starts an ESMTP session with the ESMTP enabled server.
77
+ #
78
+ # @param [String] host
79
+ # The host to connect to.
80
+ #
81
+ # @param [Hash] options
82
+ # Additional options.
83
+ #
84
+ # @yield [session]
85
+ # If a block is given, it will be passed an ESMTP enabled session
86
+ # object. After the block has returned, the session will be closed.
87
+ #
88
+ # @yieldparam [Net::SMTP] session
89
+ # The ESMTP session.
90
+ #
91
+ # @see Net.esmtp_connect
92
+ #
93
+ def Net.esmtp_session(host,options={})
94
+ Net.smtp_session(host,options) do |session|
95
+ session.esmtp = true
96
+
97
+ yield session if block_given?
98
+ end
99
+ end
100
+ end