Commit Graph

33 Commits

Author SHA1 Message Date
Gabriel Gonzalez ae0ec300f8 Techdebt examples bootstrapping v2 (#1928)
* 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
2025-03-26 22:58:39 -03:00
gabrielg5 27e7e7478d Updating copyright banner... 2024-08-28 17:52:57 -03:00
Gabriel Gonzalez 9b4a139405 Updated Copyright to 2023 2023-07-31 11:48:28 -03:00
Gabriel Gonzalez 8799a1a2c4 Update file banners to reflect Fortra ownership 2022-12-14 17:28:23 -03:00
0xdeaddood 9421672ee6 Improved error handling
* Added SMB session error handling in getMachineName() (SMB blocked).
* Added LDAP session error handling in NTLM authentication (NTLM disabled).
2022-06-28 23:16:00 -03:00
0xdeaddood 181827dda0 Merge branch 'add-dc-host-option' into dc-host-option
# Conflicts:
#	examples/GetADUsers.py
#	examples/GetNPUsers.py
#	examples/GetUserSPNs.py
#	examples/findDelegation.py
#	examples/raiseChild.py
2022-06-24 15:47:40 -03:00
Martin Gallo cd4fe47cfc Arrange tagline, copyright and license notes across all source files
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.
2021-07-20 10:04:27 -03:00
Martin Gallo a45f331360 Refactored the credentials parsing functions (#1058)
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.
2021-04-22 10:02:29 -03:00
Roman Maksimov db2b13e0c9 add -dc-host option 2020-05-13 14:21:00 +03:00
Roman Maksimov 5d75530d1b add SMB timeout handling 2020-04-27 03:38:08 +03:00
Arseniy Sharoglazov 3506a60736 Fixing Travis CI tests after adding RPC over HTTP v2 realization 2020-04-02 08:58:17 +03:00
Arseniy Sharoglazov abb991572d Normalizing [domain/]user[:password] regexps to the right one 2020-04-02 07:33:52 +03:00
asolino 8d4c91481b Print Library's installation path by default when -debug is specified 2020-02-05 19:52:39 -03:00
0xdeaddood 3b41d48e07 Add the timestamp option to several scripts
- GetADUsers.py, GETNPUsers.py, getST.py, getTGT.py, goldenPac.py, secretsdump.py, ticketer.py
2019-12-18 11:34:56 -03:00
Vyacheslav Syrovatsky 0a7ba186a0 Fix the warning added to Python 3.8: SyntaxWarning: "is" with a literal. Did you mean "=="? 2019-11-28 17:14:28 +03:00
asolino 0dc38645b6 raising the exception the Py3 way 2019-09-10 15:15:43 -03:00
Michael Niewöhner c0664ea4c4 Fix broken error message introduced by python3 port
Signed-off-by: Michael Niewöhner <michael.niewoehner@8com.de>
2019-09-04 13:29:14 +02:00
asolino 553881b9da Merge branch 'master' into python36 2018-12-05 12:16:54 -03:00
asolino c328de8252 Changing Copyright notice 2018-12-05 12:14:55 -03:00
asolino ec77ea3d06 Code cleanup homework
- Optimizing imports
- Removing unused variables
- Still a lot to do.
- Test cases passing OK
2018-12-04 14:47:16 -03:00
asolino 48d1115264 GetADUsers.py Python3 port 2018-10-11 13:21:25 -03:00
asolino 18753898e5 Optimized imports 2018-05-24 20:48:52 -03:00
asolino 2ac1811d4d Disabled users will not be downloaded by default
* Disabled accounts will be included if -all, that replaced -all-users switch
* When using -user switch, if the account is disabled, no records will return. You will need to specify -all in order to get something.
* Should address https://github.com/CoreSecurity/impacket/issues/454#issuecomment-390240413
2018-05-18 13:28:36 -03:00
asolino 0b28d94832 Using raise the right way + removing print from traceback.print_exc() 2018-05-03 21:21:36 -03:00
asolino c65e3bc7c1 Lowering the paged results to 100 in order to avoid LDAP error
* With 1000 entries we were getting: "LdapErr: DSID-0C060671, comment: The server is sending data faster than the client has been receiving. Subsequent requests will fail until the client catches up"

* Minor changes to make it Python3 compatible
2018-05-03 14:27:37 -03:00
asolino 0d39e84d46 Records are processed as soon as they are received
* Implementing the search perRecordCallback feature will prevent memory from getting exhausted
* One drawback tho, is that columns with for the table are fixed, since we don't have all the
  rows for calculating the right width. Maybe we should just output CVS and that's it.
2018-04-26 21:56:40 -04:00
asolino 7ca67ee18b Get getMachineName() now works even if anonymous login is not allowed
We have enough data already to get the server's name
2018-02-20 19:38:49 -03:00
asolino cf14e7cd77 Clarifications in the script's comments 2017-07-14 17:52:39 -03:00
Ronnie Flathers 0ae4ab0147 added command line switch '-all-users' 2017-07-14 12:47:06 -05:00
Ronnie Flathers 59b99e76c0 removed email=* filter, added objectCategory filter) 2017-07-13 16:22:45 -05:00
asolino c814049996 Adding support LDAP paged search support to GetADUsers.py
* Will now work when there are more than 1000 records
* Also fixes a small bug in the library when decoding the cookies
2017-02-23 10:21:43 -03:00
Martin Gallo 4152e128b8 Replaced shebang with a virtualenv friendly one
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.
2017-01-11 12:43:54 -03:00
asolino 0afacbea5a Adding GetADUsers.py example script
This script will gather data about the domain's users and their corresponding email addresses. It will also
include some extra information about last logon and last password set attributes.
You can enable or disable the the attributes shown in the final table by changing the values in line 184 and
headers in line 190.
If no entries are returned that means users don't have email addresses specified.
2016-10-04 19:58:43 -03:00