ronin-support 1.0.7 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +28 -0
  3. data/ChangeLog.md +109 -7
  4. data/README.md +5 -1
  5. data/lib/ronin/support/archive/core_ext/file.rb +1 -1
  6. data/lib/ronin/support/archive/core_ext.rb +1 -1
  7. data/lib/ronin/support/archive/mixin.rb +1 -1
  8. data/lib/ronin/support/archive/tar/reader.rb +1 -1
  9. data/lib/ronin/support/archive/tar/writer.rb +1 -1
  10. data/lib/ronin/support/archive/tar.rb +1 -1
  11. data/lib/ronin/support/archive/zip/reader/entry.rb +1 -1
  12. data/lib/ronin/support/archive/zip/reader/statistics.rb +1 -1
  13. data/lib/ronin/support/archive/zip/reader.rb +1 -1
  14. data/lib/ronin/support/archive/zip/writer.rb +1 -1
  15. data/lib/ronin/support/archive/zip.rb +1 -1
  16. data/lib/ronin/support/archive.rb +1 -1
  17. data/lib/ronin/support/binary/array.rb +1 -1
  18. data/lib/ronin/support/binary/bit_flip/core_ext/integer.rb +1 -1
  19. data/lib/ronin/support/binary/bit_flip/core_ext/string.rb +1 -1
  20. data/lib/ronin/support/binary/bit_flip/core_ext.rb +1 -1
  21. data/lib/ronin/support/binary/bit_flip.rb +1 -1
  22. data/lib/ronin/support/binary/buffer.rb +1 -1
  23. data/lib/ronin/support/binary/byte_slice.rb +1 -1
  24. data/lib/ronin/support/binary/core_ext/array.rb +1 -1
  25. data/lib/ronin/support/binary/core_ext/float.rb +3 -2
  26. data/lib/ronin/support/binary/core_ext/integer.rb +3 -2
  27. data/lib/ronin/support/binary/core_ext/io.rb +1 -1
  28. data/lib/ronin/support/binary/core_ext/string.rb +1 -1
  29. data/lib/ronin/support/binary/core_ext.rb +1 -1
  30. data/lib/ronin/support/binary/cstring.rb +1 -1
  31. data/lib/ronin/support/binary/ctypes/aggregate_type.rb +1 -1
  32. data/lib/ronin/support/binary/ctypes/arch/arm/big_endian.rb +1 -1
  33. data/lib/ronin/support/binary/ctypes/arch/arm.rb +1 -1
  34. data/lib/ronin/support/binary/ctypes/arch/arm64/big_endian.rb +1 -1
  35. data/lib/ronin/support/binary/ctypes/arch/arm64.rb +1 -1
  36. data/lib/ronin/support/binary/ctypes/arch/mips/little_endian.rb +1 -1
  37. data/lib/ronin/support/binary/ctypes/arch/mips.rb +1 -1
  38. data/lib/ronin/support/binary/ctypes/arch/mips64/little_endian.rb +1 -1
  39. data/lib/ronin/support/binary/ctypes/arch/mips64.rb +1 -1
  40. data/lib/ronin/support/binary/ctypes/arch/ppc.rb +1 -1
  41. data/lib/ronin/support/binary/ctypes/arch/ppc64.rb +1 -1
  42. data/lib/ronin/support/binary/ctypes/arch/x86.rb +1 -1
  43. data/lib/ronin/support/binary/ctypes/arch/x86_64.rb +1 -1
  44. data/lib/ronin/support/binary/ctypes/arch.rb +1 -1
  45. data/lib/ronin/support/binary/ctypes/array_object_type.rb +1 -1
  46. data/lib/ronin/support/binary/ctypes/array_type.rb +1 -1
  47. data/lib/ronin/support/binary/ctypes/big_endian.rb +1 -1
  48. data/lib/ronin/support/binary/ctypes/char_type.rb +1 -1
  49. data/lib/ronin/support/binary/ctypes/char_types.rb +1 -1
  50. data/lib/ronin/support/binary/ctypes/enum_type.rb +1 -1
  51. data/lib/ronin/support/binary/ctypes/float32_type.rb +1 -1
  52. data/lib/ronin/support/binary/ctypes/float64_type.rb +1 -1
  53. data/lib/ronin/support/binary/ctypes/float_type.rb +1 -1
  54. data/lib/ronin/support/binary/ctypes/int16_type.rb +1 -1
  55. data/lib/ronin/support/binary/ctypes/int32_type.rb +1 -1
  56. data/lib/ronin/support/binary/ctypes/int64_type.rb +1 -1
  57. data/lib/ronin/support/binary/ctypes/int8_type.rb +1 -1
  58. data/lib/ronin/support/binary/ctypes/int_type.rb +1 -1
  59. data/lib/ronin/support/binary/ctypes/little_endian.rb +1 -1
  60. data/lib/ronin/support/binary/ctypes/mixin.rb +11 -5
  61. data/lib/ronin/support/binary/ctypes/native.rb +1 -1
  62. data/lib/ronin/support/binary/ctypes/network.rb +1 -1
  63. data/lib/ronin/support/binary/ctypes/object_type.rb +1 -1
  64. data/lib/ronin/support/binary/ctypes/os/android.rb +39 -0
  65. data/lib/ronin/support/binary/ctypes/os/apple_ios.rb +39 -0
  66. data/lib/ronin/support/binary/ctypes/os/bsd.rb +1 -1
  67. data/lib/ronin/support/binary/ctypes/os/freebsd.rb +1 -1
  68. data/lib/ronin/support/binary/ctypes/os/linux.rb +1 -1
  69. data/lib/ronin/support/binary/ctypes/os/macos.rb +1 -1
  70. data/lib/ronin/support/binary/ctypes/os/netbsd.rb +1 -1
  71. data/lib/ronin/support/binary/ctypes/os/openbsd.rb +1 -1
  72. data/lib/ronin/support/binary/ctypes/os/unix.rb +1 -1
  73. data/lib/ronin/support/binary/ctypes/os/windows.rb +1 -1
  74. data/lib/ronin/support/binary/ctypes/os.rb +8 -3
  75. data/lib/ronin/support/binary/ctypes/scalar_type.rb +1 -1
  76. data/lib/ronin/support/binary/ctypes/string_type.rb +1 -1
  77. data/lib/ronin/support/binary/ctypes/struct_object_type.rb +1 -1
  78. data/lib/ronin/support/binary/ctypes/struct_type.rb +1 -1
  79. data/lib/ronin/support/binary/ctypes/type.rb +1 -1
  80. data/lib/ronin/support/binary/ctypes/type_resolver.rb +7 -3
  81. data/lib/ronin/support/binary/ctypes/uint16_type.rb +1 -1
  82. data/lib/ronin/support/binary/ctypes/uint32_type.rb +1 -1
  83. data/lib/ronin/support/binary/ctypes/uint64_type.rb +1 -1
  84. data/lib/ronin/support/binary/ctypes/uint8_type.rb +1 -1
  85. data/lib/ronin/support/binary/ctypes/uint_type.rb +1 -1
  86. data/lib/ronin/support/binary/ctypes/unbounded_array_type.rb +1 -1
  87. data/lib/ronin/support/binary/ctypes/union_object_type.rb +1 -1
  88. data/lib/ronin/support/binary/ctypes/union_type.rb +1 -1
  89. data/lib/ronin/support/binary/ctypes.rb +16 -10
  90. data/lib/ronin/support/binary/memory.rb +1 -1
  91. data/lib/ronin/support/binary/packet.rb +1 -1
  92. data/lib/ronin/support/binary/stack.rb +1 -1
  93. data/lib/ronin/support/binary/stream/methods.rb +1 -1
  94. data/lib/ronin/support/binary/stream.rb +1 -1
  95. data/lib/ronin/support/binary/struct/member.rb +1 -1
  96. data/lib/ronin/support/binary/struct.rb +3 -2
  97. data/lib/ronin/support/binary/template.rb +1 -1
  98. data/lib/ronin/support/binary/unhexdump/core_ext/file.rb +1 -1
  99. data/lib/ronin/support/binary/unhexdump/core_ext/string.rb +1 -1
  100. data/lib/ronin/support/binary/unhexdump/core_ext.rb +1 -1
  101. data/lib/ronin/support/binary/unhexdump/parser.rb +1 -1
  102. data/lib/ronin/support/binary/unhexdump.rb +1 -1
  103. data/lib/ronin/support/binary/union.rb +1 -1
  104. data/lib/ronin/support/binary.rb +1 -1
  105. data/lib/ronin/support/cli/ansi.rb +1 -1
  106. data/lib/ronin/support/cli/io_shell/core_ext/io.rb +1 -1
  107. data/lib/ronin/support/cli/io_shell/core_ext.rb +1 -1
  108. data/lib/ronin/support/cli/io_shell.rb +1 -1
  109. data/lib/ronin/support/cli/printing.rb +1 -1
  110. data/lib/ronin/support/cli.rb +1 -1
  111. data/lib/ronin/support/compression/core_ext/file.rb +1 -1
  112. data/lib/ronin/support/compression/core_ext/string.rb +1 -1
  113. data/lib/ronin/support/compression/core_ext.rb +1 -1
  114. data/lib/ronin/support/compression/gzip/reader.rb +1 -1
  115. data/lib/ronin/support/compression/gzip/writer.rb +1 -1
  116. data/lib/ronin/support/compression/gzip.rb +1 -1
  117. data/lib/ronin/support/compression/mixin.rb +1 -1
  118. data/lib/ronin/support/compression/zlib.rb +1 -1
  119. data/lib/ronin/support/compression.rb +1 -1
  120. data/lib/ronin/support/core_ext/enumerable.rb +1 -1
  121. data/lib/ronin/support/core_ext/file.rb +1 -1
  122. data/lib/ronin/support/core_ext/integer.rb +1 -1
  123. data/lib/ronin/support/core_ext/ipaddr.rb +1 -1
  124. data/lib/ronin/support/core_ext/kernel.rb +1 -1
  125. data/lib/ronin/support/core_ext/string.rb +1 -1
  126. data/lib/ronin/support/core_ext.rb +1 -1
  127. data/lib/ronin/support/crypto/cert.rb +50 -8
  128. data/lib/ronin/support/crypto/cert_chain.rb +1 -1
  129. data/lib/ronin/support/crypto/cipher/aes.rb +1 -1
  130. data/lib/ronin/support/crypto/cipher/aes128.rb +1 -1
  131. data/lib/ronin/support/crypto/cipher/aes256.rb +1 -1
  132. data/lib/ronin/support/crypto/cipher.rb +1 -1
  133. data/lib/ronin/support/crypto/core_ext/file.rb +1 -1
  134. data/lib/ronin/support/crypto/core_ext/string.rb +1 -1
  135. data/lib/ronin/support/crypto/core_ext.rb +1 -1
  136. data/lib/ronin/support/crypto/hmac.rb +1 -1
  137. data/lib/ronin/support/crypto/key/dh.rb +1 -1
  138. data/lib/ronin/support/crypto/key/dsa.rb +1 -1
  139. data/lib/ronin/support/crypto/key/ec.rb +25 -1
  140. data/lib/ronin/support/crypto/key/methods.rb +1 -1
  141. data/lib/ronin/support/crypto/key/rsa.rb +1 -1
  142. data/lib/ronin/support/crypto/key.rb +48 -4
  143. data/lib/ronin/support/crypto/mixin.rb +1 -1
  144. data/lib/ronin/support/crypto/openssl.rb +1 -1
  145. data/lib/ronin/support/crypto.rb +1 -1
  146. data/lib/ronin/support/encoding/base16/core_ext/string.rb +1 -1
  147. data/lib/ronin/support/encoding/base16/core_ext.rb +1 -1
  148. data/lib/ronin/support/encoding/base16.rb +1 -1
  149. data/lib/ronin/support/encoding/base32/core_ext/string.rb +1 -1
  150. data/lib/ronin/support/encoding/base32/core_ext.rb +1 -1
  151. data/lib/ronin/support/encoding/base32.rb +1 -1
  152. data/lib/ronin/support/encoding/base36/core_ext/integer.rb +43 -0
  153. data/lib/ronin/support/encoding/base36/core_ext/string.rb +43 -0
  154. data/lib/ronin/support/encoding/base36/core_ext.rb +20 -0
  155. data/lib/ronin/support/encoding/base36.rb +67 -0
  156. data/lib/ronin/support/encoding/base62/core_ext/integer.rb +43 -0
  157. data/lib/ronin/support/encoding/base62/core_ext/string.rb +43 -0
  158. data/lib/ronin/support/encoding/base62/core_ext.rb +20 -0
  159. data/lib/ronin/support/encoding/base62.rb +93 -0
  160. data/lib/ronin/support/encoding/base64/core_ext/string.rb +1 -1
  161. data/lib/ronin/support/encoding/base64/core_ext.rb +1 -1
  162. data/lib/ronin/support/encoding/base64.rb +1 -1
  163. data/lib/ronin/support/encoding/c/core_ext/integer.rb +1 -1
  164. data/lib/ronin/support/encoding/c/core_ext/string.rb +1 -1
  165. data/lib/ronin/support/encoding/c/core_ext.rb +1 -1
  166. data/lib/ronin/support/encoding/c.rb +1 -1
  167. data/lib/ronin/support/encoding/core_ext/string.rb +1 -1
  168. data/lib/ronin/support/encoding/core_ext.rb +1 -1
  169. data/lib/ronin/support/encoding/hex/core_ext/integer.rb +1 -1
  170. data/lib/ronin/support/encoding/hex/core_ext/string.rb +1 -1
  171. data/lib/ronin/support/encoding/hex/core_ext.rb +1 -1
  172. data/lib/ronin/support/encoding/hex.rb +1 -1
  173. data/lib/ronin/support/encoding/html/core_ext/integer.rb +1 -1
  174. data/lib/ronin/support/encoding/html/core_ext/string.rb +1 -1
  175. data/lib/ronin/support/encoding/html/core_ext.rb +1 -1
  176. data/lib/ronin/support/encoding/html.rb +1 -1
  177. data/lib/ronin/support/encoding/http/core_ext/integer.rb +1 -1
  178. data/lib/ronin/support/encoding/http/core_ext/string.rb +1 -1
  179. data/lib/ronin/support/encoding/http/core_ext.rb +1 -1
  180. data/lib/ronin/support/encoding/http.rb +1 -1
  181. data/lib/ronin/support/encoding/js/core_ext/integer.rb +1 -1
  182. data/lib/ronin/support/encoding/js/core_ext/string.rb +1 -1
  183. data/lib/ronin/support/encoding/js/core_ext.rb +1 -1
  184. data/lib/ronin/support/encoding/js.rb +10 -16
  185. data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +1 -1
  186. data/lib/ronin/support/encoding/powershell/core_ext/string.rb +1 -1
  187. data/lib/ronin/support/encoding/powershell/core_ext.rb +1 -1
  188. data/lib/ronin/support/encoding/powershell.rb +1 -1
  189. data/lib/ronin/support/encoding/punycode/core_ext/string.rb +1 -1
  190. data/lib/ronin/support/encoding/punycode/core_ext.rb +1 -1
  191. data/lib/ronin/support/encoding/punycode.rb +1 -1
  192. data/lib/ronin/support/encoding/quoted_printable/core_ext/string.rb +1 -1
  193. data/lib/ronin/support/encoding/quoted_printable/core_ext.rb +1 -1
  194. data/lib/ronin/support/encoding/quoted_printable.rb +1 -1
  195. data/lib/ronin/support/encoding/ruby/core_ext/string.rb +1 -1
  196. data/lib/ronin/support/encoding/ruby/core_ext.rb +1 -1
  197. data/lib/ronin/support/encoding/ruby.rb +1 -1
  198. data/lib/ronin/support/encoding/shell/core_ext/integer.rb +1 -1
  199. data/lib/ronin/support/encoding/shell/core_ext/string.rb +1 -1
  200. data/lib/ronin/support/encoding/shell/core_ext.rb +1 -1
  201. data/lib/ronin/support/encoding/shell.rb +1 -1
  202. data/lib/ronin/support/encoding/smtp.rb +1 -1
  203. data/lib/ronin/support/encoding/sql/core_ext/string.rb +1 -1
  204. data/lib/ronin/support/encoding/sql/core_ext.rb +1 -1
  205. data/lib/ronin/support/encoding/sql.rb +1 -1
  206. data/lib/ronin/support/encoding/uri/core_ext/integer.rb +1 -1
  207. data/lib/ronin/support/encoding/uri/core_ext/string.rb +1 -1
  208. data/lib/ronin/support/encoding/uri/core_ext.rb +1 -1
  209. data/lib/ronin/support/encoding/uri.rb +1 -1
  210. data/lib/ronin/support/encoding/uuencoding/core_ext/string.rb +1 -1
  211. data/lib/ronin/support/encoding/uuencoding/core_ext.rb +1 -1
  212. data/lib/ronin/support/encoding/uuencoding.rb +1 -1
  213. data/lib/ronin/support/encoding/xml/core_ext/integer.rb +1 -1
  214. data/lib/ronin/support/encoding/xml/core_ext/string.rb +1 -1
  215. data/lib/ronin/support/encoding/xml/core_ext.rb +1 -1
  216. data/lib/ronin/support/encoding/xml.rb +1 -1
  217. data/lib/ronin/support/encoding.rb +7 -1
  218. data/lib/ronin/support/home.rb +1 -1
  219. data/lib/ronin/support/mixin.rb +1 -1
  220. data/lib/ronin/support/network/asn/dns_record.rb +1 -1
  221. data/lib/ronin/support/network/asn/list.rb +1 -1
  222. data/lib/ronin/support/network/asn/record.rb +1 -1
  223. data/lib/ronin/support/network/asn/record_set.rb +1 -1
  224. data/lib/ronin/support/network/asn.rb +1 -1
  225. data/lib/ronin/support/network/core_ext.rb +1 -1
  226. data/lib/ronin/support/network/dns/idn.rb +1 -1
  227. data/lib/ronin/support/network/dns/mixin.rb +1 -1
  228. data/lib/ronin/support/network/dns/resolver.rb +1 -1
  229. data/lib/ronin/support/network/dns.rb +1 -1
  230. data/lib/ronin/support/network/domain.rb +1 -1
  231. data/lib/ronin/support/network/email_address.rb +1 -1
  232. data/lib/ronin/support/network/esmtp/mixin.rb +1 -1
  233. data/lib/ronin/support/network/exceptions.rb +1 -1
  234. data/lib/ronin/support/network/ftp/mixin.rb +1 -1
  235. data/lib/ronin/support/network/host.rb +1 -1
  236. data/lib/ronin/support/network/http/cookie.rb +1 -1
  237. data/lib/ronin/support/network/http/core_ext/uri/http.rb +1 -1
  238. data/lib/ronin/support/network/http/core_ext.rb +1 -1
  239. data/lib/ronin/support/network/http/mixin.rb +42 -1
  240. data/lib/ronin/support/network/http/request.rb +86 -9
  241. data/lib/ronin/support/network/http/set_cookie.rb +1 -1
  242. data/lib/ronin/support/network/http/user_agents.rb +1 -1
  243. data/lib/ronin/support/network/http.rb +138 -6
  244. data/lib/ronin/support/network/imap/mixin.rb +1 -1
  245. data/lib/ronin/support/network/ip/mixin.rb +1 -1
  246. data/lib/ronin/support/network/ip.rb +42 -1
  247. data/lib/ronin/support/network/ip_range/cidr.rb +123 -1
  248. data/lib/ronin/support/network/ip_range/glob.rb +150 -10
  249. data/lib/ronin/support/network/ip_range/range.rb +34 -2
  250. data/lib/ronin/support/network/ip_range.rb +120 -5
  251. data/lib/ronin/support/network/mixin.rb +1 -11
  252. data/lib/ronin/support/network/packet.rb +1 -1
  253. data/lib/ronin/support/network/pop3/mixin.rb +1 -1
  254. data/lib/ronin/support/network/proxy.rb +1 -1
  255. data/lib/ronin/support/network/public_suffix/list.rb +1 -1
  256. data/lib/ronin/support/network/public_suffix/suffix.rb +1 -1
  257. data/lib/ronin/support/network/public_suffix/suffix_set.rb +1 -1
  258. data/lib/ronin/support/network/public_suffix.rb +1 -1
  259. data/lib/ronin/support/network/smtp/email.rb +1 -1
  260. data/lib/ronin/support/network/smtp/mixin.rb +1 -1
  261. data/lib/ronin/support/network/smtp.rb +1 -1
  262. data/lib/ronin/support/network/ssl/local_cert.rb +1 -1
  263. data/lib/ronin/support/network/ssl/local_key.rb +1 -1
  264. data/lib/ronin/support/network/ssl/mixin.rb +169 -400
  265. data/lib/ronin/support/network/ssl/openssl.rb +1 -1
  266. data/lib/ronin/support/network/ssl/proxy.rb +1 -1
  267. data/lib/ronin/support/network/ssl.rb +592 -13
  268. data/lib/ronin/support/network/tcp/mixin.rb +1 -1
  269. data/lib/ronin/support/network/tcp/proxy.rb +1 -1
  270. data/lib/ronin/support/network/tcp.rb +1 -1
  271. data/lib/ronin/support/network/telnet/mixin.rb +1 -1
  272. data/lib/ronin/support/network/telnet.rb +1 -1
  273. data/lib/ronin/support/network/tld/list.rb +1 -1
  274. data/lib/ronin/support/network/tld.rb +1 -1
  275. data/lib/ronin/support/network/tls/mixin.rb +174 -348
  276. data/lib/ronin/support/network/tls/proxy.rb +1 -1
  277. data/lib/ronin/support/network/tls.rb +492 -6
  278. data/lib/ronin/support/network/udp/mixin.rb +1 -1
  279. data/lib/ronin/support/network/udp/proxy.rb +1 -1
  280. data/lib/ronin/support/network/udp.rb +1 -1
  281. data/lib/ronin/support/network/unix/mixin.rb +1 -1
  282. data/lib/ronin/support/network/wildcard.rb +88 -0
  283. data/lib/ronin/support/network.rb +1 -1
  284. data/lib/ronin/support/path.rb +1 -1
  285. data/lib/ronin/support/text/core_ext/regexp.rb +1 -1
  286. data/lib/ronin/support/text/core_ext/string.rb +1 -1
  287. data/lib/ronin/support/text/core_ext.rb +1 -1
  288. data/lib/ronin/support/text/entropy/core_ext/string.rb +1 -1
  289. data/lib/ronin/support/text/entropy/core_ext.rb +1 -1
  290. data/lib/ronin/support/text/entropy.rb +1 -1
  291. data/lib/ronin/support/text/erb/mixin.rb +1 -1
  292. data/lib/ronin/support/text/erb.rb +1 -1
  293. data/lib/ronin/support/text/homoglyph/core_ext/string.rb +1 -1
  294. data/lib/ronin/support/text/homoglyph/core_ext.rb +1 -1
  295. data/lib/ronin/support/text/homoglyph/exceptions.rb +1 -1
  296. data/lib/ronin/support/text/homoglyph/table.rb +1 -1
  297. data/lib/ronin/support/text/homoglyph.rb +1 -1
  298. data/lib/ronin/support/text/mixin.rb +1 -1
  299. data/lib/ronin/support/text/patterns/credentials.rb +1 -1
  300. data/lib/ronin/support/text/patterns/crypto.rb +1 -1
  301. data/lib/ronin/support/text/patterns/file_system.rb +1 -1
  302. data/lib/ronin/support/text/patterns/language.rb +1 -1
  303. data/lib/ronin/support/text/patterns/network/public_suffix.rb +1 -1
  304. data/lib/ronin/support/text/patterns/network.rb +1 -1
  305. data/lib/ronin/support/text/patterns/numeric.rb +1 -1
  306. data/lib/ronin/support/text/patterns/pii.rb +1 -1
  307. data/lib/ronin/support/text/patterns/source_code.rb +1 -1
  308. data/lib/ronin/support/text/patterns.rb +1 -1
  309. data/lib/ronin/support/text/random/mixin.rb +1 -1
  310. data/lib/ronin/support/text/random.rb +1 -1
  311. data/lib/ronin/support/text/typo/core_ext/string.rb +1 -1
  312. data/lib/ronin/support/text/typo/core_ext.rb +1 -1
  313. data/lib/ronin/support/text/typo/exceptions.rb +1 -1
  314. data/lib/ronin/support/text/typo/generator.rb +1 -1
  315. data/lib/ronin/support/text/typo.rb +1 -1
  316. data/lib/ronin/support/text.rb +1 -1
  317. data/lib/ronin/support/version.rb +2 -2
  318. data/lib/ronin/support.rb +1 -1
  319. metadata +13 -2
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
- # Copyright (c) 2006-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
4
4
  #
