ronin-exploits 0.3.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/.editorconfig +11 -0
- data/.github/workflows/ruby.yml +31 -0
- data/.gitignore +13 -0
- data/.mailmap +1 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +161 -335
- data/{History.txt → ChangeLog.md} +122 -14
- data/Gemfile +50 -0
- data/README.md +454 -0
- data/Rakefile +37 -23
- data/bin/ronin-exploits +13 -6
- data/data/new/exploit.rb.erb +158 -0
- data/gemspec.yml +37 -0
- data/lib/ronin/exploits/advisory.rb +84 -0
- data/lib/ronin/exploits/cli/command.rb +39 -0
- data/lib/ronin/exploits/cli/commands/irb.rb +57 -0
- data/lib/ronin/exploits/cli/commands/list.rb +80 -0
- data/lib/ronin/exploits/cli/commands/new.rb +332 -0
- data/lib/ronin/exploits/cli/commands/run.rb +396 -0
- data/lib/ronin/exploits/cli/commands/show.rb +264 -0
- data/lib/ronin/exploits/cli/exploit_command.rb +114 -0
- data/lib/ronin/exploits/cli/exploit_methods.rb +114 -0
- data/lib/ronin/exploits/cli/ruby_shell.rb +51 -0
- data/lib/ronin/exploits/cli.rb +46 -0
- data/lib/ronin/exploits/client_side_web_vuln.rb +69 -0
- data/lib/ronin/exploits/exceptions.rb +27 -17
- data/lib/ronin/exploits/exploit.rb +501 -582
- data/lib/ronin/exploits/heap_overflow.rb +50 -0
- data/lib/ronin/exploits/lfi.rb +141 -0
- data/lib/ronin/exploits/loot/file.rb +113 -0
- data/lib/ronin/exploits/loot.rb +119 -0
- data/lib/ronin/exploits/memory_corruption.rb +53 -0
- data/lib/ronin/exploits/metadata/arch.rb +83 -0
- data/lib/ronin/exploits/metadata/cookie_param.rb +80 -0
- data/lib/ronin/exploits/metadata/default_filename.rb +69 -0
- data/lib/ronin/exploits/metadata/default_port.rb +69 -0
- data/lib/ronin/exploits/metadata/header_name.rb +80 -0
- data/lib/ronin/exploits/metadata/os.rb +117 -0
- data/lib/ronin/exploits/metadata/shouts.rb +85 -0
- data/lib/ronin/exploits/metadata/url_path.rb +82 -0
- data/lib/ronin/exploits/metadata/url_query_param.rb +80 -0
- data/lib/ronin/exploits/mixins/binary.rb +106 -0
- data/lib/ronin/exploits/mixins/build_dir.rb +61 -0
- data/lib/ronin/exploits/mixins/file_builder.rb +102 -0
- data/lib/ronin/exploits/mixins/format_string.rb +87 -0
- data/lib/ronin/exploits/mixins/has_payload.rb +202 -0
- data/lib/ronin/exploits/mixins/has_targets.rb +297 -0
- data/lib/ronin/exploits/mixins/html.rb +213 -0
- data/lib/ronin/exploits/mixins/http.rb +866 -0
- data/lib/ronin/exploits/mixins/loot.rb +84 -0
- data/lib/ronin/exploits/mixins/nops.rb +121 -0
- data/lib/ronin/exploits/mixins/remote_tcp.rb +272 -0
- data/lib/ronin/exploits/mixins/remote_udp.rb +264 -0
- data/lib/ronin/exploits/mixins/seh.rb +136 -0
- data/lib/ronin/exploits/mixins/stack_overflow.rb +124 -0
- data/lib/ronin/exploits/mixins/text.rb +65 -0
- data/lib/ronin/exploits/mixins.rb +32 -0
- data/lib/ronin/exploits/open_redirect.rb +103 -0
- data/lib/ronin/exploits/params/base_url.rb +84 -0
- data/lib/ronin/exploits/params/bind_host.rb +53 -0
- data/lib/ronin/exploits/params/bind_port.rb +53 -0
- data/lib/ronin/exploits/params/filename.rb +71 -0
- data/lib/ronin/exploits/params/host.rb +56 -0
- data/lib/ronin/exploits/params/port.rb +71 -0
- data/lib/ronin/exploits/registry.rb +32 -0
- data/lib/ronin/exploits/rfi.rb +106 -0
- data/lib/ronin/exploits/root.rb +28 -0
- data/lib/ronin/exploits/seh_overflow.rb +90 -0
- data/lib/ronin/exploits/sqli.rb +172 -0
- data/lib/ronin/exploits/ssti.rb +108 -0
- data/lib/ronin/exploits/stack_overflow.rb +90 -0
- data/lib/ronin/exploits/target.rb +63 -103
- data/lib/ronin/exploits/test_result.rb +80 -0
- data/lib/ronin/exploits/use_after_free.rb +50 -0
- data/lib/ronin/exploits/version.rb +11 -12
- data/lib/ronin/exploits/web.rb +18 -89
- data/lib/ronin/exploits/web_vuln.rb +378 -0
- data/lib/ronin/exploits/xss.rb +102 -0
- data/lib/ronin/exploits.rb +19 -26
- data/man/ronin-exploits-irb.1 +31 -0
- data/man/ronin-exploits-irb.1.md +22 -0
- data/man/ronin-exploits-list.1 +37 -0
- data/man/ronin-exploits-list.1.md +27 -0
- data/man/ronin-exploits-new.1 +98 -0
- data/man/ronin-exploits-new.1.md +73 -0
- data/man/ronin-exploits-run.1 +117 -0
- data/man/ronin-exploits-run.1.md +87 -0
- data/man/ronin-exploits-show.1 +45 -0
- data/man/ronin-exploits-show.1.md +33 -0
- data/man/ronin-exploits.1 +55 -0
- data/man/ronin-exploits.1.md +41 -0
- data/ronin-exploits.gemspec +62 -0
- data/spec/advisory_spec.rb +71 -0
- data/spec/cli/exploit_command_spec.rb +68 -0
- data/spec/cli/exploit_methods_spec.rb +208 -0
- data/spec/cli/ruby_shell_spec.rb +14 -0
- data/spec/client_side_web_vuln_spec.rb +117 -0
- data/spec/exploit_spec.rb +538 -0
- data/spec/exploits_spec.rb +3 -4
- data/spec/heap_overflow_spec.rb +14 -0
- data/spec/lfi_spec.rb +162 -0
- data/spec/loot/file_spec.rb +131 -0
- data/spec/loot_spec.rb +138 -0
- data/spec/memory_corruption_spec.rb +22 -0
- data/spec/metadata/arch_spec.rb +82 -0
- data/spec/metadata/cookie_param_spec.rb +67 -0
- data/spec/metadata/default_filename_spec.rb +62 -0
- data/spec/metadata/default_port_spec.rb +62 -0
- data/spec/metadata/header_name_spec.rb +67 -0
- data/spec/metadata/os_spec.rb +164 -0
- data/spec/metadata/shouts_spec.rb +100 -0
- data/spec/metadata/url_path_spec.rb +67 -0
- data/spec/metadata/url_query_param_spec.rb +67 -0
- data/spec/mixins/binary_spec.rb +129 -0
- data/spec/mixins/build_dir.rb +66 -0
- data/spec/mixins/file_builder_spec.rb +67 -0
- data/spec/mixins/format_string_spec.rb +44 -0
- data/spec/mixins/has_payload_spec.rb +333 -0
- data/spec/mixins/has_targets_spec.rb +434 -0
- data/spec/mixins/html_spec.rb +772 -0
- data/spec/mixins/http_spec.rb +1227 -0
- data/spec/mixins/loot_spec.rb +20 -0
- data/spec/mixins/nops_spec.rb +165 -0
- data/spec/mixins/remote_tcp_spec.rb +217 -0
- data/spec/mixins/remote_udp_spec.rb +217 -0
- data/spec/mixins/seh_spec.rb +89 -0
- data/spec/mixins/stack_overflow_spec.rb +87 -0
- data/spec/mixins/text_spec.rb +43 -0
- data/spec/open_redirect_spec.rb +71 -0
- data/spec/params/base_url_spec.rb +71 -0
- data/spec/params/bind_host_spec.rb +34 -0
- data/spec/params/bind_port_spec.rb +35 -0
- data/spec/params/filename_spec.rb +77 -0
- data/spec/params/host_spec.rb +34 -0
- data/spec/params/port_spec.rb +77 -0
- data/spec/rfi_spec.rb +107 -0
- data/spec/seh_overflow_spec.rb +18 -0
- data/spec/spec_helper.rb +6 -10
- data/spec/sqli_spec.rb +306 -0
- data/spec/ssti_spec.rb +121 -0
- data/spec/stack_overflow_spec.rb +18 -0
- data/spec/target_spec.rb +92 -0
- data/spec/test_result_spec.rb +32 -0
- data/spec/use_after_free_spec.rb +14 -0
- data/spec/web_spec.rb +12 -0
- data/spec/web_vuln_spec.rb +854 -0
- data/spec/xss_spec.rb +69 -0
- metadata +356 -324
- data/Manifest.txt +0 -196
- data/README.txt +0 -274
- data/bin/ronin-exploit +0 -12
- data/bin/ronin-gen-binary-payload +0 -12
- data/bin/ronin-gen-exploit +0 -12
- data/bin/ronin-gen-ftp-exploit +0 -12
- data/bin/ronin-gen-http-exploit +0 -12
- data/bin/ronin-gen-local-exploit +0 -12
- data/bin/ronin-gen-nops +0 -12
- data/bin/ronin-gen-payload +0 -12
- data/bin/ronin-gen-remote-exploit +0 -12
- data/bin/ronin-gen-remote-tcp-exploit +0 -12
- data/bin/ronin-gen-remote-udp-exploit +0 -12
- data/bin/ronin-gen-shellcode +0 -12
- data/bin/ronin-gen-web-exploit +0 -12
- data/bin/ronin-payload +0 -12
- data/bin/ronin-payloads +0 -12
- data/lib/ronin/controls/behaviors.rb +0 -133
- data/lib/ronin/controls/exceptions/not_implemented.rb +0 -27
- data/lib/ronin/controls/exceptions/program_not_found.rb +0 -27
- data/lib/ronin/controls/exceptions.rb +0 -23
- data/lib/ronin/controls/file_system.rb +0 -145
- data/lib/ronin/controls/helpers/command_exec.rb +0 -143
- data/lib/ronin/controls/helpers/dir_create.rb +0 -42
- data/lib/ronin/controls/helpers/dir_listing.rb +0 -62
- data/lib/ronin/controls/helpers/dir_remove.rb +0 -42
- data/lib/ronin/controls/helpers/file_ctime.rb +0 -52
- data/lib/ronin/controls/helpers/file_mtime.rb +0 -53
- data/lib/ronin/controls/helpers/file_ownership.rb +0 -53
- data/lib/ronin/controls/helpers/file_read.rb +0 -62
- data/lib/ronin/controls/helpers/file_remove.rb +0 -51
- data/lib/ronin/controls/helpers/file_write.rb +0 -62
- data/lib/ronin/controls/helpers/memory_read.rb +0 -39
- data/lib/ronin/controls/helpers/memory_write.rb +0 -39
- data/lib/ronin/controls/helpers.rb +0 -33
- data/lib/ronin/controls.rb +0 -23
- data/lib/ronin/exploits/control.rb +0 -47
- data/lib/ronin/exploits/exceptions/exception.rb +0 -27
- data/lib/ronin/exploits/exceptions/exploit_not_built.rb +0 -29
- data/lib/ronin/exploits/exceptions/payload_size.rb +0 -29
- data/lib/ronin/exploits/exceptions/restricted_char.rb +0 -29
- data/lib/ronin/exploits/exceptions/target_data_missing.rb +0 -29
- data/lib/ronin/exploits/exceptions/target_unspecified.rb +0 -29
- data/lib/ronin/exploits/exceptions/unknown_helper.rb +0 -29
- data/lib/ronin/exploits/exploit_author.rb +0 -33
- data/lib/ronin/exploits/ftp.rb +0 -45
- data/lib/ronin/exploits/helpers/binary.rb +0 -50
- data/lib/ronin/exploits/helpers/buffer_overflow.rb +0 -115
- data/lib/ronin/exploits/helpers/file_based.rb +0 -112
- data/lib/ronin/exploits/helpers/format_string.rb +0 -117
- data/lib/ronin/exploits/helpers/padding.rb +0 -101
- data/lib/ronin/exploits/helpers.rb +0 -26
- data/lib/ronin/exploits/http.rb +0 -52
- data/lib/ronin/exploits/local.rb +0 -40
- data/lib/ronin/exploits/remote.rb +0 -40
- data/lib/ronin/exploits/remote_tcp.rb +0 -87
- data/lib/ronin/exploits/remote_udp.rb +0 -87
- data/lib/ronin/exploits/targets/buffer_overflow.rb +0 -46
- data/lib/ronin/exploits/targets/format_string.rb +0 -43
- data/lib/ronin/exploits/targets.rb +0 -27
- data/lib/ronin/exploits/verifiers.rb +0 -121
- data/lib/ronin/generators/exploits/exploit.rb +0 -70
- data/lib/ronin/generators/exploits/ftp.rb +0 -42
- data/lib/ronin/generators/exploits/http.rb +0 -42
- data/lib/ronin/generators/exploits/local.rb +0 -42
- data/lib/ronin/generators/exploits/remote.rb +0 -42
- data/lib/ronin/generators/exploits/remote_tcp.rb +0 -44
- data/lib/ronin/generators/exploits/remote_udp.rb +0 -44
- data/lib/ronin/generators/exploits/static.rb +0 -30
- data/lib/ronin/generators/exploits/web.rb +0 -45
- data/lib/ronin/generators/exploits.rb +0 -23
- data/lib/ronin/generators/payloads/binary_payload.rb +0 -42
- data/lib/ronin/generators/payloads/nops.rb +0 -42
- data/lib/ronin/generators/payloads/payload.rb +0 -66
- data/lib/ronin/generators/payloads/shellcode.rb +0 -42
- data/lib/ronin/generators/payloads/static.rb +0 -30
- data/lib/ronin/generators/payloads.rb +0 -23
- data/lib/ronin/model/has_default_port.rb +0 -54
- data/lib/ronin/model/targets_arch.rb +0 -68
- data/lib/ronin/model/targets_os.rb +0 -69
- data/lib/ronin/model/targets_product.rb +0 -68
- data/lib/ronin/payloads/asm_payload.rb +0 -40
- data/lib/ronin/payloads/binary_payload.rb +0 -42
- data/lib/ronin/payloads/control.rb +0 -47
- data/lib/ronin/payloads/encoders/encoder.rb +0 -92
- data/lib/ronin/payloads/encoders/xor.rb +0 -79
- data/lib/ronin/payloads/encoders.rb +0 -32
- data/lib/ronin/payloads/exceptions/exception.rb +0 -27
- data/lib/ronin/payloads/exceptions/not_implemented.rb +0 -29
- data/lib/ronin/payloads/exceptions/unknown_helper.rb +0 -29
- data/lib/ronin/payloads/exceptions.rb +0 -23
- data/lib/ronin/payloads/has_payload.rb +0 -111
- data/lib/ronin/payloads/helpers/chained.rb +0 -61
- data/lib/ronin/payloads/helpers/rpc.rb +0 -93
- data/lib/ronin/payloads/helpers.rb +0 -23
- data/lib/ronin/payloads/nops.rb +0 -39
- data/lib/ronin/payloads/payload.rb +0 -350
- data/lib/ronin/payloads/payload_author.rb +0 -33
- data/lib/ronin/payloads/shellcode.rb +0 -40
- data/lib/ronin/payloads/web_payload.rb +0 -41
- data/lib/ronin/payloads.rb +0 -36
- data/lib/ronin/ui/command_line/commands/exploit.rb +0 -193
- data/lib/ronin/ui/command_line/commands/exploits.rb +0 -154
- data/lib/ronin/ui/command_line/commands/gen_binary_payload.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_ftp_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_http_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_local_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_nops.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_payload.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_remote_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_remote_tcp_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_remote_udp_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_shellcode.rb +0 -34
- data/lib/ronin/ui/command_line/commands/gen_web_exploit.rb +0 -34
- data/lib/ronin/ui/command_line/commands/payload.rb +0 -129
- data/lib/ronin/ui/command_line/commands/payloads.rb +0 -128
- data/lib/ronin/vuln/behavior.rb +0 -165
- data/spec/controls/behaviors_examples.rb +0 -38
- data/spec/exploits/binary_exploit_spec.rb +0 -44
- data/spec/exploits/buffer_overflow_exploit_spec.rb +0 -70
- data/spec/exploits/exploit_spec.rb +0 -313
- data/spec/exploits/file_based_exploit_spec.rb +0 -48
- data/spec/exploits/format_string_exploit_spec.rb +0 -32
- data/spec/exploits/ftp_spec.rb +0 -13
- data/spec/exploits/http_spec.rb +0 -17
- data/spec/exploits/padding_exploit_spec.rb +0 -44
- data/spec/exploits/remote_tcp_spec.rb +0 -28
- data/spec/exploits/remote_udp_spec.rb +0 -28
- data/spec/exploits/target_spec.rb +0 -98
- data/spec/exploits/targets/buffer_overflow_spec.rb +0 -22
- data/spec/exploits/web_spec.rb +0 -35
- data/spec/generators/exploits/exploit_examples.rb +0 -24
- data/spec/generators/exploits/exploit_spec.rb +0 -42
- data/spec/generators/exploits/ftp_spec.rb +0 -42
- data/spec/generators/exploits/http_spec.rb +0 -42
- data/spec/generators/exploits/local_spec.rb +0 -42
- data/spec/generators/exploits/remote_spec.rb +0 -42
- data/spec/generators/exploits/remote_tcp_spec.rb +0 -47
- data/spec/generators/exploits/remote_udp_spec.rb +0 -47
- data/spec/generators/exploits/web_spec.rb +0 -52
- data/spec/generators/payloads/binary_payload_spec.rb +0 -31
- data/spec/generators/payloads/nops_spec.rb +0 -31
- data/spec/generators/payloads/payload_examples.rb +0 -16
- data/spec/generators/payloads/payload_spec.rb +0 -31
- data/spec/generators/payloads/shellcode_spec.rb +0 -31
- data/spec/helpers/database.rb +0 -5
- data/spec/helpers/objects.rb +0 -22
- data/spec/model/has_default_port_spec.rb +0 -27
- data/spec/model/models/default_port_model.rb +0 -13
- data/spec/model/models/non_default_port_model.rb +0 -11
- data/spec/model/models/targets_arch_model.rb +0 -11
- data/spec/model/models/targets_os_model.rb +0 -11
- data/spec/model/models/targets_product_model.rb +0 -11
- data/spec/model/targets_arch_spec.rb +0 -32
- data/spec/model/targets_os_spec.rb +0 -33
- data/spec/model/targets_product_spec.rb +0 -35
- data/spec/objects/exploits/example.rb +0 -25
- data/spec/objects/exploits/simple.rb +0 -24
- data/spec/objects/payloads/simple.rb +0 -19
- data/spec/payloads/encoders/encoder_spec.rb +0 -30
- data/spec/payloads/encoders/xor_spec.rb +0 -20
- data/spec/payloads/payload_spec.rb +0 -156
- data/spec/vuln/behavior_spec.rb +0 -15
- data/static/ronin/generators/exploits/_cache.erb +0 -14
- data/static/ronin/generators/exploits/_header.erb +0 -1
- data/static/ronin/generators/exploits/_helpers.erb +0 -4
- data/static/ronin/generators/exploits/exploit.erb +0 -24
- data/static/ronin/generators/exploits/ftp.erb +0 -24
- data/static/ronin/generators/exploits/http.erb +0 -26
- data/static/ronin/generators/exploits/local.erb +0 -24
- data/static/ronin/generators/exploits/remote.erb +0 -24
- data/static/ronin/generators/exploits/remote_tcp.erb +0 -26
- data/static/ronin/generators/exploits/remote_udp.erb +0 -26
- data/static/ronin/generators/exploits/web.erb +0 -28
- data/static/ronin/generators/payloads/_cache.erb +0 -10
- data/static/ronin/generators/payloads/_header.erb +0 -1
- data/static/ronin/generators/payloads/_helpers.erb +0 -2
- data/static/ronin/generators/payloads/binary_payload.erb +0 -25
- data/static/ronin/generators/payloads/nops.erb +0 -19
- data/static/ronin/generators/payloads/payload.erb +0 -25
- data/static/ronin/generators/payloads/shellcode.erb +0 -25
- data/tasks/spec.rb +0 -10
- data/tasks/yard.rb +0 -13
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -0
@@ -0,0 +1,866 @@
|
|
1
|
+
#
|
2
|
+
# ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
|
3
|
+
# payload crafting functionality.
|
4
|
+
#
|
5
|
+
# Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
|
6
|
+
#
|
7
|
+
# ronin-exploits is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# ronin-exploits is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
require 'ronin/support/network/http'
|
22
|
+
require 'ronin/exploits/params/base_url'
|
23
|
+
|
24
|
+
module Ronin
|
25
|
+
module Exploits
|
26
|
+
module Mixins
|
27
|
+
#
|
28
|
+
# Adds HTTP helper methods for communicating with a web server.
|
29
|
+
#
|
30
|
+
# @api public
|
31
|
+
#
|
32
|
+
# @since 1.0.0
|
33
|
+
#
|
34
|
+
module HTTP
|
35
|
+
#
|
36
|
+
# Adds the required `base_url` params to the exploit class.
|
37
|
+
#
|
38
|
+
# @param [Class<Ronin::Exploits::Exploit>] exploit
|
39
|
+
# The exploit class that included {Mixins::HTTP}.
|
40
|
+
#
|
41
|
+
# @api private
|
42
|
+
#
|
43
|
+
def self.included(exploit)
|
44
|
+
exploit.include Params::BaseURL
|
45
|
+
|
46
|
+
exploit.param :http_proxy, desc: 'The HTTP proxy to use'
|
47
|
+
|
48
|
+
exploit.param :http_user, desc: 'The HTTP Basic-Auth user'
|
49
|
+
|
50
|
+
exploit.param :http_password, desc: 'The HTTP Basic-Auth password'
|
51
|
+
|
52
|
+
user_agent_ids = [
|
53
|
+
:random,
|
54
|
+
:chrome,
|
55
|
+
:firefox,
|
56
|
+
:safari,
|
57
|
+
:linux,
|
58
|
+
:macos,
|
59
|
+
:windows,
|
60
|
+
:iphone,
|
61
|
+
:ipad,
|
62
|
+
:android
|
63
|
+
] + Support::Network::HTTP::UserAgents::ALIASES.keys
|
64
|
+
exploit.param :user_agent, Core::Params::Types::Enum.new(user_agent_ids), desc: 'The HTTP User-Agent to select'
|
65
|
+
|
66
|
+
exploit.param :raw_user_agent, desc: 'The raw HTTP User-Agent string to use'
|
67
|
+
|
68
|
+
exploit.param :http_cookie, desc: 'The raw HTTP Cookie to use'
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# The HTTP proxy to use for all HTTP requests.
|
73
|
+
#
|
74
|
+
# @return [String, nil]
|
75
|
+
#
|
76
|
+
# @api private
|
77
|
+
#
|
78
|
+
def http_proxy
|
79
|
+
params[:http_proxy]
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# The HTTP `Basic-Auth` user to use for all HTTP requests.
|
84
|
+
#
|
85
|
+
# @return [String, nil]
|
86
|
+
#
|
87
|
+
# @api private
|
88
|
+
#
|
89
|
+
def http_user
|
90
|
+
params[:http_user]
|
91
|
+
end
|
92
|
+
|
93
|
+
#
|
94
|
+
# The HTTP `Basic-Auth` password to use for all HTTP requests.
|
95
|
+
#
|
96
|
+
# @return [String, nil]
|
97
|
+
#
|
98
|
+
# @api private
|
99
|
+
#
|
100
|
+
def http_password
|
101
|
+
params[:http_password]
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Additional default headers to send with every HTTP request.
|
106
|
+
#
|
107
|
+
# @return [Hash{Symbol,String => String,Array}]
|
108
|
+
#
|
109
|
+
# @api private
|
110
|
+
#
|
111
|
+
def http_headers
|
112
|
+
{}
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# The `User-Agent` to use for HTTP requests.
|
117
|
+
#
|
118
|
+
# @return [String, Symbol, :random, nil]
|
119
|
+
# The `User-Agent` string or an alias name (ex: `:chrome_linux`).
|
120
|
+
#
|
121
|
+
# @api private
|
122
|
+
#
|
123
|
+
def http_user_agent
|
124
|
+
params[:raw_user_agent] || params[:user_agent]
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# The `Cookie` to use for HTTP requests.
|
129
|
+
#
|
130
|
+
# @return [String, nil]
|
131
|
+
#
|
132
|
+
# @api private
|
133
|
+
#
|
134
|
+
def http_cookie
|
135
|
+
params[:http_cookie]
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# @!macro request_kwargs
|
140
|
+
# @option kwargs [String, nil] :user (http_user)
|
141
|
+
# The `Basic-Auth` user to authenticate as.
|
142
|
+
#
|
143
|
+
# @option kwargs [String, nil] :password (http_password)
|
144
|
+
# The `Basic-Auth` password to authenticate with.
|
145
|
+
#
|
146
|
+
# @option kwargs [String, nil] :query
|
147
|
+
# The query-string to append to the request path.
|
148
|
+
#
|
149
|
+
# @option kwargs [Hash, nil] :query_params
|
150
|
+
# The query-params to append to the request path.
|
151
|
+
#
|
152
|
+
# @option kwargs [String, nil] :body
|
153
|
+
# The body of the request.
|
154
|
+
#
|
155
|
+
# @option kwargs [Hash, String, nil] :form_data
|
156
|
+
# The form data that may be sent in the body of the request.
|
157
|
+
#
|
158
|
+
# @option kwargs [String, nil] :user (http_user)
|
159
|
+
# The user to authenticate as.
|
160
|
+
#
|
161
|
+
# @option kwargs [String, nil] :password (http_password)
|
162
|
+
# The password to authenticate with.
|
163
|
+
#
|
164
|
+
# @option kwargs [Hash{Symbol,String => String}, nil] :headers
|
165
|
+
# Additional HTTP headers to use for the request.
|
166
|
+
#
|
167
|
+
|
168
|
+
#
|
169
|
+
# A persistent HTTP connection to the target host and port.
|
170
|
+
#
|
171
|
+
# @return [Ronin::Support::Network::HTTP]
|
172
|
+
# The HTTP connection.
|
173
|
+
#
|
174
|
+
# @note
|
175
|
+
# This method will lazily initialize the HTTP connection on the first
|
176
|
+
# time this method is called and memoize the HTTP object.
|
177
|
+
#
|
178
|
+
def http
|
179
|
+
@http ||= Support::Network::HTTP.connect_uri(
|
180
|
+
params[:base_url], proxy: http_proxy,
|
181
|
+
headers: http_headers,
|
182
|
+
user_agent: http_user_agent,
|
183
|
+
cookie: http_cookie,
|
184
|
+
user: http_user,
|
185
|
+
password: http_password
|
186
|
+
)
|
187
|
+
end
|
188
|
+
|
189
|
+
#
|
190
|
+
# Performs and arbitrary HTTP request.
|
191
|
+
#
|
192
|
+
# @param [Symbol, String] method
|
193
|
+
# The HTTP method to use for the request.
|
194
|
+
#
|
195
|
+
# @param [String] path
|
196
|
+
# The path to create the HTTP request for.
|
197
|
+
#
|
198
|
+
# @!macro request_kwargs
|
199
|
+
#
|
200
|
+
# @yield [response]
|
201
|
+
# If a block is given it will be passed the received HTTP response.
|
202
|
+
#
|
203
|
+
# @yieldparam [Net::HTTPRresponse] response
|
204
|
+
# The received HTTP response object.
|
205
|
+
#
|
206
|
+
# @return [Net::HTTPResponse]
|
207
|
+
# The new HTTP Request object.
|
208
|
+
#
|
209
|
+
# @raise [ArgumentError]
|
210
|
+
# The `:method` option did not match a known `Net::HTTP` request
|
211
|
+
# class.
|
212
|
+
#
|
213
|
+
def http_request(method,path,**kwargs,&block)
|
214
|
+
if debug?
|
215
|
+
print_debug "Sending #{method.upcase} request to #{url_for(path)} ..."
|
216
|
+
end
|
217
|
+
|
218
|
+
http.request(method,path,**kwargs,&block)
|
219
|
+
end
|
220
|
+
|
221
|
+
#
|
222
|
+
# Sends an arbitrary HTTP request and returns the response status.
|
223
|
+
#
|
224
|
+
# @param [Symbol, String] method
|
225
|
+
# The HTTP method to use for the request.
|
226
|
+
#
|
227
|
+
# @param [String] path
|
228
|
+
# The path to create the HTTP request for.
|
229
|
+
#
|
230
|
+
# @!macro request_kwargs
|
231
|
+
#
|
232
|
+
# @return [Integer]
|
233
|
+
# The status code of the response.
|
234
|
+
#
|
235
|
+
def http_response_status(method=:head,path,**kwargs)
|
236
|
+
if debug?
|
237
|
+
print_debug "Checking response status for #{method.upcase} #{url_for(path)} ..."
|
238
|
+
end
|
239
|
+
|
240
|
+
http.response_status(method,path,**kwargs)
|
241
|
+
end
|
242
|
+
|
243
|
+
#
|
244
|
+
# Sends a HTTP request and determines if the response status was 200.
|
245
|
+
#
|
246
|
+
# @param [Symbol, String] method
|
247
|
+
# The HTTP method to use for the request.
|
248
|
+
#
|
249
|
+
# @param [String] path
|
250
|
+
# The path to create the HTTP request for.
|
251
|
+
#
|
252
|
+
# @!macro request_kwargs
|
253
|
+
#
|
254
|
+
# @return [Boolean]
|
255
|
+
# Indicates that the response status was 200.
|
256
|
+
#
|
257
|
+
def http_ok?(method=:head,path,**kwargs)
|
258
|
+
if debug?
|
259
|
+
print_debug "Checking if response status for #{method.upcase} #{url_for(path)} is 200 ..."
|
260
|
+
end
|
261
|
+
|
262
|
+
http.ok?(method,path,**kwargs)
|
263
|
+
end
|
264
|
+
|
265
|
+
#
|
266
|
+
# Sends an arbitrary HTTP request and returns the response headers.
|
267
|
+
#
|
268
|
+
# @param [Symbol, String] method
|
269
|
+
# The HTTP method to use for the request.
|
270
|
+
#
|
271
|
+
# @param [String] path
|
272
|
+
# The path to create the HTTP request for.
|
273
|
+
#
|
274
|
+
# @!macro request_kwargs
|
275
|
+
#
|
276
|
+
# @return [Hash{String => String}]
|
277
|
+
# The response headers.
|
278
|
+
#
|
279
|
+
def http_response_headers(method=:head,path,**kwargs)
|
280
|
+
if debug?
|
281
|
+
print_debug "Requesting response headers for #{method.upcase} #{url_for(path)} ..."
|
282
|
+
end
|
283
|
+
|
284
|
+
http.response_headers(method,path,**kwargs)
|
285
|
+
end
|
286
|
+
|
287
|
+
#
|
288
|
+
# Sends an HTTP request and returns the `Server` header.
|
289
|
+
#
|
290
|
+
# @param [String] path
|
291
|
+
# The path to create the HTTP request for.
|
292
|
+
#
|
293
|
+
# @param [:copy, :delete, :get, :head, :lock, :mkcol, :move,
|
294
|
+
# :options, :patch, :post, :propfind, :proppatch, :put,
|
295
|
+
# :trace, :unlock] method
|
296
|
+
# The HTTP method to use for the request.
|
297
|
+
#
|
298
|
+
# @!macro request_kwargs
|
299
|
+
#
|
300
|
+
# @return [String, nil]
|
301
|
+
# The `Server` header.
|
302
|
+
#
|
303
|
+
def http_server_header(path, method: :head, **kwargs)
|
304
|
+
if debug?
|
305
|
+
print_debug "Requesting the 'Server' header for #{method.upcase} #{url_for(path)} ..."
|
306
|
+
end
|
307
|
+
|
308
|
+
http.server_header(path, method: method, **kwargs)
|
309
|
+
end
|
310
|
+
|
311
|
+
#
|
312
|
+
# Sends an HTTP request and returns the `X-Powered-By` header.
|
313
|
+
#
|
314
|
+
# @param [String] path
|
315
|
+
# The path to create the HTTP request for.
|
316
|
+
#
|
317
|
+
# @param [:copy, :delete, :get, :head, :lock, :mkcol, :move,
|
318
|
+
# :options, :patch, :post, :propfind, :proppatch, :put,
|
319
|
+
# :trace, :unlock] method
|
320
|
+
# The HTTP method to use for the request.
|
321
|
+
#
|
322
|
+
# @!macro request_kwargs
|
323
|
+
#
|
324
|
+
# @return [String, nil]
|
325
|
+
# The `X-Powered-By` header.
|
326
|
+
#
|
327
|
+
def http_powered_by_header(path, method: :head, **kwargs)
|
328
|
+
if debug?
|
329
|
+
print_debug "Requesting the 'X-Powered-By' header for #{method.upcase} #{url_for(path)} ..."
|
330
|
+
end
|
331
|
+
|
332
|
+
http.powered_by_header(path, method: method, **kwargs)
|
333
|
+
end
|
334
|
+
|
335
|
+
#
|
336
|
+
# Sends an arbitrary HTTP request and returns the response body.
|
337
|
+
#
|
338
|
+
# @param [Symbol, String] method
|
339
|
+
# The HTTP method to use for the request.
|
340
|
+
#
|
341
|
+
# @param [String] path
|
342
|
+
# The path to create the HTTP request for.
|
343
|
+
#
|
344
|
+
# @!macro request_kwargs
|
345
|
+
#
|
346
|
+
# @return [String]
|
347
|
+
# The response body.
|
348
|
+
#
|
349
|
+
def http_response_body(method=:get, path,**kwargs)
|
350
|
+
if debug?
|
351
|
+
print_debug "Requesting response body for #{method.upcase} #{url_for(path)} ..."
|
352
|
+
end
|
353
|
+
|
354
|
+
http.response_body(method, path,**kwargs)
|
355
|
+
end
|
356
|
+
|
357
|
+
#
|
358
|
+
# Performs a `COPY` request for the given URI.
|
359
|
+
#
|
360
|
+
# @param [String] path
|
361
|
+
# The path to create the HTTP request for.
|
362
|
+
#
|
363
|
+
# @!macro request_kwargs
|
364
|
+
#
|
365
|
+
# @yield [response]
|
366
|
+
# If a block is given it will be passed the received HTTP response.
|
367
|
+
#
|
368
|
+
# @yieldparam [Net::HTTPRresponse] response
|
369
|
+
# The received HTTP response object.
|
370
|
+
#
|
371
|
+
# @return [Net::HTTPResponse]
|
372
|
+
# The new HTTP Request object.
|
373
|
+
#
|
374
|
+
def http_copy(path,**kwargs)
|
375
|
+
if debug?
|
376
|
+
print_debug "Requesting COPY #{url_for(path)} ..."
|
377
|
+
end
|
378
|
+
|
379
|
+
http.copy(path,**kwargs)
|
380
|
+
end
|
381
|
+
|
382
|
+
#
|
383
|
+
# Performs a `DELETE` request for the given URI.
|
384
|
+
#
|
385
|
+
# @param [String] path
|
386
|
+
# The path to create the HTTP request for.
|
387
|
+
#
|
388
|
+
# @!macro request_kwargs
|
389
|
+
#
|
390
|
+
# @yield [response]
|
391
|
+
# If a block is given it will be passed the received HTTP response.
|
392
|
+
#
|
393
|
+
# @yieldparam [Net::HTTPRresponse] response
|
394
|
+
# The received HTTP response object.
|
395
|
+
#
|
396
|
+
# @return [Net::HTTPResponse]
|
397
|
+
# The new HTTP Request object.
|
398
|
+
#
|
399
|
+
def http_delete(path,**kwargs,&block)
|
400
|
+
if debug?
|
401
|
+
print_debug "Requesting DELETE #{url_for(path)} ..."
|
402
|
+
end
|
403
|
+
|
404
|
+
http.delete(path,**kwargs)
|
405
|
+
end
|
406
|
+
|
407
|
+
#
|
408
|
+
# Performs a `GET` request for the given URI.
|
409
|
+
#
|
410
|
+
# @param [String] path
|
411
|
+
# The path to create the HTTP request for.
|
412
|
+
#
|
413
|
+
# @!macro request_kwargs
|
414
|
+
#
|
415
|
+
# @yield [response]
|
416
|
+
# If a block is given it will be passed the received HTTP response.
|
417
|
+
#
|
418
|
+
# @yieldparam [Net::HTTPRresponse] response
|
419
|
+
# The received HTTP response object.
|
420
|
+
#
|
421
|
+
# @return [Net::HTTPResponse]
|
422
|
+
# The new HTTP Request object.
|
423
|
+
#
|
424
|
+
def http_get(path,**kwargs,&block)
|
425
|
+
if debug?
|
426
|
+
print_debug "Requesting GET #{url_for(path)} ..."
|
427
|
+
end
|
428
|
+
|
429
|
+
http.get(path,**kwargs)
|
430
|
+
end
|
431
|
+
|
432
|
+
#
|
433
|
+
# Performs a `GET` request for the given URI and returns the response
|
434
|
+
# headers.
|
435
|
+
#
|
436
|
+
# @param [String] path
|
437
|
+
# The path to create the HTTP request for.
|
438
|
+
#
|
439
|
+
# @!macro request_kwargs
|
440
|
+
#
|
441
|
+
# @return [Hash{String => String}]
|
442
|
+
# The response headers.
|
443
|
+
#
|
444
|
+
def http_get_headers(path,**kwargs)
|
445
|
+
if debug?
|
446
|
+
print_debug "Requesting headers for GET #{url_for(path)} ..."
|
447
|
+
end
|
448
|
+
|
449
|
+
http.get_headers(path,**kwargs)
|
450
|
+
end
|
451
|
+
|
452
|
+
#
|
453
|
+
# Sends an HTTP request and returns the parsed `Set-Cookie`
|
454
|
+
# header(s).
|
455
|
+
#
|
456
|
+
# @param [String] path
|
457
|
+
# The path to create the HTTP request for.
|
458
|
+
#
|
459
|
+
# @!macro request_kwargs
|
460
|
+
#
|
461
|
+
# @return [Array<Ronin::Support::Network::HTTPSetCookie>, nil]
|
462
|
+
# The parsed `SetCookie` header(s).
|
463
|
+
#
|
464
|
+
def http_get_cookies(path,**kwargs)
|
465
|
+
if debug?
|
466
|
+
print_debug "Getting cookies for #{url_for(path)} ..."
|
467
|
+
end
|
468
|
+
|
469
|
+
http.get_cookies(path,**kwargs)
|
470
|
+
end
|
471
|
+
|
472
|
+
#
|
473
|
+
# Performs a `GET` request for the given URI and returns the response
|
474
|
+
# body.
|
475
|
+
#
|
476
|
+
# @param [String] path
|
477
|
+
# The path to create the HTTP request for.
|
478
|
+
#
|
479
|
+
# @!macro request_kwargs
|
480
|
+
#
|
481
|
+
# @return [String]
|
482
|
+
# The response body.
|
483
|
+
#
|
484
|
+
def http_get_body(path,**kwargs)
|
485
|
+
if debug?
|
486
|
+
print_debug "Requesting body for GET #{url_for(path)} ..."
|
487
|
+
end
|
488
|
+
|
489
|
+
http.get_body(path,**kwargs)
|
490
|
+
end
|
491
|
+
|
492
|
+
#
|
493
|
+
# Performs a `HEAD` request for the given URI.
|
494
|
+
#
|
495
|
+
# @param [String] path
|
496
|
+
# The path to create the HTTP request for.
|
497
|
+
#
|
498
|
+
# @!macro request_kwargs
|
499
|
+
#
|
500
|
+
# @yield [response]
|
501
|
+
# If a block is given it will be passed the received HTTP response.
|
502
|
+
#
|
503
|
+
# @yieldparam [Net::HTTPRresponse] response
|
504
|
+
# The received HTTP response object.
|
505
|
+
#
|
506
|
+
# @return [Net::HTTPResponse]
|
507
|
+
# The new HTTP Request object.
|
508
|
+
#
|
509
|
+
def http_head(path,**kwargs,&block)
|
510
|
+
if debug?
|
511
|
+
print_debug "Requesting HEAD #{url_for(path)} ..."
|
512
|
+
end
|
513
|
+
|
514
|
+
http.head(path,**kwargs,&block)
|
515
|
+
end
|
516
|
+
|
517
|
+
#
|
518
|
+
# Performs a `LOCK` request for the given URI.
|
519
|
+
#
|
520
|
+
# @param [String] path
|
521
|
+
# The path to create the HTTP request for.
|
522
|
+
#
|
523
|
+
# @!macro request_kwargs
|
524
|
+
#
|
525
|
+
# @yield [response]
|
526
|
+
# If a block is given it will be passed the received HTTP response.
|
527
|
+
#
|
528
|
+
# @yieldparam [Net::HTTPRresponse] response
|
529
|
+
# The received HTTP response object.
|
530
|
+
#
|
531
|
+
# @return [Net::HTTPResponse]
|
532
|
+
# The new HTTP Request object.
|
533
|
+
#
|
534
|
+
def http_lock(path,**kwargs,&block)
|
535
|
+
if debug?
|
536
|
+
print_debug "Requesting LOCK #{url_for(path)} ..."
|
537
|
+
end
|
538
|
+
|
539
|
+
http.lock(path,**kwargs,&block)
|
540
|
+
end
|
541
|
+
|
542
|
+
#
|
543
|
+
# Performs a `MKCOL` request for the given URI.
|
544
|
+
#
|
545
|
+
# @param [String] path
|
546
|
+
# The path to create the HTTP request for.
|
547
|
+
#
|
548
|
+
# @!macro request_kwargs
|
549
|
+
#
|
550
|
+
# @yield [response]
|
551
|
+
# If a block is given it will be passed the received HTTP response.
|
552
|
+
#
|
553
|
+
# @yieldparam [Net::HTTPRresponse] response
|
554
|
+
# The received HTTP response object.
|
555
|
+
#
|
556
|
+
# @return [Net::HTTPResponse]
|
557
|
+
# The new HTTP Request object.
|
558
|
+
#
|
559
|
+
def http_mkcol(path,**kwargs,&block)
|
560
|
+
if debug?
|
561
|
+
print_debug "Requesting MKCOL #{url_for(path)} ..."
|
562
|
+
end
|
563
|
+
|
564
|
+
http.mkcol(path,**kwargs,&block)
|
565
|
+
end
|
566
|
+
|
567
|
+
#
|
568
|
+
# Performs a `MOVE` request for the given URI.
|
569
|
+
#
|
570
|
+
# @param [String] path
|
571
|
+
# The path to create the HTTP request for.
|
572
|
+
#
|
573
|
+
# @!macro request_kwargs
|
574
|
+
#
|
575
|
+
# @yield [response]
|
576
|
+
# If a block is given it will be passed the received HTTP response.
|
577
|
+
#
|
578
|
+
# @yieldparam [Net::HTTPRresponse] response
|
579
|
+
# The received HTTP response object.
|
580
|
+
#
|
581
|
+
# @return [Net::HTTPResponse]
|
582
|
+
# The new HTTP Request object.
|
583
|
+
#
|
584
|
+
def http_move(path,**kwargs,&block)
|
585
|
+
if debug?
|
586
|
+
print_debug "Requesting MOVE #{url_for(path)} ..."
|
587
|
+
end
|
588
|
+
|
589
|
+
http.move(path,**kwargs,&block)
|
590
|
+
end
|
591
|
+
|
592
|
+
#
|
593
|
+
# Performs a `OPTIONS` request for the given URI.
|
594
|
+
#
|
595
|
+
# @param [String] path
|
596
|
+
# The path to create the HTTP request for.
|
597
|
+
#
|
598
|
+
# @!macro request_kwargs
|
599
|
+
#
|
600
|
+
# @yield [response]
|
601
|
+
# If a block is given it will be passed the received HTTP response.
|
602
|
+
#
|
603
|
+
# @yieldparam [Net::HTTPRresponse] response
|
604
|
+
# The received HTTP response object.
|
605
|
+
#
|
606
|
+
# @return [Net::HTTPResponse]
|
607
|
+
# The new HTTP Request object.
|
608
|
+
#
|
609
|
+
def http_options(path,**kwargs,&block)
|
610
|
+
if debug?
|
611
|
+
print_debug "Requesting OPTIONS #{url_for(path)} ..."
|
612
|
+
end
|
613
|
+
|
614
|
+
http.options(path,**kwargs,&block)
|
615
|
+
end
|
616
|
+
|
617
|
+
#
|
618
|
+
# Performs a `OPTIONS` HTTP request for the given URI and parses the
|
619
|
+
# `Allow` response header.
|
620
|
+
#
|
621
|
+
# @param [String] path
|
622
|
+
# The path to create the HTTP request for.
|
623
|
+
#
|
624
|
+
# @!macro request_kwargs
|
625
|
+
#
|
626
|
+
# @yield [response]
|
627
|
+
# If a block is given it will be passed the received HTTP response.
|
628
|
+
#
|
629
|
+
# @yieldparam [Net::HTTPRresponse] response
|
630
|
+
# The received HTTP response object.
|
631
|
+
#
|
632
|
+
# @return [Array<Symbol>]
|
633
|
+
# The allowed HTTP request methods for the given URL.
|
634
|
+
#
|
635
|
+
def http_allowed_methods(path,**kwargs,&block)
|
636
|
+
if debug?
|
637
|
+
print_debug "Checking allowed HTTP methods for #{url_for(path)} ..."
|
638
|
+
end
|
639
|
+
|
640
|
+
http.allowed_methods(path,**kwargs)
|
641
|
+
end
|
642
|
+
|
643
|
+
#
|
644
|
+
# Performs a `PATCH` request for the given URI.
|
645
|
+
#
|
646
|
+
# @param [String] path
|
647
|
+
# The path to create the HTTP request for.
|
648
|
+
#
|
649
|
+
# @!macro request_kwargs
|
650
|
+
#
|
651
|
+
# @yield [response]
|
652
|
+
# If a block is given it will be passed the received HTTP response.
|
653
|
+
#
|
654
|
+
# @yieldparam [Net::HTTPRresponse] response
|
655
|
+
# The received HTTP response object.
|
656
|
+
#
|
657
|
+
# @return [Net::HTTPResponse]
|
658
|
+
# The new HTTP Request object.
|
659
|
+
#
|
660
|
+
# @see Network::HTTP.patch
|
661
|
+
#
|
662
|
+
def http_patch(path,**kwargs,&block)
|
663
|
+
if debug?
|
664
|
+
print_debug "Requesting PATCH #{url_for(path)} ..."
|
665
|
+
end
|
666
|
+
|
667
|
+
http.patch(path,**kwargs,&block)
|
668
|
+
end
|
669
|
+
|
670
|
+
#
|
671
|
+
# Performs a `POST` request for the given URI.
|
672
|
+
#
|
673
|
+
# @param [String] path
|
674
|
+
# The path to create the HTTP request for.
|
675
|
+
#
|
676
|
+
# @!macro request_kwargs
|
677
|
+
#
|
678
|
+
# @yield [response]
|
679
|
+
# If a block is given it will be passed the received HTTP response.
|
680
|
+
#
|
681
|
+
# @yieldparam [Net::HTTPRresponse] response
|
682
|
+
# The received HTTP response object.
|
683
|
+
#
|
684
|
+
# @return [Net::HTTPResponse]
|
685
|
+
# The new HTTP Request object.
|
686
|
+
#
|
687
|
+
def http_post(path,**kwargs,&block)
|
688
|
+
if debug?
|
689
|
+
print_debug "Requesting POST #{url_for(path)} ..."
|
690
|
+
end
|
691
|
+
|
692
|
+
http.post(path,**kwargs,&block)
|
693
|
+
end
|
694
|
+
|
695
|
+
#
|
696
|
+
# Performs a `POST` request on the given URI and returns the response
|
697
|
+
# headers.
|
698
|
+
#
|
699
|
+
# @param [String] path
|
700
|
+
# The path to create the HTTP request for.
|
701
|
+
#
|
702
|
+
# @!macro request_kwargs
|
703
|
+
#
|
704
|
+
# @return [Hash{String => String}]
|
705
|
+
# The response headers.
|
706
|
+
#
|
707
|
+
def http_post_headers(path,**kwargs)
|
708
|
+
if debug?
|
709
|
+
print_debug "Requesting response headers for POST #{url_for(path)} ..."
|
710
|
+
end
|
711
|
+
|
712
|
+
http.post_headers(path,**kwargs)
|
713
|
+
end
|
714
|
+
|
715
|
+
#
|
716
|
+
# Performs a `POST` request for the given URI and returns the
|
717
|
+
# response body.
|
718
|
+
#
|
719
|
+
# @param [String] path
|
720
|
+
# The path to create the HTTP request for.
|
721
|
+
#
|
722
|
+
# @!macro request_kwargs
|
723
|
+
#
|
724
|
+
# @return [String]
|
725
|
+
# The response body.
|
726
|
+
#
|
727
|
+
def http_post_body(path,**kwargs)
|
728
|
+
if debug?
|
729
|
+
print_debug "Requesting response body for POST #{url_for(path)} ..."
|
730
|
+
end
|
731
|
+
|
732
|
+
http.post_body(path,**kwargs)
|
733
|
+
end
|
734
|
+
|
735
|
+
#
|
736
|
+
# Performs a `PROPFIND` request for the given URI.
|
737
|
+
#
|
738
|
+
# @param [String] path
|
739
|
+
# The path to create the HTTP request for.
|
740
|
+
#
|
741
|
+
# @!macro request_kwargs
|
742
|
+
#
|
743
|
+
# @yield [response]
|
744
|
+
# If a block is given it will be passed the received HTTP response.
|
745
|
+
#
|
746
|
+
# @yieldparam [Net::HTTPRresponse] response
|
747
|
+
# The received HTTP response object.
|
748
|
+
#
|
749
|
+
# @return [Net::HTTPResponse]
|
750
|
+
# The new HTTP Request object.
|
751
|
+
#
|
752
|
+
def http_propfind(path,**kwargs,&block)
|
753
|
+
if debug?
|
754
|
+
print_debug "Requesting PROPFIND #{url_for(path)} ..."
|
755
|
+
end
|
756
|
+
|
757
|
+
http.propfind(path,**kwargs,&block)
|
758
|
+
end
|
759
|
+
|
760
|
+
alias http_prop_find http_propfind
|
761
|
+
|
762
|
+
#
|
763
|
+
# Performs a `PROPPATCH` request for the given URI.
|
764
|
+
#
|
765
|
+
# @param [String] path
|
766
|
+
# The path to create the HTTP request for.
|
767
|
+
#
|
768
|
+
# @!macro request_kwargs
|
769
|
+
#
|
770
|
+
# @yield [response]
|
771
|
+
# If a block is given it will be passed the received HTTP response.
|
772
|
+
#
|
773
|
+
# @yieldparam [Net::HTTPRresponse] response
|
774
|
+
# The received HTTP response object.
|
775
|
+
#
|
776
|
+
# @return [Net::HTTPResponse]
|
777
|
+
# The new HTTP Request object.
|
778
|
+
#
|
779
|
+
def http_proppatch(path,**kwargs,&block)
|
780
|
+
if debug?
|
781
|
+
print_debug "Requesting PROPPATCH #{url_for(path)} ..."
|
782
|
+
end
|
783
|
+
|
784
|
+
http.proppatch(path,**kwargs,&block)
|
785
|
+
end
|
786
|
+
|
787
|
+
alias http_prop_patch http_proppatch
|
788
|
+
|
789
|
+
#
|
790
|
+
# Performs a `PUT` request for the given URI.
|
791
|
+
#
|
792
|
+
# @param [String] path
|
793
|
+
# The path to create the HTTP request for.
|
794
|
+
#
|
795
|
+
# @!macro request_kwargs
|
796
|
+
#
|
797
|
+
# @yield [response]
|
798
|
+
# If a block is given it will be passed the received HTTP response.
|
799
|
+
#
|
800
|
+
# @yieldparam [Net::HTTPRresponse] response
|
801
|
+
# The received HTTP response object.
|
802
|
+
#
|
803
|
+
# @return [Net::HTTPResponse]
|
804
|
+
# The new HTTP Request object.
|
805
|
+
#
|
806
|
+
def http_put(path,**kwargs,&block)
|
807
|
+
if debug?
|
808
|
+
print_debug "Requesting PUT #{url_for(path)} ..."
|
809
|
+
end
|
810
|
+
|
811
|
+
http.put(path,**kwargs,&block)
|
812
|
+
end
|
813
|
+
|
814
|
+
#
|
815
|
+
# Performs a `TRACE` request for the given URI.
|
816
|
+
#
|
817
|
+
# @param [String] path
|
818
|
+
# The path to create the HTTP request for.
|
819
|
+
#
|
820
|
+
# @!macro request_kwargs
|
821
|
+
#
|
822
|
+
# @yield [response]
|
823
|
+
# If a block is given it will be passed the received HTTP response.
|
824
|
+
#
|
825
|
+
# @yieldparam [Net::HTTPRresponse] response
|
826
|
+
# The received HTTP response object.
|
827
|
+
#
|
828
|
+
# @return [Net::HTTPResponse]
|
829
|
+
# The new HTTP Request object.
|
830
|
+
#
|
831
|
+
def http_trace(path,**kwargs,&block)
|
832
|
+
if debug?
|
833
|
+
print_debug "Requesting TRACE #{url_for(path)} ..."
|
834
|
+
end
|
835
|
+
|
836
|
+
http.trace(path,**kwargs,&block)
|
837
|
+
end
|
838
|
+
|
839
|
+
#
|
840
|
+
# Performs a `UNLOCK` request for the given URI.
|
841
|
+
#
|
842
|
+
# @param [String] path
|
843
|
+
# The path to create the HTTP request for.
|
844
|
+
#
|
845
|
+
# @!macro request_kwargs
|
846
|
+
#
|
847
|
+
# @yield [response]
|
848
|
+
# If a block is given it will be passed the received HTTP response.
|
849
|
+
#
|
850
|
+
# @yieldparam [Net::HTTPRresponse] response
|
851
|
+
# The received HTTP response object.
|
852
|
+
#
|
853
|
+
# @return [Net::HTTPResponse]
|
854
|
+
# The new HTTP Request object.
|
855
|
+
#
|
856
|
+
def http_unlock(path,**kwargs,&block)
|
857
|
+
if debug?
|
858
|
+
print_debug "Requesting UNLOCK #{url_for(path)} ..."
|
859
|
+
end
|
860
|
+
|
861
|
+
http.unlock(path,**kwargs,&block)
|
862
|
+
end
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
866
|
+
end
|