Commit Graph

137 Commits

Author SHA1 Message Date
Markb1337 337569b260 Added user-status functionality to the SAMHashes Class of the secrestdump.py (#1847)
* Added functionality to the SAMHashes Class of the secrestdump.py library to be able to print the user status for SAM dumps. There was already a user-status flag for the NTDS dumps, but not for the SAM dumps. Now, when directly calling secretsdump.py to make a SAM dump, the user can specify the -user-status flag, just like with the NTDS dump. Alternatively, when other tools are using the Secretsdump library, they can simply initiate the SAMHashes class with the printUserStatus flag set to True. The default is False, so if you don't specify anything when calling the Secretsdump Library it will do exactly as it did before. This should not break any existing tools.

* Added some extra checks to make sure the account is no longer marked as "locked" when the lockout duration has passed. In the previous interation, the "locked" mark was only removed after the locked account was used at least once after being unlocked.

---------

Co-authored-by: Mark Bregman <mark.bregman@fox-it.com>
2025-07-08 15:02:44 -03:00
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
Pedro Gabaldon e692d9052f [SECRETSDUMP] New Dump Method - Shadow Snapshot Method via WMI (#1719)
* Starting remote 'Shadow Snapshot Method'

* Continue :)

* Added options

* Logic error hehe :)

* Ups :S

* Remote Shadow Snapshot Working. Path calculated well. Need to fix download

* Download not working. SMB access is protected. Run copy command remotely? Too much noise I think :S

