Module: Ronin::Support::Network::HTTP::Mixin

Included in:
Mixin
Defined in:
lib/ronin/support/network/http/mixin.rb

Overview

Provides helper methods for communicating with HTTP Servers.

Instance Method Summary collapse

Instance Method Details

#http_allowed_methods(url, ssl: nil, **kwargs) ⇒ Array<Symbol>

Performs a OPTIONS HTTP request for the given URI and parses the Allow response header.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (Array<Symbol>)

    The allowed HTTP request methods for the given URL.

See Also:



643
644
645
# File 'lib/ronin/support/network/http/mixin.rb', line 643

def http_allowed_methods(url, ssl: nil, **kwargs)
  Network::HTTP.allowed_methods(url, ssl: ssl, **kwargs)
end

#http_connect(host, port, ssl: nil, **kwargs) {|http| ... } ⇒ HTTP?

Creates a HTTP connection to the host nad port.

Parameters:

  • host (String)

    The host to connect to.

  • port (Integer)

    The port to connect to.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (http)

    If a block is given, it will be passed the newly created HTTP session object. Once the block returns, the HTTP session will be closed.

Yield Parameters:

  • http (HTTP)

    The HTTP session object.

Returns:

  • (HTTP, nil)

    The HTTP session object. If a block is given, then nil will be returned.

Since:

  • 1.0.0



117
118
119
# File 'lib/ronin/support/network/http/mixin.rb', line 117

def http_connect(host,port, ssl: nil, **kwargs,&block)
  Network::HTTP.connect(host,port, ssl: ssl, **kwargs,&block)
end

#http_connect_uri(url, ssl: nil, **kwargs) {|http| ... } ⇒ HTTP?

Creates a HTTP connection using the URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URI to connect to.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (http)

    If a block is given, it will be passed the newly created HTTP session object. Once the block returns, the HTTP session will be closed.

Yield Parameters:

  • http (HTTP)

    The HTTP session object.

Returns:

  • (HTTP, nil)

    The HTTP session object. If a block is given, then nil will be returned.

Since:

  • 1.0.0



145
146
147
# File 'lib/ronin/support/network/http/mixin.rb', line 145

def http_connect_uri(url, ssl: nil, **kwargs,&block)
  Network::HTTP.connect_uri(url, ssl: ssl, **kwargs,&block)
end

#http_copy(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a COPY request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



375
376
377
# File 'lib/ronin/support/network/http/mixin.rb', line 375

def http_copy(url, ssl: nil, **kwargs,&block)
  Network::HTTP.copy(url, ssl: ssl, **kwargs,&block)
end

#http_delete(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a DELETE request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



401
402
403
# File 'lib/ronin/support/network/http/mixin.rb', line 401

def http_delete(url, ssl: nil, **kwargs,&block)
  Network::HTTP.delete(url, ssl: ssl, **kwargs,&block)
end

#http_get(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a GET request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



427
428
429
# File 'lib/ronin/support/network/http/mixin.rb', line 427

def http_get(url, ssl: nil, **kwargs,&block)
  Network::HTTP.get(url, ssl: ssl, **kwargs,&block)
end

#http_get_body(url, ssl: nil, **kwargs) ⇒ String

Performs a GET request for the given URI and returns the response body.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (String)

    The response body.

See Also:



492
493
494
# File 'lib/ronin/support/network/http/mixin.rb', line 492

def http_get_body(url, ssl: nil, **kwargs)
  Network::HTTP.get_body(url, ssl: ssl, **kwargs)
end

#http_get_cookies(url, ssl: nil, **kwargs) ⇒ Array<SetCookie>?

Sends an HTTP request and returns the parsed Set-Cookie header(s).

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

See Also:



471
472
473
# File 'lib/ronin/support/network/http/mixin.rb', line 471

def http_get_cookies(url, ssl: nil, **kwargs)
  Network::HTTP.get_cookies(url, ssl: ssl, **kwargs)
end

#http_get_headers(url, ssl: nil, **kwargs) ⇒ Hash{String => String}

Performs a GET request for the given URI and returns the response headers.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

See Also:

Since:

  • 0.2.0



450
451
452
# File 'lib/ronin/support/network/http/mixin.rb', line 450

def http_get_headers(url, ssl: nil, **kwargs)
  Network::HTTP.get_headers(url, ssl: ssl, **kwargs)
end

#http_head(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a HEAD request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



518
519
520
# File 'lib/ronin/support/network/http/mixin.rb', line 518

def http_head(url, ssl: nil, **kwargs,&block)
  Network::HTTP.head(url, ssl: ssl, **kwargs,&block)
end

#http_lock(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a LOCK request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



544
545
546
# File 'lib/ronin/support/network/http/mixin.rb', line 544

def http_lock(url, ssl: nil, **kwargs,&block)
  Network::HTTP.lock(url, ssl: ssl, **kwargs,&block)
end

#http_mkcol(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a MKCOL request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



570
571
572
# File 'lib/ronin/support/network/http/mixin.rb', line 570

def http_mkcol(url, ssl: nil, **kwargs,&block)
  Network::HTTP.mkcol(url, ssl: ssl, **kwargs,&block)
