|
| 1 | +# frozen_string_literal: true |
| 2 | +# |
| 3 | +# Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com) |
| 4 | +# |
| 5 | +# ronin-support is free software: you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU Lesser General Public License as published |
| 7 | +# by the Free Software Foundation, either version 3 of the License, or |
| 8 | +# (at your option) any later version. |
| 9 | +# |
| 10 | +# ronin-support is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU Lesser General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU Lesser General Public License |
| 16 | +# along with ronin-support. If not, see <https://www.gnu.org/licenses/>. |
| 17 | +# |
| 18 | + |
| 19 | +require_relative "../../../vulns/url_scanner" |
| 20 | + |
| 21 | +module URI |
| 22 | + # |
| 23 | + # Provides helper methods for HTTP |
| 24 | + # |
| 25 | + # ## Core-Ext Methods |
| 26 | + # |
| 27 | + # * { URI::HTTP#vulns } |
| 28 | + # * { URI::HTTP#has_vulns? } |
| 29 | + # |
| 30 | + # @api public |
| 31 | + # |
| 32 | + class HTTP |
| 33 | + |
| 34 | + # |
| 35 | + # Return all vulnerabilities found for URI |
| 36 | + # |
| 37 | + # @param [Hash{Symbol => Object}] kwargs |
| 38 | + # Additional keyword arguments for |
| 39 | + # {Ronin::Vulns::URLScanner.scan}. |
| 40 | + # |
| 41 | + # @return [Array<LFI, RFI, SQLI, SSTI, ReflectedXSS, OpenRedirect>] |
| 42 | + # All discovered Web vulnerabilities |
| 43 | + # |
| 44 | + def vulns(**kwargs) |
| 45 | + Ronin::Vulns::URLScanner.scan(self, **kwargs) |
| 46 | + end |
| 47 | + |
| 48 | + # |
| 49 | + # Checks if the URI contains any vulnerabilities |
| 50 | + # |
| 51 | + # @param [Hash{Symbol => Object}] kwargs |
| 52 | + # Additional keyword arguments for |
| 53 | + # {Ronin::Vulns::URLScanner.test}. |
| 54 | + # |
| 55 | + # @return [Boolean] |
| 56 | + # |
| 57 | + # @example |
| 58 | + # URI('https://example.com/').has_vulns? |
| 59 | + # # => true |
| 60 | + # |
| 61 | + # @see Ronin::Vulns::URLScanner.test |
| 62 | + # |
| 63 | + def has_vulns?(**kwargs) |
| 64 | + Ronin::Vulns::URLScanner.test(self, **kwargs) != nil |
| 65 | + end |
| 66 | + end |
| 67 | +end |
0 commit comments