* Could not find a way to copy using WMI using GLOBALROOT path. Failing back to RCE; noisy :(

* Working

* Working

* Working

* Added debug log

* Working without RCE, download from ShadowCopy using SMB

* Removed commented code and unused methods

* Delete ShadowCopy after downlodaing SAM/SYSTEM/SECURITY

---------

Co-authored-by: Pedro Gabaldon <peter@pgj11.com>
2024-05-13 10:37:52 -03:00
RazzburyPi cb8467c384 Quality of life improvements (#1439)
* Added ability to specify an output file for smbclient.py to log commands / output while using the smbclient shell

* Improved logging to output file for smbclient

* Added increased control over execution of secretsdump.py, including ability to skip specific users when dumping NTDS.dit or skip SAM hive when dumping remote machine

* Improved relaying to ADCS endpoints

* Improved relaying to ADCS endpoints

* Requested ADCS certificates are now saved to lootdir specified in command line

* Improved writing certificate to file

* Improved log file for smbclient.py

* Bug fix with smbclient output file after rebase

* Bug fix with outputfile logic
2024-05-02 23:50:35 -03:00
Gabriel Gonzalez 9b4a139405 Updated Copyright to 2023 2023-07-31 11:48:28 -03:00
leandro b9f0a812c9 Merge pull request #1329 from snovvcrash/secretsdump-ldapfilter
Use a custom LDAP filter during a DCSync in secretsdump.py
2023-01-17 00:55:16 -03:00
Gabriel Gonzalez 8799a1a2c4 Update file banners to reflect Fortra ownership 2022-12-14 17:28:23 -03:00
snovvcrash 21341c47f8 Move ldapConnection parameter
Co-authored-by: leandro <56035084+0xdeaddood@users.noreply.github.com>
2022-07-25 20:13:17 +03:00
Sam Free5ide 6a38b1c09b Use a custom LDAP filter during a DCSync in secretsdump.py 2022-05-29 12:48:39 +03:00
0xdeaddood 6f457bfc20 Merge branch 'master-Impacket' into kerb-key-list-attack
# Conflicts:
#	examples/secretsdump.py
2022-04-11 17:10:40 -03:00
0xdeaddood 24106e60b0 Added error handling and parameter validation, and removed unused code 2022-04-11 17:04:24 -03:00
0xdeaddood 68fd6b799f Added some checks related to RRP when use-vss option is enabled in secretsdump.py 2022-04-07 16:56:53 -03:00
Maltemo 572fbd4c2d Changing corrupted source link 2022-01-24 17:59:33 +01:00
0xdeaddood 1b0b3383c4 Added paramater validation 2021-11-15 18:06:11 -03:00
0xdeaddood 91f7bb3a52 The Kerberos Key List Attack
Implementation of a new credential dumping method. This PR includes:
- examples/keylistattack.py: A new example with the implementation of the attack.
- examples/secretsdump.py: A new option (use-keylist) to dump credentials with the new attack instead of default the DRSUAPI method.
- impacket/examples/secretsdump.py: Modifications to the library to support the new attack.
2021-11-11 00:17:00 -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 adb230256d Refactored the target parsing functions (#1053)
In reviewing #1051 (and related #347) we found out that there's some ugly duplicated code that's better suited for an utils function.

The expected target format is:
`<DOMAIN></USERNAME><:PASSWORD>@HOSTNAME`

This PR:
- Moved target parsing routine to an utils module.
- Added unit tests for the new function.
- Using the new function across example scripts that accept a target.
2021-04-22 09:11:33 -03:00
asolino afe746d2e2 Adding keytab support to secretsdump and remote exec scripts
- Added a loadKeysFromKeytab() class method into keytab.py for easier usage from the scripts.
2020-02-25 15:37:00 -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
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
cclauss 80506c1620 Fix more Python 3 issues 2018-11-24 00:06:49 +01:00
cclauss c6e7e378eb Use feature detection instead of version detection
Python porting best practice: https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection
2018-11-23 19:38:28 +01:00
asolino 19334ddf54 Merge branch 'master' into python36 2018-11-19 12:30:38 -03:00
Viktor Szakats 3f29d8dcdb fix/secure URLs
* also remove/fix some whitespace such as tabs
  and spaces at EOL
2018-11-18 19:47:09 +00:00
asolino 4a1a90718e Merge branch 'master' into python36 2018-10-24 13:43:28 -03:00
Cauan 074708afc7 Update secretsdump.py
Set remoteName instead of address in case the password contains '@'
2018-10-24 13:29:28 -03:00
asolino 89954d7577 DCOM WMI port for Python3
- test_wmi.py passing (PY2 / PY3)
- secretsdump.py, wmiexec.py, wmipersist.py and wmiquery.py ports as well.
2018-10-05 17:34:31 -03:00
asolino 0b28d94832 Using raise the right way + removing print from traceback.print_exc() 2018-05-03 21:21:36 -03:00
asolino 52a324f28a Adding the exception data to the debug log produced 2018-04-06 18:27:34 -03:00
TheNaterz 824b57f698 added bootkey option 2018-04-03 11:18:47 -06:00
luz.paz 0e96b60b92 Misc. typos
Found via `codespell -q 3 -I ../impacket-word-whitelist.txt` through downstream `curl`
2018-03-16 09:42:21 -04:00
asolino 47a3b9fd19 Adding debug info for LSA and preventing exception when OldVal not present 2018-01-09 20:35:06 -03:00
Ramzeth d2736eff91 Update secretsdump.py 2017-12-06 18:04:18 +03:00
Ramzeth 6df3275fd1 OldVal parameter dump added to LSA secrets dump 2017-12-06 17:59:12 +03:00
asolino 314b4ebfd3 Clarifications when receiving ERROR_DS_NAME_ERROR_NOT_UNIQUE
* Might help users how to get over this issue.
* If somebody knows how to avoid this from happening ping me.
2017-09-15 16:06:17 -03:00
asolino b755ca4d7c Adding -target-ip switch.
- This allows to specify both the dc-ip and the target-ip. In theory we wouldn't need DNS resolve.
- Might help addressing https://github.com/CoreSecurity/impacket/issues/285
2017-06-29 11:40:25 -03:00
asolino b3826dee41 Print stacktrace messages if DEBUG logging is enabled
- This will make things easier for troubleshooting, for example https://github.com/CoreSecurity/impacket/issues/285
2017-06-29 09:45:38 -03:00
asolino 9733943d58 Adding -exec-method
* Allows to chose different exec methods when -use-vss mode is chosen:
1. smbexec (default): Creates a service executing the desired commands
2. wmiexec: Executes commands through Win32Process.Create() API
3. mmcexec: Executes commands through DCOM MMC object (Kerberos not supported here)
2017-06-03 19:29:26 -03:00
asolino 03c5bc63bc Giving some hints when target is enforcing SPN validation 2017-01-25 09:35:09 -03:00
asolino f0b5b8f617 Be more flexible about the target SPN to use
* When connecting to target systems
* Also, don't give up if the SMBConnection didn't work, we might be still lucky at the DRSUAPI layer
2017-01-24 16:10:29 -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 036e5bd778 Adding a -user-status display option
* Changing the (current-disabled) to (status=Enabled/Disabled)
* Moving that data to the end of the line, in alignment to the pwd-last-set display option
* Only supportted in VSS mode. DRSUAPI coming soon
2016-10-24 21:19:24 -03:00
asolino c049506e43 Minor cosmetic changes 2016-09-13 23:54:50 -03:00
martin_uy 3d4944afc7 Secrets Dump example split into 2 components. Secrets extraction component moved to Impacket library as an example. Command line interface component remains out of Impacket library. 2016-09-07 20:45:48 -03:00
asolino ce72d09cbc Minor class refactor
* Created LocalOperations class to encapsulate some offline registry specific operations.
* Now DumpSecrets is cleaner, and just handles the instances created based on the scripts parameters set by the user
2016-09-06 17:49:00 -03:00
asolino 90a9104513 Whenever there's an exception triggered when searching the PEK we skip the row
* Hopefully addresses a privately reported issue
2016-08-11 21:29:40 -07:00
asolino e5c4bdaa04 We remove the session resume file if ERROR_DS_DRA_BAD_DN error was triggered 2016-07-04 18:43:10 -03:00