5
5
  # Ronin Support is free software: you can redistribute it and/or modify
6
6
  # it under the terms of the GNU Lesser General Public License as published
@@ -16,6 +16,7 @@
16
16
  # along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
17
17
  #
18
18
 
19
+ require 'ronin/support/network/tls'
19
20
  require 'ronin/support/network/ssl/mixin'
20
21
 
21
22
  module Ronin
@@ -29,45 +30,56 @@ module Ronin
29
30
  include SSL::Mixin
30
31
 
31
32
  #
32
- # Creates a new TLS Context.
33
+ # @!macro context_kwargs
34
+ # @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :version
35
+ # The TLS version to use.
33
36
  #
34
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
35
- # The TLS version to use.
37
+ # @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :min_version
38
+ # The minimum TLS version to use.
36
39
  #
37
- # @param [Hash{Symbol => Object}] kwargs
38
- # Additional keyword arguments for {SSL.context}.
40
+ # @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :max_version
41
+ # The maximum TLS version to use.
42
+ #
43
+ # @option kwargs [Symbol, Boolean] :verify
44
+ # Specifies whether to verify the SSL certificate.
45
+ # May be one of the following:
39
46
  #
40
- # @option kwargs [Symbol, Boolean] :verify
41
- # Specifies whether to verify the SSL certificate.
42
- # May be one of the following:
47
+ # * `:none`
48
+ # * `:peer`
49
+ # * `:fail_if_no_peer_cert`
50
+ # * `:client_once`
43
51
  #
