コード例 #1
0
    async def on_raw(self, message: Any) -> None:
        """Is called on raw commands, starts the message handler."""
        await super().on_raw(message)
        plugins.reload(self.bot)

        data: 'ParsedRaw' = ParsedRaw(
            message._raw,  # noqa: SF01
            self.server_tag)
        asyncio.create_task(self.message_handler(data))
コード例 #2
0
ファイル: data.py プロジェクト: nojusr/paprika
    def __post_init__(self):
        """Is used to initate values for all the above, excluding clients."""
        self.base_dir: Path = Path('.').resolve()
        self.db_dir: Path = self.base_dir / 'persist' / 'db'
        self.log_dir: Path = self.base_dir / 'persist' / 'logs'
        self.plugin_dir: Path = self.base_dir / 'plugins'
        self.config_file: Path = self.base_dir / 'config.json'

        config.reload(self)
        self.plugs: AllPlugsDict = {
            'sieve': {},
            'event': {},
            'command': {},
            'init': {}}
        plugins.reload(self)
        for server in self.config['servers']:
            db.connect(self, server)    # populates self.dbs
コード例 #3
0
ファイル: interface.py プロジェクト: terncgod/phpsploit
 def init(self):
     """phpsploit interface init"""
     # load phpsploit plugins list
     plugins.blacklist = self.get_names(self, "do_")
     plugins.reload(verbose=False)
コード例 #4
0
ファイル: interface.py プロジェクト: terncgod/phpsploit
    def do_corectl(self, argv):
        """Advanced core debugging utils

        SYNOPSIS:
            corectl <TOOL>

        CORECTL TOOLS:
        --------------

        stack-traceback
            Print the full track trace of last python exception.

            Error messages (lines that starts with a `[!]` red tag)
            are generated by a thrown exception.
            The `stack-traceback` tool displays the full python
            stack trace of the last thrown exception.
            This command is useful for debugging purposes.

            NOTE: stack traceback is NOT saved in session files

        reload-plugins
            Reload all phpsploit plugins.

            By default, the list of phpsploit plugins is loaded
            once only, when the framework starts.
            Therefore, plugin developpers may want to reload
            the plugins in order to be able to test their
            plugin modifications without having to restart the
            framework each time.

        python-console
            Run a python interpreter.

            The python console interpreter is a good gateway
            for deep debugging, or to get help about a phpsploit
            module, class, object, such as the plugin developpers
            API.
            For help with the API, run the following commands inside
            of the python console:
            >>> import api
            >>> help(api)

        display-http-requests
            Display HTTP(s) request(s) for debugging

            Shows all HTTP(s) request(s) that where sent in the last
            remote command execution.

            NOTE: http requests are NOT saved in session files
            WARNING: don't works with HTTPS requests (see issue #29 on github)
        """
        argv.append('')

        if argv[1] == "stack-traceback":
            try:
                e = self.last_exception
                e = traceback.format_exception(type(e), e, e.__traceback__)
                # a small patch for traceback from plugins, remove trash lines
                for index, line in enumerate(e):
                    if ('File "<frozen importlib._bootstrap>"' in line
                            and '_call_with_frames_removed' in line):
                        e = e[(index + 1):]
                        header = "Traceback (most recent call last):"
                        e.insert(0, header + os.linesep)
                        break
                e = colorize("%Red", "".join(e))
            except:
                e = "[-] Exception stack is empty"
            print(e)

        elif argv[1] == "reload-plugins":
            plugins.reload(verbose=True)

        elif argv[1] == "python-console":
            import ui.console
            console = ui.console.Console()
            console.banner = "Phpsploit corectl: python console interpreter"
            console()

        elif argv[1] == "display-http-requests":
            requests = enumerate(tunnel.get_raw_requests(), 1)
            if not requests:
                print("[-] No HTTP(s) requests were sent up to now")
                return
            for num, request in requests:
                print("#" * 78)
                print("### REQUEST %d" % num)
                print("#" * 78)
                print(encoding.decode(request))
        else:
            self.interpret("help corectl")
コード例 #5
0
ファイル: interface.py プロジェクト: BwRy/phpsploit
 def init(self):
     """phpsploit interface init"""
     # load phpsploit plugins list
     plugins.blacklist = self.get_names(self, "do_")
     plugins.reload(verbose=False)
