* Standardized examples logger init method
* Fixing missing import
* Standardized examples init_ldap_session function #1
* Calling new shared function _ldap3_kerberos_login from example addcomputer
* Removed considering -debug in each example. Now it's handled in utils.
* Standardized EMPTY_LM_HASH in impacket.examples.utils
* Unify parse_identity function (phase 1)
* Standardized parse_identity
* Renamed "_ldap3_kerberos_login" to "ldap3_kerberos_login" (as it is called from outside)
* Standardize "logger" init in regsecrets.py
* Standardized LDAP login into a single function in utils.py:ldap_login
This was a pending change to:
- Use the same tagline, copyright and license notice across files.
- Remove authors' contacts that are no longer valid (due to affiliation changes).
- Update repository location.
- Update license file with missing licenses (althought those were already in source files).
This doesn't include any change on the source code, nor any change on current copyright or licenses. Just formatting and phrasing to make our and distro's maintainers life easier.
Similar to and on top of #1053, this moves the credentials/account parsing regex to an utils module and reduces duplicated code in example scripts.
The expected credential format is:
`<DOMAIN></USERNAME><:PASSWORD>`
Note that the regular expression used in `exchanger.py` was different (excluded ':' from the hostname) but I didn't found any reason to keep it different from all other scripts.
This PR:
- Moved credentials parsing routine to an utils module.
- Added unit tests for the new function.
- Using the new function across example scripts that accept a credential/account.
Replaced all instances of `#!/usr/bin/python` with `#!/usr/bin/env python` so impacket's examples and scripts can be run inside a virtualenv without having to call python.
Now there should be a single logger called 'impacket' the library uses.
By default is has a NullHandler so nothing is printed, but messages are
forwarded to the upstream logger.
If you are a script using the library and want to set the root logger
with a custom formatter, you can import impacket.examples.logger.
After some testing I'll merge it into master
opened at the remote hosts and keep track of them.
Coincidentally @mubix did something similar a few years
ago so credit goes to him (and the script's name ;)).
Check it out at https://github.com/mubix/netview
The main difference with our approach is we keep
looping over the hosts found and keep track of who logged
in/out from remote servers. Plus, we keep the connections
with the target systems and just send a few DCE-RPC packets.
One VERY IMPORTANT thing is:
YOU HAVE TO BE ABLE TO RESOLV THE DOMAIN MACHINES NETBIOS
NAMES. That's usually solved by setting your DNS to the
domain DNS (and the right search domain).
Some examples of usage are:
netview.py -target 192.168.1.10 beto
This will show the sessions on 192.168.1.10 and will authenticate as 'beto'
(password will be prompted)
netview.py FREEFLY.NET/beto
This will download all machines from FREEFLY.NET, authenticated as 'beto'
and will gather the session information for those machines that appear
to be up. There is a background thread checking aliveness of the targets
at all times.
netview.py -users /tmp/users -domainController freefly-dc.freefly.net -k FREEFLY.NET/beto
This will download all machines from FREEFLY.NET, authenticating using
Kerberos (that's why domainController parameter is needed), and filter
the output based on the list of users specified in /tmp/users file.