44
- # * `:none`
45
- # * `:peer`
46
- # * `:fail_if_no_peer_cert`
47
- # * `:client_once`
52
+ # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
53
+ # The RSA key to use for the TLS context.
48
54
  #
49
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
50
- # The RSA key to use for the SSL context.
55
+ # @option kwargs [String] :key_file
56
+ # The path to the TLS `.key` file.
51
57
  #
52
- # @option kwargs [String] :key_file
53
- # The path to the SSL `.key` file.
58
+ # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
59
+ # The X509 certificate to use for the TLS context.
54
60
  #
55
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
56
- # The X509 certificate to use for the SSL context.
61
+ # @option kwargs [String] :cert_file
62
+ # The path to the TLS `.crt` file.
57
63
  #
58
- # @option kwargs [String] :cert_file
59
- # The path to the SSL `.crt` file.
64
+ # @option kwargs [String] :ca_bundle
65
+ # Path to the CA certificate file or directory.
66
+ #
67
+
68
+ #
69
+ # Creates a new TLS Context.
70
+ #
71
+ # @param [Hash{Symbol => Object}] kwargs
72
+ # Additional keyword arguments for {TLS.context}.
60
73
  #
61
- # @option kwargs [String] :ca_bundle
62
- # Path to the CA certificate file or directory.
74
+ # @!macro context_kwargs
63
75
  #
