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")
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
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")
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