* 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.
* bugfix in NBNodeStatusResponse() marshalling
* fix unused parameter 'servport' in NetBIOS constructor
* remove unused parameter 'timeout' in _setup_connection() of NetBIOS class
* unittest: add local test cases for nmb
* Update build_and_test.yml
added python 3.13
removed python 3.8
* workaround delying thread initialization to avoid python3.13 bug
* workaround delaying thread initialization to avoid python3.13 bug
* avoid running Process instances beacuse of a bug in python3.13 https://github.com/python/cpython/issues/134381
* removed hack
* make helper servers run as daemon in order to make testecases not to get stuck
* add EvtRpcRegisterControllableOperation and EvtRpcClearLog to even6 protocol
* add EvtRpcExportLog request to even6
* add tests for even6 EvtRpcClearLog and EvtRpcExportLog requests
* minor changes in even6
* Implemented LDAP channel binding as cleanly as I could, based on https://github.com/ly4k/ldap3.
* Set channel binding to bytes value as requested in the review
* Fix test sessionBaseKey
* Fix test ntResponse
* Fix test encryptedSessionKey
* Fix test ntlmChallengeResponse
* Fix test ntlmChallengeResponse
* Removing leftover print statement
* Remove unnecessary AV_EOL, this is done by impackets struct anyway
---------
Co-authored-by: frank <frank.spierings@warpnet.nl>
- Parsing v3 and v4 ccache files to check #1106 (and not support for v1 and v2)
- Parsing creds from kirbi to check #1254
- Checking #1166 parseFile function
- Updated the Netlogon Authenticator computation.
- Modified the authenticate function. Now, the user's machine connects to the server.
- Marked some tests as Xfail due to the Zerologon patch.
- If a previous test run broke, the services was left on the target and thus create calls will fail. Implemented an open or create helper function to solve that.
Main changes are:
* Moved DCE/RPC endpoints test cases to a separate folder to better match code layout
* Using a base class for test cases to abstract code and reduce reuse
* Improved some of the tests cases to avoid code duplication
* Marking and skipping tests cases known to be failing
* Harness unit and functional tests, covering more operations
* Added test for unicode filenames #878
* Added test for unicode username #700
* Added TID checks
* Hardened path checks:
* Added a normalize_path function
* Using isInFileJail across operations
* Added close method to avoid address reuse in tests
* Merged TCP and SMB transport configuration into only one.
* Abstracted remote configuration parsing routines into functions.
* Remote config file can now be specified as pytest option.
* Added some notes on testing guide.
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.
Refactored configuration to avoid duplicated code.
Main changes are:
* Moved AES keys config to base class
* Moved hash split to base class
* Made machine hashes parameters optional
* Made AES keys parameters optional
* Updated testing guide
Continue refactor some of our test cases structure.
Main changes introduced are:
* Moved testing guide as a separate file and added some of the steps to configure the test environment.
* Leveraging unittest.main to catch command-line args and build the default suite.
* Only running GitHub actions workflow once for our own branches/PRs.
* Remote test config file can be specified via an env var now.
* Moved remote test config to a template and ignored config file.
Tests: First batch of changes on refactoring test cases
This is the first part of a larger effort to refactor some of our test cases structure.
Main changes introduced are:
- Using pytest as the testing framework to organize and mark test cases.
- Replacing custom bash scripts with test cases discovery.
- Integrating pytest-cov plugin to easier coverage collection and reporting.
- Marking remote test cases to being able to pick those during run.
- Abstracted remote test cases configuration in a base class.
- Consolidating pytest, coverage and tox configuration in a single tox.ini file.
- Removed some Python 2.5 support and replaced custom compat checks with six.
- Replace unittest.TextTestRunner.run by unittest.main (cherry-picked from f5dab5ca76, thanks @franferrax !)
Create self.createIWbemClassObject() helper to avoid duplicating logic. It also uses wmi.INTERFACE as a wmi.IWbemServices mock (this is enough for our testing purposes).
This test also shows that #1069 fix is no longer necessary, since `DeliveryQoS` is zero after b1499ae822 & bc57bf7404 changes.
It should fail due to splash damage of the aforementioned changes. Upcoming fix...
Invert expected and actual values order in assertEqual(), according with PyCharm's unittest runner interpretation of failures.
Avoid sample patching code to be considered by PyCharm's unittest runner as an example to be run.