end

#http_move(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a MOVE request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



596
597
598
# File 'lib/ronin/support/network/http/mixin.rb', line 596

def http_move(url, ssl: nil, **kwargs,&block)
  Network::HTTP.move(url, ssl: ssl, **kwargs,&block)
end

#http_ok?(method = :head, url, ssl: nil, **kwargs) ⇒ Boolean

Sends a HTTP request and determines if the response status was 200.

Parameters:

  • method (Symbol, String) (defaults to: :head)

    The HTTP method to use for the request.

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (Boolean)

    Indicates that the response status was 200.

See Also:



255
256
257
# File 'lib/ronin/support/network/http/mixin.rb', line 255

def http_ok?(method=:head,url, ssl: nil, **kwargs)
  Network::HTTP.ok?(method,url, ssl: ssl, **kwargs)
end

#http_options(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a OPTIONS request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



622
623
624
# File 'lib/ronin/support/network/http/mixin.rb', line 622

def http_options(url, ssl: nil, **kwargs,&block)
  Network::HTTP.options(url, ssl: ssl, **kwargs,&block)
end

#http_patch(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a PATCH request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:

Since:

  • 1.0.0



671
672
673
# File 'lib/ronin/support/network/http/mixin.rb', line 671

def http_patch(url, ssl: nil, **kwargs,&block)
  Network::HTTP.patch(url, ssl: ssl, **kwargs,&block)
end

#http_post(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a POST request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



697
698
699
# File 'lib/ronin/support/network/http/mixin.rb', line 697

def http_post(url, ssl: nil, **kwargs,&block)
  Network::HTTP.post(url, ssl: ssl, **kwargs,&block)
end

#http_post_body(url, ssl: nil, **kwargs) ⇒ String

Performs a POST request for the given URI and returns the response body.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (String)

    The response body.

See Also:



741
742
743
# File 'lib/ronin/support/network/http/mixin.rb', line 741

def http_post_body(url, ssl: nil, **kwargs)
  Network::HTTP.post_body(url, ssl: ssl, **kwargs)
end

#http_post_headers(url, ssl: nil, **kwargs) ⇒ Hash{String => String}

Performs a POST request on the given URI and returns the response headers.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

See Also:

Since:

  • 0.2.0



720
721
722
# File 'lib/ronin/support/network/http/mixin.rb', line 720

def http_post_headers(url, ssl: nil, **kwargs)
  Network::HTTP.post_headers(url, ssl: ssl, **kwargs)
end

#http_powered_by_header(url, ssl: nil, **kwargs) ⇒ String?

Sends an HTTP request and returns the X-Powered-By header.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (String, nil)

    The X-Powered-By header.

See Also:

Since:

  • 1.0.0



324
325
326
# File 'lib/ronin/support/network/http/mixin.rb', line 324

def http_powered_by_header(url, ssl: nil, **kwargs)
  Network::HTTP.powered_by_header(url, ssl: ssl, **kwargs)
end

#http_propfind(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse Also known as: http_prop_find

Performs a PROPFIND request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



767
768
769
# File 'lib/ronin/support/network/http/mixin.rb', line 767

def http_propfind(url, ssl: nil, **kwargs,&block)
  Network::HTTP.propfind(url, ssl: ssl, **kwargs,&block)
end

#http_proppatch(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse Also known as: http_prop_patch

Performs a PROPPATCH request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



795
796
797
# File 'lib/ronin/support/network/http/mixin.rb', line 795

def http_proppatch(url, ssl: nil, **kwargs,&block)
  Network::HTTP.proppatch(url, ssl: ssl, **kwargs,&block)
end

#http_put(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a PUT request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:

Since:

  • 0.4.0



825
826
827
# File 'lib/ronin/support/network/http/mixin.rb', line 825

def http_put(url, ssl: nil, **kwargs,&block)
  Network::HTTP.put(url, ssl: ssl, **kwargs,&block)
end

#http_request(method, url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs and arbitrary HTTP request.

Parameters:

  • method (Symbol, String)

    The HTTP method to use for the request.

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

Raises:

  • (ArgumentError)

    The :method option did not match a known Net::HTTP request class.

See Also:



207
208
209
# File 'lib/ronin/support/network/http/mixin.rb', line 207

def http_request(method,url, ssl: nil, **kwargs,&block)
  Network::HTTP.request(method,url, ssl: ssl, **kwargs,&block)
end

#http_response_body(method = :get, url, ssl: nil, **kwargs) ⇒ String

Sends an arbitrary HTTP request and returns the response body.

Parameters:

  • method (Symbol, String) (defaults to: :get)

    The HTTP method to use for the request.

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (String)

    The response body.

See Also:

Since:

  • 1.0.0



349
350
351
# File 'lib/ronin/support/network/http/mixin.rb', line 349

def http_response_body(method=:get,url, ssl: nil, **kwargs)
  Network::HTTP.response_body(method,url, ssl: ssl, **kwargs)
end

#http_response_headers(method = :head, url, ssl: nil, **kwargs) ⇒ Hash{String => String}

Sends an arbitrary HTTP request and returns the response headers.