コード例 #6
0
ファイル: interface.py プロジェクト: BwRy/phpsploit
    def do_corectl(self, argv):
        """Advanced core debugging utils

        SYNOPSIS:
            corectl <TOOL>

        CORECTL TOOLS:
        --------------

        stack-traceback
            Print the full track trace of last python exception.

            Error messages (lines that starts with a `[!]` red tag)
            are generated by a thrown exception.
            The `stack-traceback` tool displays the full python
            stack trace of the last thrown exception.
            This command is useful for debugging purposes.

        reload-plugins
            Reload all phpsploit plugins.

            By default, the list of phpsploit plugins is loaded
            once only, when the framework starts.
            Therefore, plugin developpers may want to reload
            the plugins in order to be able to test their
            plugin modifications without having to restart the
            framework each time.

        python-console
            Run a python interpreter.

            The python console interpreter is a good gateway
            for deep debugging, or to get help about a phpsploit
            module, class, object, such as the plugin developpers
            API.
            For help with the API, run the following commands inside
            of the python console:
            >>> import api
            >>> help(api)
        """
        argv.append('')

        if argv[1] == "stack-traceback":
            try:
                e = self.last_exception
                e = traceback.format_exception(type(e), e, e.__traceback__)
                # a small patch for traceback from plugins, remove trash lines
                for index, line in enumerate(e):
                    if ('File "<frozen importlib._bootstrap>"' in line
                            and '_call_with_frames_removed' in line):
                        e = e[(index + 1):]
                        header = "Traceback (most recent call last):"
                        e.insert(0, header + os.linesep)
                        break
                e = colorize("%Red", "".join(e))
            except:
                e = "[-] Exception stack is empty"
            print(e)

        elif argv[1] == "reload-plugins":
            plugins.reload(verbose=True)

        elif argv[1] == "python-console":
            import ui.console
            console = ui.console.Console()
            console.banner = "Phpsploit corectl: python console interpreter"
            console()

        else:
            self.interpret("help corectl")
コード例 #7
0
    def do_corectl(self, argv):
        """Advanced core debugging utils

        SYNOPSIS:
            corectl <TOOL>

        CORECTL TOOLS:
        --------------

        stack-traceback
            Print the full track trace of last python exception.

            Error messages (lines that starts with a `[!]` red tag)
            are generated by a thrown exception.
            The `stack-traceback` tool displays the full python
            stack trace of the last thrown exception.
            This command is useful for debugging purposes.

            NOTE: stack traceback is NOT saved in session files

        reload-plugins
            Reload all phpsploit plugins.

            By default, the list of phpsploit plugins is loaded
            once only, when the framework starts.
            Therefore, plugin developpers may want to reload
            the plugins in order to be able to test their
            plugin modifications without having to restart the
            framework each time.

        python-console
            Run a python interpreter.

            The python console interpreter is a good gateway for deep
            debugging, or to get help about a phpsploit module, class,
            object, such as the plugin developpers API.

            For help with the API, run the following commands inside
            the python console:
            >>> import api
            >>> help(api)

        display-http-requests
            Display HTTP(s) request(s) for debugging

            Shows all HTTP(s) request(s) that where sent in the last
            remote command execution.

            NOTE: http requests are NOT saved in session files
            WARNING: don't works with HTTPS requests (see issue #29 on github)
        """
        argv.append('')

        if argv[1] == "stack-traceback":
            if self.last_exception:
                exc = self.last_exception
                exc = traceback.format_exception(type(exc),
                                                 exc,
                                                 exc.__traceback__)
                # a small patch for traceback from plugins, remove trash lines
                for idx, line in enumerate(exc):
                    if ('File "<frozen importlib._bootstrap>"' in line
                            and '_call_with_frames_removed' in line):
                        exc = exc[(idx + 1):]
                        header = "Traceback (most recent call last):"
                        exc.insert(0, header + os.linesep)
                        break
                print(colorize("%Red", "".join(exc)))
            else:
                print("[-] Exception stack is empty")

        elif argv[1] == "reload-plugins":
            plugins.reload(verbose=True)

        elif argv[1] == "python-console":
            from ui import console
            console = console.Console()
            console.banner = "Phpsploit corectl: python console interpreter"
            console()

        elif argv[1] == "display-http-requests":
            requests = enumerate(tunnel.get_raw_requests(), 1)
            if not requests:
                print("[-] No HTTP(s) requests were sent up to now")
                return
            for num, request in requests:
                print("#" * 78)
                print("### REQUEST %d" % num)
                print("#" * 78)
                print(encoding.decode(request))
        else:
            self.interpret("help corectl")
コード例 #8
0
ファイル: interface.py プロジェクト: jack51706/omega
 def init(self):
     """Omega interface init"""
     # load Omega plugins list
     plugins.blacklist = self.get_names(self, "do_")
     plugins.reload(verbose=False)
