Python CMD and Argparse Part 1
The CMD Module The cmd module is a really cool tool for Python development - it provides a lightweight wrapper for an interactive command-line interface. It’s quick and easy to add basic commands to your program, and you can give help messages using nothing more than function docstrings. Here’s an example:
from cmd import Cmd class Shell(Cmd): prompt = "\nshell > " def do_exit(self, _) -> bool: """Exits the cmdloop.""" return True def do_print(self, arg: str): """Prints your message.
Obscurity
Obscurity was a medium Linux box that offered completely custom written software. This was a cool concept to explore, because it required diving into source code to spot vulnerabilities. For the foothold, this was fuzzing to find the source of the web server and then spotting a vulnerable exec function based on user input. User required a bit of reverse engineering to decrypt a key used in a custom encryption tool. Finally, root access came from abusing the temporary write of password hashes during login attempts for a custom SSH service.