64
76
  # @return [OpenSSL::SSL::SSLContext]
65
77
  # The newly created SSL Context.
66
78
  #
67
79
  # @api semipublic
68
80
  #
69
- def tls_context(version: 1.2, **kwargs)
70
- ssl_context(version: version, **kwargs)
81
+ def tls_context(**kwargs)
82
+ TLS.context(**kwargs)
71
83
  end
72
84
 
73
85
  #
@@ -76,45 +88,31 @@ module Ronin
76
88
  # @param [TCPSocket] socket
77
89
  # The existing TCP socket.
78
90
  #
79
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
80
- # The TLS version to use.
81
- #
82
91
  # @param [Hash{Symbol => Object}] kwargs
83
- # Additional keyword arguments for {#ssl_context}.
84
- #
85
- # @option kwargs [Symbol, Boolean] :verify
86
- # Specifies whether to verify the SSL certificate.
87
- # May be one of the following:
88
- #
89
- # * `:none`
90
- # * `:peer`
91
- # * `:fail_if_no_peer_cert`
92
- # * `:client_once`
93
- #
94
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
95
- # The RSA key to use for the SSL context.
96
- #
97
- # @option kwargs [String] :key_file
98
- # The path to the SSL `.key` file.
92
+ # Additional keyword arguments for {TLS.socket}.
99
93
  #
