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.
- checksums.yaml +4 -4
- data/.rubocop.yml +28 -0
- data/ChangeLog.md +109 -7
- 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 +10 -16
- 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
|
@@ -41,6 +41,22 @@ module Ronin
|
|
41
41
|
# @option kwargs [Hash{Symbol,String => String,Array}, nil] :headers
|
42
42
|
# Additional headers to add to each request.
|
43
43
|
#
|
44
|
+
# @option kwargs [String, :text, :xml, :html, :json, nil] :content_type
|
45
|
+
# The `Content-Type` header value for the request.
|
46
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
47
|
+
# * `:text` - `text/plain`
|
48
|
+
# * `:xml` - `text/xml`
|
49
|
+
# * `:html` - `text/html`
|
50
|
+
# * `:json` - `application/json`
|
51
|
+
#
|
52
|
+
# @option kwargs [String, :text, :xml, :html, :json, nil] :accept
|
53
|
+
# The `Accept` header value for the request.
|
54
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
55
|
+
# * `:text` - `text/plain`
|
56
|
+
# * `:xml` - `text/xml`
|
57
|
+
# * `:html` - `text/html`
|
58
|
+
# * `:json` - `application/json`
|
59
|
+
#
|
44
60
|
# @option kwargs [String, :random, :chrome, :chrome_linux, :chrome_macos, :chrome_windows, :chrome_iphone, :chrome_ipad, :chrome_android, :firefox, :firefox_linux, :firefox_macos, :firefox_windows, :firefox_iphone, :firefox_ipad, :firefox_android, :safari, :safari_macos, :safari_iphone, :safari_ipad, :edge, :linux, :macos, :windows, :iphone, :ipad, :android, nil] user_agent (HTTP.user_agent)
|
45
61
|
# The default `User-Agent` string to add to each request.
|
46
62
|
#
|
@@ -174,6 +190,11 @@ module Ronin
|
|
174
190
|
# @option kwargs [Hash, String, nil] :form_data
|
175
191
|
# The form data that may be sent in the body of the request.
|
176
192
|
#
|
193
|
+
# @option kwargs [#to_json, nil] :json
|
194
|
+
# The JSON data that will be sent in the body of the request.
|
195
|
+
# Will also default the `Content-Type` header to
|
196
|
+
# `application/json`, unless already set.
|
197
|
+
#
|
177
198
|
|
178
199
|
#
|
179
200
|
# Performs and arbitrary HTTP request.
|
@@ -472,6 +493,26 @@ module Ronin
|
|
472
493
|
Network::HTTP.get_cookies(url, ssl: ssl, **kwargs)
|
473
494
|
end
|
474
495
|
|
496
|
+
#
|
497
|
+
# Sends an HTTP request and returns the parsed `Set-Cookie` header(s).
|
498
|
+
#
|
499
|
+
# @param [URI::HTTP, Addressable::URI, String] url
|
500
|
+
# Optional URL to create the HTTP request for.
|
501
|
+
#
|
502
|
+
# @!macro request_kwargs
|
503
|
+
# @!macro connect_kwargs
|
504
|
+
#
|
505
|
+
# @return [Array<SetCookie>, nil]
|
506
|
+
# The parsed `Cookie` header(s).
|
507
|
+
#
|
508
|
+
# @see Network::HTTP.post_cookies
|
509
|
+
#
|
510
|
+
# @api public
|
511
|
+
#
|
512
|
+
def http_post_cookies(url, ssl: nil, **kwargs)
|
513
|
+
Network::HTTP.post_cookies(url, ssl: ssl, **kwargs)
|
514
|
+
end
|
515
|
+
|
475
516
|
#
|
476
517
|
# Performs a `GET` request for the given URI and returns the response
|
477
518
|
# body.
|
@@ -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
|
@@ -86,6 +86,46 @@ module Ronin
|
|
86
86
|
unlock: Net::HTTP::Unlock
|
87
87
|
}
|
88
88
|
|
89
|
+
# Common MIME types.
|
90
|
+
#
|
91
|
+
# @since 1.1.0
|
92
|
+
MIME_TYPES = {
|
93
|
+
text: 'text/plain',
|
94
|
+
xml: 'text/xml',
|
95
|
+
html: 'text/html',
|
96
|
+
json: 'application/json'
|
97
|
+
}
|
98
|
+
|
99
|
+
#
|
100
|
+
# Resolves the MIME type.
|
101
|
+
#
|
102
|
+
# @param [String, :text, :xml, :html, :json, nil] mime_type
|
103
|
+
# The MIME type String or Symbol.
|
104
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
105
|
+
# * `:text` - `text/plain`
|
106
|
+
# * `:xml` - `text/xml`
|
107
|
+
# * `:html` - `text/html`
|
108
|
+
# * `:json` - `application/json`
|
109
|
+
#
|
110
|
+
# @return [String]
|
111
|
+
# The resolved MIME type String.
|
112
|
+
#
|
113
|
+
# @raise [ArgumentError]
|
114
|
+
# An unknown Symbol is given.
|
115
|
+
#
|
116
|
+
# @since 1.1.0
|
117
|
+
#
|
118
|
+
def self.mime_type_for(mime_type)
|
119
|
+
case mime_type
|
120
|
+
when Symbol
|
121
|
+
MIME_TYPES.fetch(mime_type) do
|
122
|
+
raise(ArgumentError,"unsupported MIME type: #{mime_type.inspect}")
|
123
|
+
end
|
124
|
+
else
|
125
|
+
mime_type
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
89
129
|
#
|
90
130
|
# Creates a new `Net::HTTP` request.
|
91
131
|
#
|
@@ -111,6 +151,22 @@ module Ronin
|
|
111
151
|
# @param [Hash{Symbol => String}, Hash{String => String}, nil] headers
|
112
152
|
# Additional HTTP header names and values to add to the request.
|
113
153
|
#
|
154
|
+
# @param [String, :text, :xml, :html, :json, nil] content_type
|
155
|
+
# The `Content-Type` header value for the request.
|
156
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
157
|
+
# * `:text` - `text/plain`
|
158
|
+
# * `:xml` - `text/xml`
|
159
|
+
# * `:html` - `text/html`
|
160
|
+
# * `:json` - `application/json`
|
161
|
+
#
|
162
|
+
# @param [String, :text, :xml, :html, :json, nil] accept
|
163
|
+
# The `Accept` header value for the request.
|
164
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
165
|
+
# * `:text` - `text/plain`
|
166
|
+
# * `:xml` - `text/xml`
|
167
|
+
# * `:html` - `text/html`
|
168
|
+
# * `:json` - `application/json`
|
169
|
+
#
|
114
170
|
# @param [String, :random, :chrome, :chrome_linux, :chrome_macos,
|
115
171
|
# :chrome_windows, :chrome_iphone, :chrome_ipad,
|
116
172
|
# :chrome_android, :firefox, :firefox_linux, :firefox_macos,
|
@@ -131,6 +187,11 @@ module Ronin
|
|
131
187
|
# @param [Hash, String, nil] form_data
|
132
188
|
# The form data that may be sent in the body of the request.
|
133
189
|
#
|
190
|
+
# @param [#to_json, nil] json
|
191
|
+
# The JSON data that will be sent in the body of the request.
|
192
|
+
# Will also default the `Content-Type` header to `application/json`,
|
193
|
+
# unless already set.
|
194
|
+
#
|
134
195
|
# @return [Net::HTTP::Copy,
|
135
196
|
# Net::HTTP::Delete,
|
136
197
|
# Net::HTTP::Get,
|
@@ -155,12 +216,15 @@ module Ronin
|
|
155
216
|
user: nil,
|
156
217
|
password: nil,
|
157
218
|
# Header keyword arguments
|
158
|
-
headers:
|
159
|
-
|
160
|
-
|
219
|
+
headers: nil,
|
220
|
+
content_type: nil,
|
221
|
+
accept: nil,
|
222
|
+
user_agent: nil,
|
223
|
+
cookie: nil,
|
161
224
|
# request body keyword arguments
|
162
225
|
body: nil,
|
163
|
-
form_data: nil
|
226
|
+
form_data: nil,
|
227
|
+
json: nil)
|
164
228
|
request_class = METHODS.fetch(method) do
|
165
229
|
raise(ArgumentError,"unknown HTTP request method: #{method.inspect}")
|
166
230
|
end
|
@@ -177,6 +241,14 @@ module Ronin
|
|
177
241
|
request.basic_auth(user,password)
|
178
242
|
end
|
179
243
|
|
244
|
+
if content_type
|
245
|
+
request['Content-Type'] = mime_type_for(content_type)
|
246
|
+
end
|
247
|
+
|
248
|
+
if accept
|
249
|
+
request['Accept'] = mime_type_for(accept)
|
250
|
+
end
|
251
|
+
|
180
252
|
if user_agent
|
181
253
|
request['User-Agent'] = case user_agent
|
182
254
|
when Symbol then UserAgents[user_agent]
|
@@ -191,13 +263,18 @@ module Ronin
|
|
191
263
|
end
|
192
264
|
end
|
193
265
|
|
194
|
-
if
|
266
|
+
if json
|
267
|
+
request['Content-Type'] ||= 'application/json'
|
268
|
+
|
269
|
+
request.body = json.to_json
|
270
|
+
elsif form_data
|
195
271
|
case form_data
|
196
272
|
when String
|
197
|
-
request
|
198
|
-
|
273
|
+
request['Content-Type'] ||= 'application/x-www-form-urlencoded'
|
274
|
+
|
275
|
+
request.body = form_data
|
199
276
|
else
|
200
|
-
request.form_data
|
277
|
+
request.form_data = form_data
|
201
278
|
end
|
202
279
|
elsif body
|
203
280
|
case body
|
@@ -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
|
@@ -365,7 +365,21 @@ module Ronin
|
|
365
365
|
@http.key = key if key
|
366
366
|
|
367
367
|
@http.ssl_timeout = timeout if timeout
|
368
|
-
|
368
|
+
|
369
|
+
if version
|
370
|
+
version = SSL::VERSIONS.fetch(version,version)
|
371
|
+
|
372
|
+
@http.min_version = @http.max_version = version
|
373
|
+
else min_version || max_version
|
374
|
+
if min_version
|
375
|
+
@http.min_version = SSL::VERSIONS.fetch(min_version,min_version)
|
376
|
+
end
|
377
|
+
|
378
|
+
if max_version
|
379
|
+
@http.max_version = SSL::VERSIONS.fetch(max_version,max_version)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
369
383
|
@http.min_version = min_version if min_version
|
370
384
|
@http.max_version = max_version if max_version
|
371
385
|
|
@@ -641,6 +655,22 @@ module Ronin
|
|
641
655
|
# @param [Hash{Symbol,String => String}, nil] headers
|
642
656
|
# Additional HTTP header names and values to add to the request.
|
643
657
|
#
|
658
|
+
# @param [String, :text, :xml, :html, :json, nil] content_type
|
659
|
+
# The `Content-Type` header value for the request.
|
660
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
661
|
+
# * `:text` - `text/plain`
|
662
|
+
# * `:xml` - `text/xml`
|
663
|
+
# * `:html` - `text/html`
|
664
|
+
# * `:json` - `application/json`
|
665
|
+
#
|
666
|
+
# @param [String, :text, :xml, :html, :json, nil] accept
|
667
|
+
# The `Accept` header value for the request.
|
668
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
669
|
+
# * `:text` - `text/plain`
|
670
|
+
# * `:xml` - `text/xml`
|
671
|
+
# * `:html` - `text/html`
|
672
|
+
# * `:json` - `application/json`
|
673
|
+
#
|
644
674
|
# @param [String, Hash{String => String}, nil] cookie
|
645
675
|
# Additional `Cookie` header. If a `Hash` is given, it will be
|
646
676
|
# converted to a `String` using {Cookie}.
|
@@ -651,6 +681,11 @@ module Ronin
|
|
651
681
|
# @param [Hash, String, nil] form_data
|
652
682
|
# The form data that may be sent in the body of the request.
|
653
683
|
#
|
684
|
+
# @param [#to_json, nil] json
|
685
|
+
# The JSON data that will be sent in the body of the request.
|
686
|
+
# Will also default the `Content-Type` header to `application/json`,
|
687
|
+
# unless already set.
|
688
|
+
#
|
654
689
|
# @param [Hash{Symbol => String}] additional_headers
|
655
690
|
# Additional headers to add to the request.
|
656
691
|
#
|
@@ -701,18 +736,23 @@ module Ronin
|
|
701
736
|
query: nil,
|
702
737
|
query_params: nil,
|
703
738
|
# header keyword arguments
|
704
|
-
headers:
|
705
|
-
|
706
|
-
|
739
|
+
headers: nil,
|
740
|
+
content_type: nil,
|
741
|
+
accept: nil,
|
742
|
+
user_agent: @user_agent,
|
743
|
+
cookie: @cookie,
|
707
744
|
# Basic-Auth keyword arguments
|
708
745
|
user: @user,
|
709
746
|
password: @password,
|
710
747
|
# request body keyword arguments
|
711
748
|
body: nil,
|
712
749
|
form_data: nil,
|
750
|
+
json: nil,
|
713
751
|
**additional_headers,
|
714
752
|
&block)
|
715
753
|
request = Request.build(method,path, headers: @headers,
|
754
|
+
content_type: content_type,
|
755
|
+
accept: accept,
|
716
756
|
user_agent: user_agent,
|
717
757
|
cookie: cookie,
|
718
758
|
user: user,
|
@@ -720,7 +760,8 @@ module Ronin
|
|
720
760
|
query: query,
|
721
761
|
query_params: query_params,
|
722
762
|
body: body,
|
723
|
-
form_data: form_data
|
763
|
+
form_data: form_data,
|
764
|
+
json: json)
|
724
765
|
|
725
766
|
if headers
|
726
767
|
# populate any arbitrary headers
|
@@ -759,6 +800,22 @@ module Ronin
|
|
759
800
|
# @option kwargs [Hash{Symbol,String => String}, nil] :headers
|
760
801
|
# Additional HTTP header names and values to add to the request.
|
761
802
|
#
|
803
|
+
# @option kwargs [String, :text, :xml, :html, :json, nil] :content_type
|
804
|
+
# The `Content-Type` header value for the request.
|
805
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
806
|
+
# * `:text` - `text/plain`
|
807
|
+
# * `:xml` - `text/xml`
|
808
|
+
# * `:html` - `text/html`
|
809
|
+
# * `:json` - `application/json`
|
810
|
+
#
|
811
|
+
# @option kwargs [String, :text, :xml, :html, :json, nil] :accept
|
812
|
+
# The `Accept` header value for the request.
|
813
|
+
# If a Symbol is given it will be resolved to a common MIME type:
|
814
|
+
# * `:text` - `text/plain`
|
815
|
+
# * `:xml` - `text/xml`
|
816
|
+
# * `:html` - `text/html`
|
817
|
+
# * `:json` - `application/json`
|
818
|
+
#
|
762
819
|
# @option kwargs [String, Hash{String => String}, Cookie, nil] :cookie
|
763
820
|
# Additional `Cookie` header. If a `Hash` is given, it will be
|
764
821
|
# converted to a `String` using {Cookie}. If the cookie value is
|
@@ -770,6 +827,11 @@ module Ronin
|
|
770
827
|
# @option kwargs [Hash, String, nil] :form_data
|
771
828
|
# The form data that may be sent in the body of the request.
|
772
829
|
#
|
830
|
+
# @option kwargs [#to_json, nil] :json
|
831
|
+
# The JSON data that will be sent in the body of the request.
|
832
|
+
# Will also default the `Content-Type` header to
|
833
|
+
# `application/json`, unless already set.
|
834
|
+
#
|
773
835
|
|
774
836
|
#
|
775
837
|
# Sends an arbitrary HTTP request and returns the response status.
|
@@ -1023,6 +1085,29 @@ module Ronin
|
|
1023
1085
|
end
|
1024
1086
|
end
|
1025
1087
|
|
1088
|
+
#
|
1089
|
+
# Sends an HTTP request and returns the parsed `Set-Cookie` header(s).
|
1090
|
+
#
|
1091
|
+
# @param [String] path
|
1092
|
+
# The path to to make the request for.
|
1093
|
+
#
|
1094
|
+
# @!macro request_kwargs
|
1095
|
+
#
|
1096
|
+
# @return [Array<SetCookie>, nil]
|
1097
|
+
# The parsed `Cookie` headers.
|
1098
|
+
#
|
1099
|
+
# @since 1.1.0
|
1100
|
+
#
|
1101
|
+
def post_cookies(path, **kwargs)
|
1102
|
+
response = request(:post,path,**kwargs)
|
1103
|
+
|
1104
|
+
if (set_cookies = response.get_fields('Set-Cookie'))
|
1105
|
+
set_cookies.map do |cookie|
|
1106
|
+
SetCookie.parse(cookie)
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
|
1026
1111
|
#
|
1027
1112
|
# Sends a `GET` HTTP request and returns the response body.
|
1028
1113
|
#
|
@@ -2821,6 +2906,53 @@ module Ronin
|
|
2821
2906
|
|
2822
2907
|
http.unlock(path,**kwargs,&block)
|
2823
2908
|
end
|
2909
|
+
|
2910
|
+
#
|
2911
|
+
# Sends an HTTP request and returns the parsed `Set-Cookie` header(s).
|
2912
|
+
#
|
2913
|
+
# @param [URI::HTTP, Addressable::URI, String] url
|
2914
|
+
# Optional URL to create the HTTP request for.
|
2915
|
+
#
|
2916
|
+
# @!macro request_kwargs
|
2917
|
+
# @!macro initialize_kwargs
|
2918
|
+
#
|
2919
|
+
# @return [Array<SetCookie>, nil]
|
2920
|
+
# The parsed `Cookie` header(s).
|
2921
|
+
#
|
2922
|
+
# @see connect_uri
|
2923
|
+
# @see #post_cookies
|
2924
|
+
#
|
2925
|
+
# @since 1.1.0
|
2926
|
+
#
|
2927
|
+
def self.post_cookies(url, proxy: self.proxy,
|
2928
|
+
ssl: nil,
|
2929
|
+
headers: {},
|
2930
|
+
user_agent: nil,
|
2931
|
+
cookie: nil,
|
2932
|
+
user: nil,
|
2933
|
+
password: nil,
|
2934
|
+
**kwargs,
|
2935
|
+
&block)
|
2936
|
+
uri = case url
|
2937
|
+
when Addressable::URI, URI::HTTP
|
2938
|
+
url
|
2939
|
+
when String
|
2940
|
+
Addressable::URI.parse(url)
|
2941
|
+
else
|
2942
|
+
raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
|
2943
|
+
end
|
2944
|
+
|
2945
|
+
path = uri.request_uri
|
2946
|
+
http = connect_uri(url, proxy: proxy,
|
2947
|
+
ssl: ssl,
|
2948
|
+
headers: headers,
|
2949
|
+
user_agent: user_agent,
|
2950
|
+
cookie: cookie,
|
2951
|
+
user: user,
|
2952
|
+
password: password)
|
2953
|
+
|
2954
|
+
http.post_cookies(path,**kwargs)
|
2955
|
+
end
|
2824
2956
|
end
|
2825
2957
|
end
|
2826
2958
|
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
|
@@ -66,6 +66,11 @@ module Ronin
|
|
66
66
|
#
|
67
67
|
class IP < IPAddr
|
68
68
|
|
69
|
+
# A regular expression for matching IP addresses.
|
70
|
+
#
|
71
|
+
# @since 1.1.0
|
72
|
+
REGEX = /#{RE_IPV4ADDRLIKE}|#{RE_IPV6ADDRLIKE_FULL}|#{RE_IPV6ADDRLIKE_COMPRESSED}/
|
73
|
+
|
69
74
|
#
|
70
75
|
# Initializes the IP address.
|
71
76
|
#
|
@@ -549,6 +554,42 @@ module Ronin
|
|
549
554
|
DNS.get_ptr_names(@address,**kwargs)
|
550
555
|
end
|
551
556
|
|
557
|
+
#
|
558
|
+
# Converts the IP address to it's IPv4 version.
|
559
|
+
#
|
560
|
+
# @note [IP]
|
561
|
+
# If the IP address is an IPv4-mapped IPv6 address then the IPv6
|
562
|
+
# address will be extracted from the IPv6 address. If the IP address
|
563
|
+
# is a regular IPv4 address, then the IP address will be returned.
|
564
|
+
#
|
565
|
+
# @raise [InvalidIP]
|
566
|
+
# The IP address was a regular IPv6 address and cannot be converted to
|
567
|
+
# a smaller IPv4 address.
|
568
|
+
#
|
569
|
+
# @example Converting an IPv4-mapped IPv6 address to an IPv4 address:
|
570
|
+
# ip = Network::IP.new('::ffff:127.0.0.1')
|
571
|
+
# ip.ipv4
|
572
|
+
# # => #<Ronin::Support::Network::IP: 127.0.0.1>
|
573
|
+
#
|
574
|
+
# @example When the IP address is already an IPv4 address:
|
575
|
+
# ip = Network::IP.new('127.0.0.1')
|
576
|
+
# ip.ipv4
|
577
|
+
# # => #<Ronin::Support::Network::IP: 127.0.0.1>
|
578
|
+
#
|
579
|
+
# @since 1.1.0
|
580
|
+
#
|
581
|
+
def ipv4
|
582
|
+
if ipv6?
|
583
|
+
if ipv4_mapped?
|
584
|
+
self.class.new(to_i & 0xffffffff,Socket::AF_INET)
|
585
|
+
else
|
586
|
+
raise(InvalidIP,"cannot convert a regular IPv6 address to an IPv4 address: #{inspect}")
|
587
|
+
end
|
588
|
+
else
|
589
|
+
self
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
552
593
|
alias canonical to_string
|
553
594
|
alias to_str to_s
|
554
595
|
alias to_uint to_i
|