-
Notifications
You must be signed in to change notification settings - Fork 410
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
Improve LDAP dc-list flag #476
Conversation
Signed-off-by: termanix <[email protected]>
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.
The connection object has a built-in dns resolver:
Lines 180 to 191 in 72fee6a
def resolver(self, target): | |
try: | |
return get_host_addr_info( | |
target=target, | |
force_ipv6=self.args.force_ipv6, | |
dns_server=self.args.dns_server, | |
dns_tcp=self.args.dns_tcp, | |
dns_timeout=self.args.dns_timeout | |
) | |
except Exception as e: | |
self.logger.info(f"Error resolving hostname {target}: {e}") | |
return None |
This should probably be used, as this also respects the "new" dns flags
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.
We already have dns args and imo these should be used here as well. So either the dns resolver should be the same as in the connection.py or the dns arguments should also be respected in this function
Refering to: Lines 43 to 47 in 131e29e
|
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.
name: Improved the dc-list.
about: In the previous code, it was working based on /etc/hosts and it would fail sometimes cause of that.
title: 'Improve LDAP dc-list flag'
labels: 'Enhancement, bug-fix'
assignees: ''
Description
It was working base on /etc/hosts and tried to socket connection. It fails sometimes, espcially real life scenarios.
The functionality of the code was changed with direct DNS records and queries. It now works without being linked to /etc/hosts.
Note: It takes DNS nameserver IP address from self.host
And also used parse_result_attributes for parsing (#471)
Type of change
Please delete options that are not relevant.
[+ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
How Has This Been Tested?
NetExec ldap $IP -u username -p password --dc-list
Screenshots (if appropriate):