Parameters:

  • method (Symbol, String) (defaults to: :head)

    The HTTP method to use for the request.

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

See Also:

Since:

  • 1.0.0



280
281
282
# File 'lib/ronin/support/network/http/mixin.rb', line 280

def http_response_headers(method=:head,url, ssl: nil, **kwargs)
  Network::HTTP.response_headers(method,url, ssl: ssl, **kwargs)
end

#http_response_status(method = :head, url, ssl: nil, **kwargs) ⇒ Integer

Sends an arbitrary HTTP request and returns the response status.

Parameters:

  • method (Symbol, String) (defaults to: :head)

    The HTTP method to use for the request.

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Returns:

  • (Integer)

    The status code of the response.

See Also:

Since:

  • 1.0.0



232
233
234
# File 'lib/ronin/support/network/http/mixin.rb', line 232

def http_response_status(method=:head,url, ssl: nil, **kwargs)
  Network::HTTP.response_status(method,url, ssl: ssl, **kwargs)
end

#http_server_header(url, ssl: nil, **kwargs) ⇒ String?

Sends an HTTP request and returns the Server header.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

Returns:

  • (String, nil)

    The Server header.

See Also:

Since:

  • 1.0.0



302
303
304
# File 'lib/ronin/support/network/http/mixin.rb', line 302

def http_server_header(url, ssl: nil, **kwargs)
  Network::HTTP.server_header(url, ssl: ssl, **kwargs)
end

#http_trace(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a TRACE request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



851
852
853
# File 'lib/ronin/support/network/http/mixin.rb', line 851

def http_trace(url, ssl: nil, **kwargs,&block)
  Network::HTTP.trace(url, ssl: ssl, **kwargs,&block)
end

#http_unlock(url, ssl: nil, **kwargs) {|response| ... } ⇒ Net::HTTPResponse

Performs a UNLOCK request for the given URI.

Parameters:

  • url (URI::HTTP, Addressable::URI, String)

    The URL to create the HTTP request for.

  • ssl (Boolean, Hash{Symbol => Object}, nil) (defaults to: nil)

    Specifies whether to enable SSL and/or the SSL context configuration.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.

Options Hash (ssl:):

  • :ca_bundle (String, nil)

    The path to the CA bundle directory or file.

  • :cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The certificate to use for the SSL/TLS connection.

  • :cert_store (OpenSSL::X509::Store, nil)

    The certificate store to use for the SSL/TLS connection.

  • :ciphers (Array<(name, version, bits, alg_bits)>, nil)

    The accepted ciphers to use for the SSL/TLS connection.

  • :extra_chain_cert (Crypto::Cert, OpenSSL::X509::Certificate, nil)

    The extra certificate to add to the SSL/TLS certificate chain.

  • :key (Crypto::Key::RSA, Crypto::Key::DSA, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, nil)

    The RSA or DSA key to use for the SSL/TLS connection.

  • :timeout (Integer, nil)

    The connection timeout limit.

  • :version (1, 1.1, 1.2, Symbol, nil)

    The desired SSL/TLS version.

  • :min_version (1, 1.1, 1.2, Symbol, nil)

    The minimum SSL/TLS version.

  • :max_version (1, 1.1, 1.2, Symbol, nil)

    The maximum SSL/TLS version.

  • :verify_callback (Proc, nil)

    The callback to use when verifying the server's certificate.

  • :verify_depth (Integer, nil)

    The verification depth limit.

  • :verify (:none, :peer, :fail_if_no_peer_cert, true, false, Integer, nil)

    The verification mode.

  • :verify_hostname (Boolean, nil)

    Indicates whether to verify the server's hostname.

Options Hash (**kwargs):

  • :query (String, nil)

    The query-string to append to the request path.

  • :query_params (Hash, nil)

    The query-params to append to the request path.

  • :user (String, nil)

    The user to authenticate as.

  • :password (String, nil)

    The password to authenticate with.

  • :headers (Hash{Symbol,String => String}, nil)

    Additional HTTP headers to use for the request.

  • :cookie (String, Hash{String => String}, Cookie, nil)

    Additional Cookie header. If a Hash is given, it will be converted to a String using Cookie. If the cookie value is empty, the Cookie header will not be set.

  • :body (String, nil)

    The body of the request.

  • :form_data (Hash, String, nil)

    The form data that may be sent in the body of the request.

  • :proxy (String, URI::HTTP, Addressable::URI, nil)

    The optional proxy to send requests through.

  • :headers (Hash{Symbol,String => String,Array}, nil)

    Additional headers to add to each request.

  • user_agent (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) — default: HTTP.user_agent

    The default User-Agent string to add to each request.

Yields:

  • (response)

    If a block is given it will be passed the received HTTP response.

Yield Parameters:

  • response (Net::HTTPRresponse)

    The received HTTP response object.

Returns:

  • (Net::HTTPResponse)

    The new HTTP Request object.

See Also:



877
878
879
# File 'lib/ronin/support/network/http/mixin.rb', line 877

def http_unlock(url, ssl: nil, **kwargs,&block)
  Network::HTTP.unlock(url, ssl: ssl, **kwargs,&block)
end