Commit Graph

51 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
Jannik Vieten 835e17550b Fixed warnings with Python 3.12 (#1695)
* 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+
2024-10-24 09:00:11 -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
5alt 6c7229fccb Fix reading binary file error while using custom exe file
Replace all `open(self.__exeFile)` to `open(self.__exeFile, 'rb')`
2020-09-02 13:29:05 +08:00
Arseniy Sharoglazov 919055c0fe Fixing a bug appeared after the optimization of NDR parser 2020-08-04 20:21:13 +03:00
Roman Maksimov cfe14a8741 fix string formatting 2020-05-13 14:21:00 +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 49c9312413 Small bug fixing related to RPC over HTTP v2 changes 2020-04-14 01:24:44 +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
Alberto Solino c0e59d2fcf Merge pull request #725 from 0xdeaddood/raiseChild_RID
RaiseChild RID feature
2020-01-06 15:44:00 -03:00
0xdeaddood 97d2336d81 Add the timestamp option to several scripts
- lookupsid.py, netview.py, ntlmrelayx.py, raiseChild.py, samrdump.py, smbrelayx.py
2019-12-18 09:13:27 -03:00
0xdeaddood fff7bc368f Modify help message 2019-12-16 11:45:00 -03:00
0xdeaddood a32f917d73 Change parameter name and add exception handling (wrong RID) 2019-12-16 10:17:40 -03:00
0xdeaddood e9c3022766 raiseChild: added new parameter to specify the RID of a user to dump credentials and, if target is specified, launch a PSEXEC shell 2019-12-16 08:58:16 -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
n1ngod a0ad462c49 fix the import path of hLsarOpenPolicy2 2019-08-12 17:51:07 +08: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 7eeff437c7 More code cleanup homework
- Optimizing imports
- Removing unused variables
- Still a lot to do.
- Test cases passing OK
2018-12-04 17:07:52 -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 2425c08235 raiseChild.py Python3 port 2018-10-13 11:44:45 -03:00
asolino 9d8638cdf1 Print traceback info if running in DEBUG mode 2018-05-04 18:25:44 -03:00
asolino 0b28d94832 Using raise the right way + removing print from traceback.print_exc() 2018-05-03 21:21:36 -03: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 3d88b7682a Adding backward compatibility till pyasn-0.2.3 (at least) + supporting 0.4.2 2017-11-23 19:59:30 -03:00
asolino c001138f76 Small changes to make it compatible with pyasn1-0.3.7.
- IMPORTANT: This is not backward compatible with old pyasn1 versions. Be sure you run 0.3.7.
2017-11-23 15:40:18 -03:00
asolino 859317dfff Do not logoff when the login didn't work
* It would raise USER_SESSION_DELETED and break this script functionality.
2017-09-15 16:32:59 -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 c049506e43 Minor cosmetic changes 2016-09-13 23:54:50 -03:00
asolino bfeb31ab7e Changing PAC_SIGNATURE_DATA['SignatureType'] type allowing negative numbers 2016-08-07 23:19:22 -07:00
asolino 053cb994d6 Removing PAC structures and using the ones located in the library
* Now located at impacket.krb5.pac
2016-08-02 10:28:38 -03:00
asolino a8576c0172 Reformatting some code 2016-05-20 21:16:15 -03:00
asolino 8d8aab419f Empty domain check fixed 2016-05-15 18:47:15 -03:00
asolino f8b900f2a8 Remaining fixes for ERROR_DS_DIFFERENT_REPL_EPOCHS
* Test cases and raiseChild were also affected
2016-05-06 14:56:46 -03:00
asolino 8c04d96979 Updating copyright notice. Welcome 2016 2016-01-06 14:08:30 -03:00
asolino 5851bd0cb9 Applying @0xsauby fix for password with '@' to the rest of the example scripts 2015-11-26 14:55:19 -03:00
asolino 0524363e88 Applying same modifications as https://github.com/CoreSecurity/impacket/commit/1f3cbff8df56344ba4d5552b0ddb8f3cb095194d to goldenPac and raiseChild 2015-09-16 13:38:38 -03:00
asolino 5a81fa9183 Updated doc 2015-09-08 17:58:38 -03:00
asolino 9494c2693f Adding extra debug information 2015-09-04 14:27:01 -03:00
asolino be5ad45851 Checking DRSCrackNames's rItems status answer as well to verify everything is ok
* Thanks @gentilkiwi for pointing this out
2015-09-04 14:05:43 -03:00
asolino f8959be035 Reliability fixes
1) Using getDNSMachineName() instead of getMachineName() so we have higher chances to resolve the target machines
2) If the ticket we're making golden doesn't have an ExtraSid already, we need to state ExtraSids are being present in validationInfo['Data']['UserFlags'].
3) 'Administrator' is not always the name for S-1-5-21-domain-500. Shame on me and all non-us folks
Thanks @gentilkiwi for your feedback!
2015-09-03 20:37:19 -03:00