100
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
101
- # The X509 certificate to use for the SSL context.
102
- #
103
- # @option kwargs [String] :cert_file
104
- # The path to the SSL `.crt` file.
105
- #
106
- # @option kwargs [String] :ca_bundle
107
- # Path to the CA certificate file or directory.
94
+ # @!macro context_kwargs
108
95
  #
109
96
  # @return [OpenSSL::SSL::SSLSocket]
110
97
  # The new SSL Socket.
111
98
  #
112
99
  # @api public
113
100
  #
114
- def tls_socket(socket, version: 1.2, **kwargs)
115
- ssl_socket(socket,version: version, **kwargs)
101
+ def tls_socket(socket,**kwargs)
102
+ TLS.socket(socket,**kwargs)
116
103
  end
117
104
 
105
+ #
106
+ # @!macro connect_kwargs
107
+ # @option kwargs [String] :bind_host
108
+ # The local host to bind to.
109
+ #
110
+ # @option kwargs [Integer] :bind_port
111
+ # The local port to bind to.
112
+ #
113
+ # @!macro context_kwargs
114
+ #
115
+
118
116
  #
119
117
  # Tests whether a remote SSLed TCP port is open.
120
118
  #
@@ -124,44 +122,10 @@ module Ronin
124
122
  # @param [Integer] port
125
123
  # The port to connect to.
126
124
  #
127
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
128
- # The TLS version to use.
129
- #
130
125
  # @param [Hash{Symbol => Object}] kwargs
131
- # Additional keyword arguments for {#ssl_connect}.
132
- #
133
- # @option kwargs [String] :bind_host
134
- # The local host to bind to.
135
- #
136
- # @option kwargs [Integer] :bind_port
137
- # The local port to bind to.
138
- #
139
- # @option kwargs [Integer] :timeout (5)
140
- # The maximum time to attempt connecting.
141
- #
142
- # @option options [Symbol, Boolean] :verify
143
- # Specifies whether to verify the SSL certificate.
144
- # May be one of the following:
145
- #
146
- # * `:none`
147
- # * `:peer`
148
- # * `:fail_if_no_peer_cert`
149
- # * `:client_once`
150
- #
151
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
152
- # The RSA key to use for the SSL context.
153
- #
154
- # @option kwargs [String] :key_file
155
- # The path to the SSL `.key` file.
156
- #
157
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
158
- # The X509 certificate to use for the SSL context.
159
- #
160
- # @option kwargs [String] :cert_file
161
- # The path to the SSL `.crt` file.
126
+ # Additional keyword arguments for {#tls_connect}.
162
127
  #