コード例 #9
0
    def do_corectl(self, argv):
        """Advanced core debugging utils

        SYNOPSIS:
            corectl <TOOL>

        CORECTL TOOLS:
        --------------

        stack-traceback
            Print the full track trace of last python exception.

            Error messages (lines that starts with a `[!]` red tag)
            are generated by a thrown exception.
            The `stack-traceback` tool displays the full python
            stack trace of the last thrown exception.
            This command is useful for debugging purposes.

            NOTE: stack traceback is NOT saved in session files

        reload-plugins
            Reload all phpsploit plugins.

            By default, the list of phpsploit plugins is loaded
            once only, when the framework starts.
            Therefore, plugin developpers may want to reload
            the plugins in order to be able to test their
            plugin modifications without having to restart the
            framework each time.

        python-console
            Run a python interpreter.

            The python console interpreter is a good gateway for deep
            debugging, or to get help about a phpsploit module, class,
            object, such as the plugin developpers API.

            For help with the API, run the following commands inside
            the python console:
            >>> import api
            >>> help(api)

        display-http-requests
            Display HTTP(s) request(s) for debugging

            Shows all HTTP(s) request(s) that where sent in the last
            remote command execution.

            NOTE: http requests are NOT saved in session files
            WARNING: don't works with HTTPS requests (see issue #29 on github)
        """
        argv.append('')

        if argv[1] == "stack-traceback":
            if not self.last_exception:
                print("[-] Exception stack is empty")
                return False
            for line in self.last_exception:
                print(colorize("%Red", line))
            return True

        if argv[1] == "reload-plugins":
            return plugins.reload(verbose=True)

        if argv[1] == "python-console":
            from ui import console
            console = console.Console()
            console.banner = "Phpsploit corectl: python console interpreter"
            return console()

        if argv[1] == "display-http-requests":
            requests = tunnel.get_raw_requests()
            if not requests:
                print("[-] From now, phpsploit didn't "
                      "sent any HTTP(s) request")
                return False
            print("[*] Listing last payload's HTTP(s) requests:\n")
            for num, request in enumerate(requests, 1):
                print("#" * 78)
                print("### REQUEST %d" % num)
                print("#" * 78)
                print(encoding.decode(request))
            return True

        self.interpret("help corectl")
        return False
コード例 #10
0
ファイル: interface.py プロジェクト: nil0x42/phpsploit
    def do_corectl(self, argv):
        """Advanced core debugging utils

        SYNOPSIS:
            corectl <TOOL>

        CORECTL TOOLS:
        --------------

        stack-traceback
            Print the full track trace of last python exception.

            Error messages (lines that starts with a `[!]` red tag)
            are generated by a thrown exception.
            The `stack-traceback` tool displays the full python
            stack trace of the last thrown exception.
            This command is useful for debugging purposes.

            NOTE: stack traceback is NOT saved in session files

        reload-plugins
            Reload all phpsploit plugins.

            By default, the list of phpsploit plugins is loaded
            once only, when the framework starts.
            Therefore, plugin developpers may want to reload
            the plugins in order to be able to test their
            plugin modifications without having to restart the
            framework each time.

        python-console
            Run a python interpreter.

            The python console interpreter is a good gateway for deep
            debugging, or to get help about a phpsploit module, class,
            object, such as the plugin developpers API.

            For help with the API, run the following commands inside
            the python console:
            >>> import api
            >>> help(api)

        display-http-requests
            Display HTTP(s) request(s) for debugging

            Shows all HTTP(s) request(s) that were sent in the last
            remote command execution.

            NOTE: http requests are NOT saved in session files
            WARNING: don't works with HTTPS requests (see issue #29 on github)
        """
        argv.append('')

        if argv[1] == "stack-traceback":
            if not self.last_exception:
                print("[-] Exception stack is empty")
                return False
            for line in self.last_exception:
                print(colorize("%Red", line))
            return True

        if argv[1] == "reload-plugins":
            return plugins.reload(verbose=True)

        if argv[1] == "python-console":
            from ui import console
            console = console.Console()
            console.banner = "Phpsploit corectl: python console interpreter"
            return console()

        if argv[1] == "display-http-requests":
            requests = tunnel.get_raw_requests()
            if not requests:
                print("[-] From now, phpsploit didn't "
                      "sent any HTTP(s) request")
                return False
            print("[*] Listing last payload's HTTP(s) requests:\n")
            for num, request in enumerate(requests, 1):
                print("#" * 78)
                print("### REQUEST %d" % num)
                print("#" * 78)
                print(encoding.decode(request))
            return True

        self.interpret("help corectl")
        return False