-
Notifications
You must be signed in to change notification settings - Fork 1
Fix network-ops tool wrapper bugs from test analysis #72
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
Changes from all commits
84ca819
1650928
1b562dd
6cc0e88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,9 +63,13 @@ async def netexec( | |
| cmd.extend(["-d", domain]) | ||
|
|
||
| if username: | ||
| cmd.extend(["-u", *(username if isinstance(username, list) else [username])]) | ||
| cmd.extend( | ||
| ["-u", *(username if isinstance(username, list) else [username])] | ||
| ) | ||
| if password: | ||
| cmd.extend(["-p", *(password if isinstance(password, list) else [password])]) | ||
| cmd.extend( | ||
| ["-p", *(password if isinstance(password, list) else [password])] | ||
| ) | ||
| if hash: | ||
| cmd.extend(["-H", *(hash if isinstance(hash, list) else [hash])]) | ||
|
|
||
|
|
@@ -185,17 +189,27 @@ async def netexec_smb_enum_group_members( | |
| kerberos: Kerberos ccache file path or AES key for authentication. | ||
| local_auth: Use local authentication (`--local-auth`). Mutually exclusive with `domain`. | ||
| """ | ||
| return await self.netexec( | ||
| "smb", | ||
| targets, | ||
| args=["--groups", *groups], | ||
| username=username, | ||
| password=password, | ||
| domain=domain, | ||
| hash=hash, | ||
| kerberos=kerberos, | ||
| local_auth=local_auth, | ||
| ) | ||
| # netexec --groups only accepts one group at a time, so we loop | ||
| # and join results when multiple groups are requested. | ||
| results: list[str] = [] | ||
| for group in groups: | ||
|
Comment on lines
+192
to
+195
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refuted. The original code would have produced |
||
| try: | ||
| output = await self.netexec( | ||
| "smb", | ||
| targets, | ||
| args=["--groups", group], | ||
| username=username, | ||
| password=password, | ||
| domain=domain, | ||
| hash=hash, | ||
| kerberos=kerberos, | ||
| local_auth=local_auth, | ||
| ) | ||
| results.append(output) | ||
| except Exception: | ||
| logger.exception(f"Failed to query SMB group '{group}'") | ||
| results.append(f"[error querying group '{group}']") | ||
| return "\n".join(results) | ||
|
|
||
| @tool_method(catch=True, variants=["specialized", "all"]) | ||
| async def netexec_smb_enum_shares( | ||
|
|
@@ -323,16 +337,26 @@ async def netexec_ldap_enum_group_members( | |
| hash: A single NTLM hash, a list of hashes, or a path to a hash file. | ||
| kerberos: Kerberos ccache file path or AES key for authentication. | ||
| """ | ||
| return await self.netexec( | ||
| "ldap", | ||
| targets, | ||
| args=["--groups", *groups], | ||
| username=username, | ||
| password=password, | ||
| domain=domain, | ||
| hash=hash, | ||
| kerberos=kerberos, | ||
| ) | ||
| # netexec --groups only accepts one group at a time, so we loop | ||
| # and join results when multiple groups are requested. | ||
| results: list[str] = [] | ||
| for group in groups: | ||
|
Comment on lines
+340
to
+343
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refuted. Same reasoning as SMB variant above. |
||
| try: | ||
| output = await self.netexec( | ||
| "ldap", | ||
| targets, | ||
| args=["--groups", group], | ||
| username=username, | ||
| password=password, | ||
| domain=domain, | ||
| hash=hash, | ||
| kerberos=kerberos, | ||
| ) | ||
| results.append(output) | ||
| except Exception: | ||
| logger.exception(f"Failed to query LDAP group '{group}'") | ||
| results.append(f"[error querying group '{group}']") | ||
| return "\n".join(results) | ||
|
|
||
| @tool_method(catch=True, variants=["specialized", "all"]) | ||
| async def netexec_asreproast( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refuted. The docstring already says "not a shell wrapper or binary" which accurately describes the exclusion logic. It's a private helper with a single caller — further rewording adds no value.