163
- # @option kwargs [String] :ca_bundle
164
- # Path to the CA certificate file or directory.
128
+ # @!macro connect_kwargs
165
129
  #
166
130
  # @return [Boolean, nil]
167
131
  # Specifies whether the remote SSLed TCP port is open.
@@ -176,8 +140,10 @@ module Ronin
176
140
  #
177
141
  # @api public
178
142
  #
179
- def tls_open?(host,port, version: 1.2, **kwargs)
180
- ssl_open?(host,port, version: version, **kwargs)
143
+ # @see TLS.open?
144
+ #
145
+ def tls_open?(host,port,**kwargs)
146
+ TLS.open?(host,port,**kwargs)
181
147
  end
182
148
 
183
149
  #
@@ -189,41 +155,10 @@ module Ronin
189
155
  # @param [Integer] port
190
156
  # The port to connect to.
191
157
  #
192
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
193
- # The TLS version to use.
194
- #
195
158
  # @param [Hash{Symbol => Object}] kwargs
196
159
  # Additional keyword arguments for {#tls_socket}.
197
160
  #
198
- # @option kwargs [String] :bind_host
199
- # The local host to bind to.
200
- #
201
- # @option kwargs [Integer] :bind_port
202
- # The local port to bind to.
203
- #
204
- # @option kwargs [Symbol, Boolean] :verify
205
- # Specifies whether to verify the SSL certificate.
206
- # May be one of the following:
207
- #
208
- # * `:none`
209
- # * `:peer`
210
- # * `:fail_if_no_peer_cert`
211
- # * `:client_once`
212
- #
213
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
214
- # The RSA key to use for the SSL context.
215
- #
216
- # @option kwargs [String] :key_file
217
- # The path to the SSL `.key` file.
218
- #
219
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
220
- # The X509 certificate to use for the SSL context.
221
- #
222
- # @option kwargs [String] :cert_file
223
- # The path to the SSL `.crt` file.
224
- #
225
- # @option kwargs [String] :ca_bundle
226
- # Path to the CA certificate file or directory.
161
+ # @!macro connect_kwargs
227
162
  #
228
163
  # @yield [tls_socket]
229
164
  # The given block will be passed the new SSL socket. Once the block
@@ -250,8 +185,10 @@ module Ronin
250
185
  #
251
186
  # @api public
252
187
  #
253
- def tls_connect(host,port, version: 1.2, **kwargs, &block)
254
- ssl_connect(host,port, version: version, **kwargs, &block)
188
+ # @see TLS.connect
189
+ #
190
+ def tls_connect(host,port,**kwargs, &block)
191
+ TLS.connect(host,port,**kwargs, &block)
255
192
  end
256
193
 
257
194
  #
@@ -266,52 +203,23 @@ module Ronin
266
203
  # @param [Integer] port
267
204
  # The port to connect to.
268
205
  #
269
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
270
- # The TLS version to use.
271
- #
272
206
  # @param [Hash{Symbol => Object}] kwargs
273
207
  # Additional keyword arguments for {#tls_connect}.
274
208
  #
275
- # @option kwargs [String] :bind_host
276
- # The local host to bind to.
277
- #
278
- # @option kwargs [Integer] :bind_port
279
- # The local port to bind to.
280
- #
281
- # @option kwargs [Symbol, Boolean] :verify
282
- # Specifies whether to verify the SSL certificate.
283
- # May be one of the following:
284
- #
285
- # * `:none`
286
- # * `:peer`
287
- # * `:fail_if_no_peer_cert`
288
- # * `:client_once`
209
+ # @!macro connect_kwargs
289
210
  #
290
211
  # @yield [tls_socket]
291
- # The given block will be passed the newly created SSL Socket.
292
- #
293
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
294
- # The RSA key to use for the SSL context.
295
- #
296
- # @option kwargs [String] :key_file
297
- # The path to the SSL `.key` file.
298
- #
299
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
300
- # The X509 certificate to use for the SSL context.
301
- #
302
- # @option kwargs [String] :cert_file
303
- # The path to the SSL `.crt` file.
304
- #
305
- # @option kwargs [String] :ca_bundle
306
- # Path to the CA certificate file or directory.
212
+ # The given block will be passed the newly created TLS Socket.
307
213
  #
308
214
  # @yieldparam [OpenSSL::SSL::SSLSocket] tls_socket
309
215
  # The newly created SSL Socket.
310
216
  #
311
217
  # @api public
312
218
  #
313
- def tls_connect_and_send(data,host,port, version: 1.2, **kwargs, &block)
314
- ssl_connect_and_send(data,host,port, version: version, **kwargs, &block)
219
+ # @see TLS.connect_and_send
220
+ #
221
+ def tls_connect_and_send(data,host,port,**kwargs, &block)
222
+ TLS.connect_and_send(data,host,port,**kwargs, &block)
315
223
  end
316
224
 
317
225
  #
@@ -323,50 +231,18 @@ module Ronin
323
231
  # @param [Integer] port
324
232
  # The port to connect to.
325
233
  #
326
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
327
- # The TLS version to use.
328
- #
329
234
  # @param [Hash{Symbol => Object}] kwargs
330
235
  # Additional keyword arguments for {#tls_connect}.
331
236
  #
332
- # @option kwargs [String] :bind_host
333
- # The local host to bind to.
334
- #
335
- # @option kwargs [Integer] :bind_port
336
- # The local port to bind to.
337
- #
338
- # @option kwargs [Symbol, Boolean] :verify
339
- # Specifies whether to verify the SSL certificate.
340
- # May be one of the following:
341
- #
342
- # * `:none`
343
- # * `:peer`
344
- # * `:fail_if_no_peer_cert`
345
- # * `:client_once`
346
- #
347
- # @yield [tls_socket]
348
- # The given block will be passed the newly created SSL Socket.
349
- #
350
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
351
- # The RSA key to use for the SSL context.
352
- #
353
- # @option kwargs [String] :key_file
354
- # The path to the SSL `.key` file.
355
- #
356
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
357
- # The X509 certificate to use for the SSL context.
358
- #
359
- # @option kwargs [String] :cert_file
360
- # The path to the SSL `.crt` file.
361
- #
362
- # @option kwargs [String] :ca_bundle
363
- # Path to the CA certificate file or directory.
237
+ # @!macro connect_kwargs
364
238
  #
365
239
  # @return [OpenSSL::X509::Certificate]
366
240
  # The server's certificate.
