ronin-support 1.0.6 → 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 +28 -0
- data/ChangeLog.md +111 -0
- 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 +1 -1
- 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 +138 -6
- 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 +123 -1
- data/lib/ronin/support/network/ip_range/glob.rb +150 -10
- data/lib/ronin/support/network/ip_range/range.rb +34 -2
- data/lib/ronin/support/network/ip_range.rb +120 -5
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +13 -2
@@ -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
|
@@ -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
|
@@ -29,21 +29,507 @@ module Ronin
|
|
29
29
|
include SSL
|
30
30
|
|
31
31
|
#
|
32
|
-
#
|
32
|
+
# @!macro context_kwargs
|
33
|
+
# @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :version
|
34
|
+
# The SSL version to use.
|
33
35
|
#
|
34
|
-
#
|
35
|
-
#
|
36
|
+
# @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :min_version
|
37
|
+
# The minimum SSL version to use.
|
38
|
+
#
|
39
|
+
# @option kwargs [1, 1.1, 1.2, 1.3, Symbol, nil] :max_version
|
40
|
+
# The maximum SSL version to use.
|
41
|
+
#
|
42
|
+
# @option kwargs [Symbol, Boolean] :verify
|
43
|
+
# Specifies whether to verify the SSL certificate.
|
44
|
+
# May be one of the following:
|
45
|
+
#
|
46
|
+
# * `:none`
|
47
|
+
# * `:peer`
|
48
|
+
# * `:fail_if_no_peer_cert`
|
49
|
+
# * `:client_once`
|
50
|
+
#
|
51
|
+
# @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key
|
52
|
+
# The RSA key to use for the SSL context.
|
53
|
+
#
|
54
|
+
# @option kwargs [String] :key_file
|
55
|
+
# The path to the SSL `.key` file.
|
56
|
+
#
|
57
|
+
# @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert
|
58
|
+
# The X509 certificate to use for the SSL context.
|
59
|
+
#
|
60
|
+
# @option kwargs [String] :cert_file
|
61
|
+
# The path to the SSL `.crt` file.
|
62
|
+
#
|
63
|
+
# @option kwargs [String] :ca_bundle
|
64
|
+
# Path to the CA certificate file or directory.
|
65
|
+
#
|
66
|
+
|
67
|
+
#
|
68
|
+
# Creates a new TLS context.
|
69
|
+
#
|
70
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
71
|
+
# The minimum TLS version to use.
|
36
72
|
#
|
37
73
|
# @param [Hash{Symbol => Object}] kwargs
|
38
74
|
# Additional keyword arguments for {SSL.context}.
|
39
75
|
#
|
76
|
+
# @!macro context_kwargs
|
77
|
+
#
|
40
78
|
# @return [OpenSSL::SSL::SSLContext]
|
41
79
|
# The newly created SSL Context.
|
42
80
|
#
|
43
81
|
# @api semipublic
|
44
82
|
#
|
45
|
-
def self.context(
|
46
|
-
SSL.context(
|
83
|
+
def self.context(min_version: 1, **kwargs)
|
84
|
+
SSL.context(min_version: min_version, **kwargs)
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Initiates an SSL session with an existing TCP socket.
|
89
|
+
#
|
90
|
+
# @param [TCPSocket] socket
|
91
|
+
# The existing TCP socket.
|
92
|
+
#
|
93
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
94
|
+
# The minimum TLS version to use.
|
95
|
+
#
|
96
|
+
# @param [Hash{Symbol => Object}] kwargs
|
97
|
+
# Additional keyword arguments for {SSL.context}.
|
98
|
+
#
|
99
|
+
# @!macro context_kwargs
|
100
|
+
#
|
101
|
+
# @return [OpenSSL::SSL::SSLSocket]
|
102
|
+
# the new SSL Socket.
|
103
|
+
#
|
104
|
+
# @api public
|
105
|
+
#
|
106
|
+
# @since 1.1.0
|
107
|
+
#
|
108
|
+
def self.socket(socket, min_version: 1, **kwargs)
|
109
|
+
SSL.socket(socket,min_version: min_version, **kwargs)
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# @!macro connect_kwargs
|
114
|
+
# @option kwargs [String] :bind_host
|
115
|
+
# The local host to bind to.
|
116
|
+
#
|
117
|
+
# @option kwargs [Integer] :bind_port
|
118
|
+
# The local port to bind to.
|
119
|
+
#
|
120
|
+
# @!macro context_kwargs
|
121
|
+
#
|
122
|
+
|
123
|
+
#
|
124
|
+
# Tests whether a remote SSLed TCP port is open.
|
125
|
+
#
|
126
|
+
# @param [String] host
|
127
|
+
# The host to connect to.
|
128
|
+
#
|
129
|
+
# @param [Integer] port
|
130
|
+
# The port to connect to.
|
131
|
+
#
|
132
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
133
|
+
# The minimum TLS version to use.
|
134
|
+
#
|
135
|
+
# @param [Hash{Symbol => Object}] kwargs
|
136
|
+
# Additional keyword arguments for {SSL.connect}.
|
137
|
+
#
|
138
|
+
# @!macro connect_kwargs
|
139
|
+
#
|
140
|
+
# @return [Boolean, nil]
|
141
|
+
# Specifies whether the remote SSLed TCP port is open.
|
142
|
+
# If the connection was not accepted, `nil` will be returned.
|
143
|
+
#
|
144
|
+
# @example
|
145
|
+
# tls_open?('www.bankofamerica.com',443)
|
146
|
+
#
|
147
|
+
# @example Using a timeout:
|
148
|
+
# tls_open?('example.com',80, timeout: 5)
|
149
|
+
# # => nil
|
150
|
+
#
|
151
|
+
# @api public
|
152
|
+
#
|
153
|
+
# @since 1.1.0
|
154
|
+
#
|
155
|
+
def self.open?(host,port, min_version: 1, **kwargs)
|
156
|
+
SSL.open?(host,port, min_version: min_version, **kwargs)
|
157
|
+
end
|
158
|
+
|
159
|
+
#
|
160
|
+
# Establishes a SSL connection.
|
161
|
+
#
|
162
|
+
# @param [String] host
|
163
|
+
# The host to connect to.
|
164
|
+
#
|
165
|
+
# @param [Integer] port
|
166
|
+
# The port to connect to.
|
167
|
+
#
|
168
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
169
|
+
# The minimum TLS version to use.
|
170
|
+
#
|
171
|
+
# @param [Hash{Symbol => Object}] kwargs
|
172
|
+
# Additional keyword arguments for {socket}.
|
173
|
+
#
|
174
|
+
# @!macro connect_kwargs
|
175
|
+
#
|
176
|
+
# @yield [tls_socket]
|
177
|
+
# The given block will be passed the new SSL socket. Once the block
|
178
|
+
# returns the SSL socket will be closed.
|
179
|
+
#
|
180
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] tls_socket
|
181
|
+
# The new SSL Socket.
|
182
|
+
#
|
183
|
+
# @return [OpenSSL::SSL::SSLSocket, nil]
|
184
|
+
# the new SSL Socket. If a block is given, then `nil` will be
|
185
|
+
# returned.
|
186
|
+
#
|
187
|
+
# @example
|
188
|
+
# socket = tls_connect('twitter.com',443)
|
189
|
+
#
|
190
|
+
# @example
|
191
|
+
# tls_connect('twitter.com',443) do |sock|
|
192
|
+
# sock.write("GET / HTTP/1.1\n\r\n\r")
|
193
|
+
#
|
194
|
+
# sock.each_line { |line| puts line }
|
195
|
+
# end
|
196
|
+
#
|
197
|
+
# @see http://rubydoc.info/stdlib/openssl/OpenSSL/SSL/SSLSocket
|
198
|
+
#
|
199
|
+
# @api public
|
200
|
+
#
|
201
|
+
# @since 1.1.0
|
202
|
+
#
|
203
|
+
def self.connect(host,port, min_version: 1, **kwargs, &block)
|
204
|
+
SSL.connect(host,port, min_version: min_version, **kwargs, &block)
|
205
|
+
end
|
206
|
+
|
207
|
+
#
|
208
|
+
# Creates a new SSL connection and sends the given data.
|
209
|
+
#
|
210
|
+
# @param [String] data
|
211
|
+
# The data to send through the connection.
|
212
|
+
#
|
213
|
+
# @param [String] host
|
214
|
+
# The host to connect to.
|
215
|
+
#
|
216
|
+
# @param [Integer] port
|
217
|
+
# The port to connect to.
|
218
|
+
#
|
219
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
220
|
+
# The minimum TLS version to use.
|
221
|
+
#
|
222
|
+
# @param [Hash{Symbol => Object}] kwargs
|
223
|
+
# Additional keyword arguments for {connect}.
|
224
|
+
#
|
225
|
+
# @!macro connect_kwargs
|
226
|
+
#
|
227
|
+
# @yield [tls_socket]
|
228
|
+
# The given block will be passed the newly created TLS Socket.
|
229
|
+
#
|
230
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] tls_socket
|
231
|
+
# The newly created SSL Socket.
|
232
|
+
#
|
233
|
+
# @api public
|
234
|
+
#
|
235
|
+
# @since 1.1.0
|
236
|
+
#
|
237
|
+
def self.connect_and_send(data,host,port, min_version: 1, **kwargs, &block)
|
238
|
+
SSL.connect_and_send(data,host,port, min_version: min_version, **kwargs, &block)
|
239
|
+
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Connects to the host and port and returns the server's certificate.
|
243
|
+
#
|
244
|
+
# @param [String] host
|
245
|
+
# The host to connect to.
|
246
|
+
#
|
247
|
+
# @param [Integer] port
|
248
|
+
# The port to connect to.
|
249
|
+
#
|
250
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
251
|
+
# The minimum TLS version to use.
|
252
|
+
#
|
253
|
+
# @param [Hash{Symbol => Object}] kwargs
|
254
|
+
# Additional keyword arguments for {connect}.
|
255
|
+
#
|
256
|
+
# @!macro connect_kwargs
|
257
|
+
#
|
258
|
+
# @yield [tls_socket]
|
259
|
+
# The given block will be passed the newly created SSL Socket.
|
260
|
+
#
|
261
|
+
# @return [OpenSSL::X509::Certificate]
|
262
|
+
# The server's certificate.
|
263
|
+
#
|
264
|
+
# @since 1.1.0
|
265
|
+
#
|
266
|
+
def self.get_cert(host,port, min_version: 1, **kwargs)
|
267
|
+
SSL.get_cert(host,port, min_version: min_version, **kwargs)
|
268
|
+
end
|
269
|
+
|
270
|
+
#
|
271
|
+
# Reads the banner from the service running on the given host and
|
272
|
+
# port.
|
273
|
+
#
|
274
|
+
# @param [String] host
|
275
|
+
# The host to connect to.
|
276
|
+
#
|
277
|
+
# @param [Integer] port
|
278
|
+
# The port to connect to.
|
279
|
+
#
|
280
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
281
|
+
# The minimum TLS version to use.
|
282
|
+
#
|
283
|
+
# @param [Hash{Symbol => Object}] kwargs
|
284
|
+
# Additional keyword arguments for {connect}.
|
285
|
+
#
|
286
|
+
# @!macro connect_kwargs
|
287
|
+
#
|
288
|
+
# @yield [banner]
|
289
|
+
# If a block is given, it will be passed the grabbed banner.
|
290
|
+
#
|
291
|
+
# @yieldparam [String] banner
|
292
|
+
# The grabbed banner.
|
293
|
+
#
|
294
|
+
# @return [String]
|
295
|
+
# The grabbed banner.
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
# tls_banner('smtp.gmail.com',465)
|
299
|
+
# # => "220 mx.google.com ESMTP c20sm3096959rvf.1"
|
300
|
+
#
|
301
|
+
# @api public
|
302
|
+
#
|
303
|
+
# @since 1.1.0
|
304
|
+
#
|
305
|
+
def self.banner(host,port, min_version: 1, **kwargs, &block)
|
306
|
+
SSL.banner(host,port, min_version: min_version, **kwargs, &block)
|
307
|
+
end
|
308
|
+
|
309
|
+
#
|
310
|
+
# Connects to a specified host and port, sends the given data and then
|
311
|
+
# closes the connection.
|
312
|
+
#
|
313
|
+
# @param [String] data
|
314
|
+
# The data to send through the connection.
|
315
|
+
#
|
316
|
+
# @param [String] host
|
317
|
+
# The host to connect to.
|
318
|
+
#
|
319
|
+
# @param [Integer] port
|
320
|
+
# The port to connect to.
|
321
|
+
#
|
322
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
323
|
+
# The minimum TLS version to use.
|
324
|
+
#
|
325
|
+
# @param [Hash{Symbol => Object}] kwargs
|
326
|
+
# Additional keyword arguments for {connect}.
|
327
|
+
#
|
328
|
+
# @!macro connect_kwargs
|
329
|
+
#
|
330
|
+
# @return [true]
|
331
|
+
# The data was successfully sent.
|
332
|
+
#
|
333
|
+
# @example
|
334
|
+
# buffer = "GET /#{'A' * 4096}\n\r"
|
335
|
+
# tls_send(buffer,'victim.com',443)
|
336
|
+
# # => true
|
337
|
+
#
|
338
|
+
# @api public
|
339
|
+
#
|
340
|
+
# @since 1.1.0
|
341
|
+
#
|
342
|
+
def self.send(data,host,port, min_version: 1, **kwargs)
|
343
|
+
SSL.send(data,host,port, min_version: min_version, **kwargs)
|
344
|
+
end
|
345
|
+
|
346
|
+
#
|
347
|
+
# @!macro server_context_kwargs
|
348
|
+
# @option kwargs [Crypto::Key::RSA, OpenSSL::PKey::RSA, nil] :key (SSL.key)
|
349
|
+
# The RSA key to use for the TLS context.
|
350
|
+
#
|
351
|
+
# @option kwargs [Crypto::Cert, OpenSSL::X509::Certificate, nil] :cert (SSL.cert)
|
352
|
+
# The X509 certificate to use for the SSL context.
|
353
|
+
#
|
354
|
+
# @!macro context_kwargs
|
355
|
+
#
|
356
|
+
|
357
|
+
#
|
358
|
+
# Accepts an TLS session from an existing TCP socket.
|
359
|
+
#
|
360
|
+
# @param [TCPSocket] socket
|
361
|
+
# The existing TCP socket.
|
362
|
+
#
|
363
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
364
|
+
# The minimum TLS version to use.
|
365
|
+
#
|
366
|
+
# @param [Hash{Symbol => Object}] kwargs
|
367
|
+
# Additional keyword arguments for {socket}.
|
368
|
+
#
|
369
|
+
# @!macro server_context_kwargs
|
370
|
+
#
|
371
|
+
# @return [OpenSSL::SSL::SSLSocket]
|
372
|
+
# the new SSL Socket.
|
373
|
+
#
|
374
|
+
# @api public
|
375
|
+
#
|
376
|
+
# @since 1.1.0
|
377
|
+
#
|
378
|
+
def self.server_socket(socket, min_version: 1, **kwargs)
|
379
|
+
SSL.server_socket(socket, min_version: min_version, **kwargs)
|
380
|
+
end
|
381
|
+
|
382
|
+
#
|
383
|
+
# @!macro server_kwargs
|
384
|
+
# @option kwargs [Integer] :port (0)
|
385
|
+
# The local port to listen on.
|
386
|
+
#
|
387
|
+
# @option kwargs [String, nil] :host
|
388
|
+
# The host to bind to.
|
389
|
+
#
|
390
|
+
# @option kwargs [Integer] :backlog (5)
|
391
|
+
# The maximum backlog of pending connections.
|
392
|
+
#
|
393
|
+
# @!macro server_context_kwargs
|
394
|
+
#
|
395
|
+
|
396
|
+
#
|
397
|
+
# Creates a new TLS server listening on a given host and port.
|
398
|
+
#
|
399
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
400
|
+
# The minimum TLS version to use.
|
401
|
+
#
|
402
|
+
# @param [Hash{Symbol => Object}] kwargs
|
403
|
+
# Additional keyword arguments for {context}.
|
404
|
+
#
|
405
|
+
# @!macro server_kwargs
|
406
|
+
#
|
407
|
+
# @yield [server]
|
408
|
+
# The given block will be passed the newly created SSL server.
|
409
|
+
#
|
410
|
+
# @yieldparam [OpenSSL::SSL::SSLServer] server
|
411
|
+
# The newly created SSL server.
|
412
|
+
#
|
413
|
+
# @return [OpenSSL::SSL::SSLServer]
|
414
|
+
# The newly created SSL server.
|
415
|
+
#
|
416
|
+
# @api public
|
417
|
+
#
|
418
|
+
# @since 1.1.0
|
419
|
+
#
|
420
|
+
def self.server(min_version: 1, **kwargs, &block)
|
421
|
+
SSL.server(min_version: min_version, **kwargs, &block)
|
422
|
+
end
|
423
|
+
|
424
|
+
#
|
425
|
+
# Creates a new temporary TLS server listening on a given host and port.
|
426
|
+
#
|
427
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
428
|
+
# The minimum TLS version to use.
|
429
|
+
#
|
430
|
+
# @param [Hash{Symbol => Object}] kwargs
|
431
|
+
# Additional keyword arguments for {context}.
|
432
|
+
#
|
433
|
+
# @!macro server_kwargs
|
434
|
+
#
|
435
|
+
# @yield [server]
|
436
|
+
# The given block will be passed the newly created SSL server.
|
437
|
+
#
|
438
|
+
# @yieldparam [OpenSSL::SSL::SSLServer] server
|
439
|
+
# The newly created SSL server. Once the block has finished,
|
440
|
+
# the server will be closed.
|
441
|
+
#
|
442
|
+
# @return [OpenSSL::SSL::SSLServer]
|
443
|
+
# The newly created SSL server.
|
444
|
+
#
|
445
|
+
# @api public
|
446
|
+
#
|
447
|
+
# @since 1.1.0
|
448
|
+
#
|
449
|
+
def self.server_session(min_version: 1, **kwargs, &block)
|
450
|
+
SSL.server_session(min_version: min_version, **kwargs, &block)
|
451
|
+
end
|
452
|
+
|
453
|
+
#
|
454
|
+
# Creates a new SSL socket listening on a given host and port,
|
455
|
+
# accepting clients in a loop.
|
456
|
+
#
|
457
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
458
|
+
# The minimum TLS version to use.
|
459
|
+
#
|
460
|
+
# @param [Hash{Symbol => Object}] kwargs
|
461
|
+
# Additional keyword arguments for {server_socket}.
|
462
|
+
#
|
463
|
+
# @!macro server_kwargs
|
464
|
+
#
|
465
|
+
# @yield [client]
|
466
|
+
# The given block will be passed the newly connected client.
|
467
|
+
# After the block has finished, the client will be closed.
|
468
|
+
#
|
469
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] client
|
470
|
+
# A newly connected client.
|
471
|
+
#
|
472
|
+
# @return [nil]
|
473
|
+
#
|
474
|
+
# @example
|
475
|
+
# # $ openssl genrsa -out ssl.key 1024
|
476
|
+
# # $ openssl req -new -key ssl.key -x509 -days 3653 -out ssl.crt
|
477
|
+
# # $ cat ssl.key ssl.crt > ssl.pem
|
478
|
+
# # $ chmod 600 ssl.key ssl.pem
|
479
|
+
# tls_server_loop(port: 1337, cert: 'ssl.crt', key: 'ssl.key') do |sock|
|
480
|
+
# sock.puts 'lol'
|
481
|
+
# end
|
482
|
+
#
|
483
|
+
# @api public
|
484
|
+
#
|
485
|
+
# @since 1.1.0
|
486
|
+
#
|
487
|
+
def self.server_loop(min_version: 1, **kwargs, &block)
|
488
|
+
SSL.server_loop(min_version: min_version, **kwargs, &block)
|
489
|
+
end
|
490
|
+
|
491
|
+
#
|
492
|
+
# Creates a new SSL socket listening on a given host and port,
|
493
|
+
# accepts only one client and then stops listening.
|
494
|
+
#
|
495
|
+
# @param [1, 1.1, 1.2, 1.3, Symbol, nil] min_version
|
496
|
+
# The minimum TLS version to use.
|
497
|
+
#
|
498
|
+
# @param [Hash{Symbol => Object}] kwargs
|
499
|
+
# Additional keyword arguments for {server_socket}.
|
500
|
+
#
|
501
|
+
# @!macro server_kwargs
|
502
|
+
#
|
503
|
+
# @yield [client]
|
504
|
+
# The given block will be passed the newly connected client.
|
505
|
+
# After the block has finished, both the client and the server will
|
506
|
+
# be closed.
|
507
|
+
#
|
508
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] client
|
509
|
+
# The newly connected client.
|
510
|
+
#
|
511
|
+
# @return [nil]
|
512
|
+
#
|
513
|
+
# @example
|
514
|
+
# tls_accept(1337) do |client|
|
515
|
+
# client.puts 'lol'
|
516
|
+
# end
|
517
|
+
#
|
518
|
+
# @example Using a self-signed certificate:
|
519
|
+
# # $ openssl genrsa -out ssl.key 1024
|
520
|
+
# # $ openssl req -new -key ssl.key -x509 -days 3653 -out ssl.crt
|
521
|
+
# # $ cat ssl.key ssl.crt > ssl.pem
|
522
|
+
# # $ chmod 600 ssl.key ssl.pem
|
523
|
+
# tls_accept(port: 1337, cert: 'ssl.crt', key: 'ssl.key') do |client|
|
524
|
+
# client.puts 'lol'
|
525
|
+
# end
|
526
|
+
#
|
527
|
+
# @api public
|
528
|
+
#
|
529
|
+
# @since 1.1.0
|
530
|
+
#
|
531
|
+
def self.accept(min_version: 1, **kwargs, &block)
|
532
|
+
SSL.accept(min_version: min_version, **kwargs, &block)
|
47
533
|
end
|
48
534
|
end
|
49
535
|
end
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
|
+
#
|
5
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published
|
7
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# ronin-support is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
16
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'ronin/support/network/host'
|
20
|
+
|
21
|
+
module Ronin
|
22
|
+
module Support
|
23
|
+
module Network
|
24
|
+
#
|
25
|
+
# Represents a wildcard hostname.
|
26
|
+
#
|
27
|
+
# ## Examples
|
28
|
+
#
|
29
|
+
# wildcard = Network::Wildcard.new('*.example.com')
|
30
|
+
# wildcard.subdomain('www')
|
31
|
+
# # => #<Ronin::Support::Network::Host: www.example.com>
|
32
|
+
#
|
33
|
+
# @api public
|
34
|
+
#
|
35
|
+
# @since 1.1.0
|
36
|
+
#
|
37
|
+
class Wildcard
|
38
|
+
|
39
|
+
# The wildcard template for the hostname.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
attr_reader :template
|
43
|
+
|
44
|
+
#
|
45
|
+
# Initializes the wildcard hostname.
|
46
|
+
#
|
47
|
+
# @param [String] template
|
48
|
+
# The wildcard hostname template.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# wildcard = Network::Wildcard.new('*.example.com')
|
52
|
+
#
|
53
|
+
def initialize(template)
|
54
|
+
@template = template
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Replaces the `*` in the wildcard hostname with the given name.
|
59
|
+
#
|
60
|
+
# @param [String] name
|
61
|
+
# The name to replace the `*` wildcard with.
|
62
|
+
#
|
63
|
+
# @return [Host]
|
64
|
+
# The new hostname.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# wildcard = Network::Wildcard.new('*.example.com')
|
68
|
+
# wildcard.subdomain('www')
|
69
|
+
# # => #<Ronin::Support::Network::Host: www.example.com>
|
70
|
+
#
|
71
|
+
def subdomain(name)
|
72
|
+
Host.new(@template.sub('*',name))
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Converts the wildcard hostname to a String.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
# The string value of the wildcard hostname.
|
80
|
+
#
|
81
|
+
def to_s
|
82
|
+
@template
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -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
|
data/lib/ronin/support/path.rb
CHANGED
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|