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