367
241
  #
368
- def tls_cert(host,port, version: 1.2, **kwargs)
369
- ssl_cert(host,port, version: version, **kwargs)
242
+ # @see TLS.get_cert
243
+ #
244
+ def tls_cert(host,port,**kwargs)
245
+ TLS.get_cert(host,port,**kwargs)
370
246
  end
371
247
 
372
248
  #
@@ -379,41 +255,10 @@ module Ronin
379
255
  # @param [Integer] port
380
256
  # The port to connect to.
381
257
  #
382
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
383
- # The TLS version to use.
384
- #
385
258
  # @param [Hash{Symbol => Object}] kwargs
386
259
  # Additional keyword arguments for {#tls_connect}.
387
260
  #
388
- # @option kwargs [String] :bind_host
389
- # The local host to bind to.
390
- #
391
- # @option kwargs [Integer] :bind_port
392
- # The local port to bind to.
393
- #
394
- # @option kwargs [Symbol, Boolean] :verify
395
- # Specifies whether to verify the SSL certificate.
396
- # May be one of the following:
397
- #
398
- # * `:none`
399
- # * `:peer`
400
- # * `:fail_if_no_peer_cert`
401
- # * `:client_once`
402
- #
403
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
404
- # The RSA key to use for the SSL context.
405
- #
406
- # @option kwargs [String] :key_file
407
- # The path to the SSL `.key` file.
408
- #
409
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
410
- # The X509 certificate to use for the SSL context.
411
- #
412
- # @option kwargs [String] :cert_file
413
- # The path to the SSL `.crt` file.
414
- #
415
- # @option kwargs [String] :ca_bundle
416
- # Path to the CA certificate file or directory.
261
+ # @!macro connect_kwargs
417
262
  #
418
263
  # @yield [banner]
419
264
  # If a block is given, it will be passed the grabbed banner.
@@ -430,8 +275,10 @@ module Ronin
430
275
  #
431
276
  # @api public
432
277
  #
433
- def tls_banner(host,port, version: 1.2, **kwargs, &block)
434
- ssl_banner(host,port, version: version, **kwargs, &block)
278
+ # @see TLS.banner
279
+ #
280
+ def tls_banner(host,port,**kwargs, &block)
281
+ TLS.banner(host,port,**kwargs, &block)
435
282
  end
436
283
 
437
284
  #
@@ -447,41 +294,10 @@ module Ronin
447
294
  # @param [Integer] port
448
295
  # The port to connect to.
449
296
  #
450
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
451
- # The TLS version to use.
452
- #
453
297
  # @param [Hash{Symbol => Object}] kwargs
454
298
  # Additional keyword arguments for {#tls_connect}.
455
299
  #
456
- # @option kwargs [String] :bind_host
457
- # The local host to bind to.
458
- #
459
- # @option kwargs [Integer] :bind_port
460
- # The local port to bind to.
461
- #
462
- # @option kwargs [Symbol, Boolean] :verify
463
- # Specifies whether to verify the SSL certificate.
464
- # May be one of the following:
465
- #
466
- # * `:none`
467
- # * `:peer`
468
- # * `:fail_if_no_peer_cert`
469
- # * `:client_once`
470
- #
471
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
472
- # The RSA key to use for the SSL context.
473
- #
474
- # @option kwargs [String] :key_file
475
- # The path to the SSL `.key` file.
476
- #
477
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
478
- # The X509 certificate to use for the SSL context.
479
- #
480
- # @option kwargs [String] :cert_file
481
- # The path to the SSL `.crt` file.
482
- #
483
- # @option kwargs [String] :ca_bundle
484
- # Path to the CA certificate file or directory.
300
+ # @!macro connect_kwargs
485
301
  #
486
302
  # @return [true]
487
303
  # The data was successfully sent.
@@ -493,82 +309,119 @@ module Ronin
493
309
  #
494
310
  # @api public
495
311
  #
496
- def tls_send(data,host,port, version: 1.2, **kwargs)
497
- ssl_send(data,host,port, version: version, **kwargs)
312
+ # @see TLS.send
313
+ #
314
+ def tls_send(data,host,port,**kwargs)
315
+ TLS.send(data,host,port,**kwargs)
498
316
  end
499
317
 
318
+ #
319
+ # @!macro server_context_kwargs
320
+ # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key (SSL.key)
321
+ # The RSA key to use for the TLS context.
322
+ #
323
+ # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert (SSL.cert)
324
+ # The X509 certificate to use for the TLS context.
325
+ #
326
+ # @!macro context_kwargs
327
+ #
328
+
500
329
  #
501
330
  # Accepts an SSL session from an existing TCP socket.
502
331
  #
503
332
  # @param [TCPSocket] socket
504
333
  # The existing TCP socket.
505
334
  #
506
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
507
- # The TLS version to use.
508
- #
509
335
  # @param [Hash{Symbol => Object}] kwargs
510
336
  # Additional keyword arguments for {#tls_socket}.
511
337
  #
512
- # @option kwargs [Symbol, Boolean] :verify
513
- # Specifies whether to verify the SSL certificate.
514
- # May be one of the following:
515
- #
516
- # * `:none`
517
- # * `:peer`
518
- # * `:fail_if_no_peer_cert`
519
- # * `:client_once`
338
+ # @!macro server_context_kwargs
520
339
  #
521
340
  # @return [OpenSSL::SSL::SSLSocket]
522
341
  # The new SSL Socket.
523
342
  #
524
343
  # @api public
525
344
  #
526
- def tls_server_socket(socket, version: 1.2, **kwargs)
527
- ssl_server_socket(socket, version: version, **kwargs)
345
+ # @see TLS.server_socket
346
+ #
347
+ def tls_server_socket(socket,**kwargs)
348
+ TLS.server_socket(socket,**kwargs)
528
349
  end
529
350
 
530
351
  #
531
- # Creates a new SSL socket listening on a given host and port,
532
- # accepting clients in a loop.
352
+ # @!macro server_kwargs
353
+ # @option kwargs [Integer] :port (0)
354
+ # The local port to listen on.
355
+ #
356
+ # @option kwargs [String, nil] :host
357
+ # The host to bind to.
358
+ #
359
+ # @option kwargs [Integer] :backlog (5)
360
+ # The maximum backlog of pending connections.
361
+ #
362
+ # @!macro server_context_kwargs
533
363
  #
