Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/log the correct value #14

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions agent/metasploit_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ def process(self, message: m.Message) -> None:
module_instance = self._set_module_args(
selected_module, rhost, rport, is_ssl, options
)
except ValueError:
except ValueError as e:
logger.error(
"Failed to set arguments for %s", selected_module.modulename
"Failed to set arguments for %s from %s",
selected_module.modulename,
e,
)
continue
job = module_instance.check_exploit()
Expand Down Expand Up @@ -176,8 +178,7 @@ def _get_job_results(
results = job_result["result"]
break
if status == "errored":
logger.error("Module error: %s", job_result["error"])
break
raise ValueError(f"""Module Error: {job_result["error"]}""")
3asm marked this conversation as resolved.
Show resolved Hide resolved
if time.time() - init_timestamp > MODULE_TIMEOUT:
logger.error("Metasploit job %s timed out", job_uuid)
break
Expand Down Expand Up @@ -227,7 +228,7 @@ def _set_module_args(
try:
rhost = socket.gethostbyname(vhost)
except socket.gaierror as exc:
raise ValueError("The specified target is not valid") from exc
raise ValueError(f"The specified target {vhost} is not valid") from exc
3asm marked this conversation as resolved.
Show resolved Hide resolved
if "RHOSTS" in selected_module.required:
selected_module["RHOSTS"] = rhost
elif "DOMAIN" in selected_module.required:
Expand Down
Loading