* Added flag to drop SSP from Net-NTLMv1 auth
* Rebased with the latest version
* Removed whitespaces
* Removed duplicated code caused by merge
---------
Co-authored-by: Davide Ornaghi <ornaghi@intre.it>
Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
* Added example script samedit.py
* Rebased with latest version
* Replaced instances of "options.hash" with "options.hashes"
---------
Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* GetUserSPN's update to test machineonly flag
* Better naming of argument
* Better naming of argument
* Logging of machineOnly code
* Logging of machineOnly code
* ArgParse Description
* ArgParse Description
* ArgParse Description
* ArgParse Description
* Update examples/GetUserSPNs.py
Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
* Update examples/GetUserSPNs.py
Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
* Update GetUserSPNs.py
Added `or self.__requestMachine is not None`
* Update GetUserSPNs.py
Restore old formatting
---------
Co-authored-by: alexisbalbachan <alexisbalbachan@gmail.com>
* added badsuccessor attack changes
* Added explicit error message for SUPERSEDED account in case of KDC_ERR_CLIENT_REVOKED error
* added a link to microsoft docs regarding dmsa set up; fixed a typo
* Added a prerequisite check with a message in case it is not met
* 1. Leveraged logging instead of prints
2. Unified ldaps parameters
3. Renamed PA_DMSA_KEY_PACKAGE to KRB_DMSA_KEY_PACKAGE
4. Refactored ldapConnection to utilize impacket.examples.utils.init_ldap_session
5. Removed "double try" for search_ous replacing with a single one with specified controls value
6. Additional minor fixes
* Adjusted argument handling for -allowed-principals and descriptions for other arguments
* 1. Modified build_security_descriptor function to fix permissions: previously modification of the entry was not impossible with INSUFF_RIGHTS
2. Added modify_dmsa function
3. Cleaned up unused imports
* Minor typo fix: KRB_DMSA_KEY_PACKAGE -> KERB_DMSA_KEY_PACKAGE
* Renamed PA_DMSA_KEY_PACKAGE -> KERB_DMSA_KEY_PACKAGE
* Changed security controls value in search_ous function from 0x15 -> 0x5
---------
Co-authored-by: fulc2um <autouser@localhost>
* Add documentation in the comments for clearer use of NT_CREATE_ANDX flags.
Then sort out some mismatching flags.
* Change default shareAccessMode in the retr file methods to allow read, write and delete.
I found it out when capturing network traffic and seeing I can manage to read files with open handles.
This fixes SHARE_ACCESS_DENIED errors when trying to read files with handles on them.
This is the logical thing to do when we open files for reading.
We do not want to block other processes from interacting with the file.
This may raise problems when reading files that are being written into / being deleted.
I still think this is the right move since we usually want to read the files no matter what.
* Add ability to read files with open handles - this is related to my previous commits.
* Add ability to read files that have open handles to them.
This is related to my older commits on the subject.
* Update smbconnection.py
Add method parameters to `getFile` to easily communicate with the underlying SMB API.
* Fix `shareAccessMode` when opening files for writing.
We obviously do not want to allow others to write to the file while we are writing to it.
* Extend `SMBConnection`'s method parameters for `getFile` and `putFile` methods.
* Add comments for `DesiredAccess`, `ShareAccess` and `CreateDisposition` values in SMBv2.
* Update smb3structs.py
* Fix missing values.
* [SMB] Define CIFS SMB Date and SMB Time according to `2.2.1.4 Time`.
This is done to assist future development of SetInfo operations on files and directories.
```
Date Conversion Example - Year Component:
-----------------------------------------
2009 - 1980 = 29
| (convert to binary)
V
0001 1101
| (position data correctly by shifting)
V
0001 1101
<< 9
---------------------
= 0 0011 1010 0000 0000
| (trim to correct size with bitwise AND of correct mask)
V
0 0011 1010 0000 0000
& 1111 1110 0000 0000
---------------------
= 0011 1010 0000 0000
```
* [SMB] Added CIFS DateTime objects helper methods to convert values to classes.
* [SMB] Feature: added support for set_file_info method using trans2.
By doing so I also fixed a bad structure definition in the SMBSetFileBasicInfo structure.
Now we can modify file information remotely ;)
* [SMBServer] Moved FileTime Conversion methods to the base SMB library.
Also converted the SMB DATETIME methods to use my SMB_DATE and SMB_TIME implementations.
* [SMBConnection] Added type hinting for (almost) all methods.
Also implemented setInfo method to use for setting file information.
* [TEST_SMB] Add tests for new setInfo method.
* [TEST_SMB] This is causing errors so I will wait for now.
* [SMBConnection] add support for default info class type in queryInfo method.
* [SMBConnection] Fix queryInfo to allow retrieval of more
fileInformationClasses other than the default one.
* [attrib] Added attrib example to showcase file attribute modifications using SMB.
for now only implemented query.
* [smbserver] fix missing pack operation in getSMBTime method.
* [attrib] Finished set action, thus finishing the attrib example script.
* [attrib] Final touches, adding output to set action as well.
* [attrib] Add option to set connection timeout.
* [smbclient] Add reconnect command.
* [smb] Fix accidental SMB_TIME creation with removing `+ 1980` to hours.
* [examples] Implement filetime.py
An example script that allows querying and modifying file timestamps using SMB.
* After merge, fix some syntax issues.
* Actually show subparser's descriptions now.
* [SMB] Removed type annotations. Improved comments. Cleaned imports.
* [SMB] Removed type annotations, improved comments.
* [SMB] Comment changes.
* [examples] Add handling of empty action, even though argparse should catch it.
* refactor: Fix PR requests.
* Added monkeypatches.py; contains a couple of functions to modify for specific usecases/issues: monkeypatch_ssl_create_default_context and monkeypatch_readline_backend
* Revert "Added monkeypatches.py; contains a couple of functions to modify for specific usecases/issues: monkeypatch_ssl_create_default_context and monkeypatch_readline_backend"
This reverts commit 7049ded298.
* defining and running monkeypatch functions from the init of impacket.examples
* leveraging 'init_ldap_session' from addcomputer.py
* leveraging ssl monkeypatch in 'init_ldap_session'
* 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>
* Added Support for LDAPS When Using Windows Server 2025
* set ldaps_flag as optional in ldap_login()
---------
Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
* 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
* feat in net.py: add functionality to enable and disable user accounts
* fix: do not overwrite flags when enabling/disabling accounts
* call function create account with according flags in net.py
* refactor keep uac flags out of parameters of enable,disable function definitions
* allow to pass commands to mssqlclient.py via command line
* Changed parameter name and nargs value as suggested
Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
* Update examples/mssqlclient.py
---------
Co-authored-by: Gabriel Gonzalez <gabriel.gonzalez@fortra.com>
* Adding SCCM Policies attack and SCCM Distribution Point attack
* Fixing typo in error log message
* Handle packages one at a time for DP attack ; uniformise coding style ; update requirements.txt
* fixed SyntaxWarnings due to invalid escape sequence
* fixed DeprecationWarning since datetime.datetime.utcnow() is deprecated in Python 3.12+
* fixed DeprecationWarning since datetime.datetime.utcfromtimestamp() is deprecated in Python 3.12+
* Setting "log_file" property to "None" for smbserver configuration file ~ will print to console
* Setting "log_file" property to "None" for smbrelayx.py
* Support for adding REG_MULTI_SZ values through reg.py
* Fixing default value for "-vd" in reg.py
* Fixing 2x null-bytes handling for REG_MULTI_SZ values in rrp.py
* Fixing check of 2x null-bytes ending REG_MULTI_SZ values
* Fixing how REG_MULTI_SZ are printed to stdout (query, add) - replacing \0 with \n
* Fixing output message when adding a new value in the registry using the "add" command of reg.py
* Update samrdump.py
Added AdminComment while dumping. This will ensure to dump the Description field in querydispinfo or queruser
* Update samrdump.py