534
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
535
- # The TLS version to use.
364
+
365
+ #
366
+ # Creates a new TLS server listening on a given host and port.
536
367
  #
537
368
  # @param [Hash{Symbol => Object}] kwargs
538
- # Additional keyword arguments for {#tls_server_socket}.
369
+ # Additional keyword arguments for {#tls_context}.
539
370
  #
540
- # @option kwargs [Integer] :port
541
- # The local port to listen on.
371
+ # @!macro server_kwargs
542
372
  #
543
- # @option kwargs [String] :host
544
- # The host to bind to.
373
+ # @yield [server]
374
+ # The given block will be passed the newly created SSL server.
545
375
  #
546
- # @option kwargs [Integer] :backlog (5)
547
- # The maximum backlog of pending connections.
376
+ # @yieldparam [OpenSSL::SSL::SSLServer] server
377
+ # The newly created SSL server.
548
378
  #
549
- # @option kwargs [Symbol, Boolean] :verify
550
- # Specifies whether to verify the SSL certificate.
551
- # May be one of the following:
379
+ # @return [OpenSSL::SSL::SSLServer]
380
+ # The newly created SSL server.
552
381
  #
553
- # * `:none`
554
- # * `:peer`
555
- # * `:fail_if_no_peer_cert`
556
- # * `:client_once`
382
+ # @api public
557
383
  #
558
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key (Network::SSL.key)
559
- # The RSA key to use for the SSL context.
384
+ # @since 1.1.0
560
385
  #
561
- # @option kwargs [String] :key_file
562
- # The path to the SSL `.key` file.
386
+ def tls_server(**kwargs, &block)
387
+ TLS.server(**kwargs, &block)
388
+ end
389
+
390
+ #
391
+ # Creates a new temporary TLS server listening on a given host and
392
+ # port.
563
393
  #
564
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert (Network::SSL.cert)
565
- # The X509 certificate to use for the SSL context.
394
+ # @param [Hash{Symbol => Object}] kwargs
395
+ # Additional keyword arguments for {#tls_context}.
566
396
  #
567
- # @option kwargs [String] :cert_file
568
- # The path to the SSL `.crt` file.
397
+ # @!macro server_kwargs
569
398
  #
570
- # @option kwargs [String] :ca_bundle
571
- # Path to the CA certificate file or directory.
399
+ # @yield [server]
400
+ # The given block will be passed the newly created SSL server.
401
+ #
402
+ # @yieldparam [OpenSSL::SSL::SSLServer] server
403
+ # The newly created SSL server. Once the block has finished,
404
+ # the server will be closed.
405
+ #
406
+ # @return [OpenSSL::SSL::SSLServer]
407
+ # The newly created SSL server.
408
+ #
409
+ # @api public
410
+ #
411
+ # @since 1.1.0
412
+ #
413
+ def tls_server_session(**kwargs, &block)
414
+ TLS.server_session(**kwargs, &block)
415
+ end
416
+
417
+ #
418
+ # Creates a new SSL socket listening on a given host and port,
419
+ # accepting clients in a loop.
420
+ #
421
+ # @param [Hash{Symbol => Object}] kwargs
422
+ # Additional keyword arguments for {#tls_server_socket}.
423
+ #
424
+ # @!macro server_kwargs
572
425
  #
573
426
  # @yield [client]
574
427
  # The given block will be passed the newly connected client.
@@ -590,54 +443,20 @@ module Ronin
590
443
  #
591
444
  # @api public
592
445
  #
593
- def tls_server_loop(version: 1.2, **kwargs, &block)
594
- ssl_server_loop(version: 1.2, **kwargs, &block)
446
+ # @see TLS.server_loop
447
+ #
448
+ def tls_server_loop(**kwargs,&block)
449
+ TLS.server_loop(**kwargs,&block)
595
450
  end
596
451
 
597
452
  #
598
453
  # Creates a new SSL socket listening on a given host and port,
599
454
  # accepts only one client and then stops listening.
600
455
  #
601
- # @param [1, 1.1, 1.2, String, Symbol, nil] version
602
- # The TLS version to use.
603
- #
604
456
  # @param [Hash{Symbol => Object}] kwargs
605
457
  # Additional keyword arguments for {#tls_server_socket}.
606
458
  #
607
- # @option kwargs [Integer] :port
608
- # The local port to listen on.
609
- #
610
- # @option kwargs [String] :host
611
- # The host to bind to.
612
- #
613
- # @option kwargs [Symbol, Boolean] :verify
614
- # Specifies whether to verify the SSL certificate.
615
- # May be one of the following:
616
- #
617
- # * `:none`
618
- # * `:peer`
619
- # * `:fail_if_no_peer_cert`
620
- # * `:client_once`
621
- #
622
- # @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key (Network::SSL.key)
623
- # The RSA key to use for the SSL context.
624
- #
625
- # @option kwargs [String] :key_file
626
- # The path to the SSL `.key` file.
627
- #
628
- # @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert (Network::SSL.cert)
629
- # The X509 certificate to use for the SSL context.
630
- #
631
- # @option kwargs [String] :cert_file
632
- # The path to the SSL `.crt` file.
633
- #
634
- # @option kwargs [String] :ca_bundle
635
- # Path to the CA certificate file or directory.
636
- #
637
- # @example
638
- # tls_accept(1337) do |client|
639
- # client.puts 'lol'
640
- # end
459
+ # @!macro server_kwargs
641
460
  #
642
461
  # @yield [client]
643
462
  # The given block will be passed the newly connected client.
@@ -650,6 +469,11 @@ module Ronin
650
469
  # @return [nil]
651
470
  #
652
471
  # @example
472
+ # tls_accept(1337) do |client|
473
+ # client.puts 'lol'
474
+ # end
475
+ #
476
+ # @example Using a self-signed certificate:
653
477
  # # $ openssl genrsa -out ssl.key 1024
654
478
  # # $ openssl req -new -key ssl.key -x509 -days 3653 -out ssl.crt
655
479
  # # $ cat ssl.key ssl.crt > ssl.pem
@@ -660,8 +484,10 @@ module Ronin
660
484
  #
661
485
  # @api public
662
486
  #
663
- def tls_accept(version: 1.2, **kwargs, &block)
664
- ssl_accept(version: version, **kwargs, &block)
487
+ # @see TLS.accept
488
+ #
489
+ def tls_accept(**kwargs, &block)
490
+ TLS.accept(**kwargs, &block)
665
491
  end
666
492
  end
667
493
  end