Commit Graph

25 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
Jonathan 567478030e Added CREDHIST support (#1564)
* Added CREDHIST support
* Added fixes from suggestions
2023-10-10 21:12:40 -03:00
Gabriel Gonzalez 9b4a139405 Updated Copyright to 2023 2023-07-31 11:48:28 -03:00
Alexander Neumann 98c75c69e1 dpapi: Fix printing master key
The code looks for leading zero bytes and removes them, but then uses
the number of zero bytes (in variable beginning) to trim the key again
just before printing. This commit fixes the code to only trim once.

The code was verified to work and print the same DPAPI master key as
Mimikatz and the other methods implemented by Impacket.
2023-03-06 10:40:12 +01:00
Gabriel Gonzalez 8799a1a2c4 Update file banners to reflect Fortra ownership 2022-12-14 17:28:23 -03:00
0xdeaddood 7a18ef5c8b About to tag a release 2022-05-04 11:33:16 -03:00
Jonathan 4039f5c4e1 Fixed entropy parameter handling in dpapi.py/unprotect 2021-11-01 23:26:15 +02:00
0xdeaddood 1636eaab69 dpapi.py: Updated description and copyright year. 2021-07-26 18:01:01 -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 18df212327 Adding offline CryptUnprotectData functionality
- Thru the unprotect command.
- You need to specify the masterkey needed for decryption, you can decrypt masterkeys using the masterkey command.
- You can optionally specify an extra entropy either as a string or a binary file.
2020-11-23 13:26:51 -03:00
asolino 48a3124c43 Enforce RPC_C_AUTHN_GSS_NEGOTIATE when using Kerberos.
Should help on https://github.com/SecureAuthCorp/impacket/pull/739#issuecomment-665363963
2020-07-28 23:01:51 -03:00
asolino f89b49e2f5 Fail gracefully if we can't get the LSA values we need
Should make it easier to spot https://github.com/SecureAuthCorp/impacket/issues/908
2020-07-28 22:13:21 -03:00
asolino 39ef038113 Adding -no-pass, pass-the-hash and AES Key support for backup subcommand
Addresses https://github.com/SecureAuthCorp/impacket/issues/804
2020-07-28 21:23:19 -03:00
asolino 8d4c91481b Print Library's installation path by default when -debug is specified 2020-02-05 19:52:39 -03:00
Alberto Solino bdf2e3d9d7 Merge pull request #739 from imaibou/imaibou-dpapi-rpc
dpapi.py Add RPC masterkey decryption
2020-01-03 14:50:00 -03:00
imaibou e32f6e3e75 dpapi.py Add RPC masterkey decryption
Added feature to decrypt a user's masterkey using the MS-BKRP (BackupKey Remote Protocol). This is already implemented in mimikatz to decrypt masterkeys using the /rpc flag (https://github.com/gentilkiwi/mimikatz/blob/172200295688ccbb76c44c6db0b3b47d39dd0d4d/modules/rpc/kull_m_rpc_bkrp.c#L51-L54)
This makes an RPC call with the user's identity to the function BackuprKey on the DC. The GUID of this operation is BACKUPKEY_RESTORE_GUID and the details can be found on microsoft documentation here: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-bkrp/7accb903-3863-4385-9c99-11af8c18d656
2020-01-03 16:40:31 +01:00
imaibou 3bd51972cd dpapi.py add Pass the hash
Added pass the hash support for backup key retrieval
2020-01-03 15:39:09 +01:00
Dirkjan Mollema 1f2d203f6f improve support for key+sid in dpapi examples 2019-12-10 11:17:43 +01:00
asolino 7589c6af28 Fixing specific Python3 issues 2018-12-05 11:56:14 -03:00
asolino bb6ffb3707 Small adjustments
- Making it Python3 friendly (needs more tests)
- Simplyfing use of Structure
- Ask for password if not supplied
2018-12-05 11:44:54 -03:00
Itamar c67b7cb543 masterkeys decryption using domain backupkey
Hola,
I added support for domain backup keys extraction for the use of master keys decryption (huge thanks and credit to @gentilkiwi)
Example:
# Extract domain backup keys
dpapi.py -debug backupkeys -t domain/user:password@DC --export

# decrypt master key using PVK file
dpapi.py masterkey -file 8ef4fb99-bb78-4592-b989-303c4aea5554 -pvk G$BCKUPKEY_E63DFF3E-CB30-41AF-AB69-FF7B8769C39B.pvk
2018-12-05 13:00:54 +02:00
asolino a508655827 Parsing DPAPI_SYSTEM according to the new changes just introduced in secretsdump 2018-11-08 12:47:32 -03:00
asolino b75d710e56 Adding DPAPI / Vaults related structures, testcase and example.
You can unlock masterkeys, credentials and vaults. For the three, you will specify the file name (using -file for
masterkeys and credentials, and -vpol and -vcrd for vaults).
If no other parameter is sent, the contents of these resource will be shown, with their encrypted data as well.
If you specify a -key blob (in the form of '0xabcdef...') that key will be used to decrypt the contents.
In the case of vaults, you might need to also provide the user's sid (and the user password will be asked).
For system secrets, instead of a password you will need to specify the system and security hives.

References: All of the work done by these guys. I just adapted their work to my needs.
https://www.passcape.com/index.php?section=docsys&cmd=details&id=28
https://github.com/jordanbtucker/dpapick
https://github.com/gentilkiwi/mimikatz/wiki/howto-~-credential-manager-saved-credentials (and everything else Ben did )
http://blog.digital-forensics.it/2016/01/windows-revaulting.html
https://www.passcape.com/windows_password_recovery_vault_explorer
https://www.passcape.com/windows_password_recovery_dpapi_master_key
2018-11-08 12:25:30 -03:00