Commit Graph

25 Commits

Author SHA1 Message Date
Gabriel Gonzalez 849c74b7b9 Monkeypatches (#2003)
* 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'
2025-08-01 11:39:18 -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
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
BlackWasp 522daa2959 Adds the creation of a new machine account through SMB via ntlmrelayx (#1290)
* Adds the ability to create a new machine account through SMB via ntlmrelayx.

* Update smbattack.py

Delete the '.' at the end of the password printing to limit user confusion. And change a comment to match @jogatu explain.

* Update computer name and password specification, and target

* Update impacket/examples/ntlmrelayx/attacks/smbattack.py

Co-authored-by: leandro <56035084+0xdeaddood@users.noreply.github.com>

* Remove the connectSamr2(), move the exception handles to samr library, remove the re import

* Common option to add computer via SMB or LDAP

---------

Co-authored-by: BlWasp <blwasp@github.com>
Co-authored-by: leandro <56035084+0xdeaddood@users.noreply.github.com>
2024-03-04 08:13:10 -03:00
Gabriel Gonzalez 9b4a139405 Updated Copyright to 2023 2023-07-31 11:48:28 -03:00
anadrianmanrique 32178de690 Merge pull request #1449 from AdrianVollmer/ldap_weak_ciphers
Allow weak TLS ciphers for LDAP connections
2023-02-03 11:19:03 -03:00
Gabriel Gonzalez 8799a1a2c4 Update file banners to reflect Fortra ownership 2022-12-14 17:28:23 -03:00
Adrian Vollmer ad128f87cc Fix copy-paste error 2022-12-14 14:46:11 +01:00
Adrian Vollmer cf9d50f56a Allow weak TLS ciphers for LDAP connections
In Python3.10, the default TLS cipher settings have been set to a more
secure level. See: https://bugs.python.org/issue43998

The change makes sense for general users, but Impacket is regularly used
to access old Windows computers that present certs signed using MD5 or
don't support anything higher than TLSv1.0. Impacket users arguably care
more about exploiting weaknesses than requiring super secure TLS
settings, so this patch lowers the cipher settings to the lowest value.
This is in line with the current behavior of not validating certificates
at all.

Note that this will not help if the TLS handshake fails due to
certificate issues until this bug is fixed in ldap3:
https://github.com/cannatag/ldap3/pull/1067
2022-12-05 15:19:10 +01:00
0xdeaddood 165361a83a Updated copyright year 2022-03-10 11:34:10 -03:00
0xdeaddood 539361973a Merge branch 'remove-duplicate-code' into ccache-refactor 2022-03-10 11:28:06 -03:00
Roman Maksimov 7aabdb1689 fix indent in addcomputer.py 2021-10-30 23:41:19 +03:00
Roman Maksimov 1409b455c8 add the parseFile class method and remove all the duplicate code 2021-10-30 22:33:43 +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
0xdeaddood 7d084049ad Enable the machine account created via SAMR in addcomputer.py 2021-05-17 22:07:33 -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
Arseniy Sharoglazov abb991572d Normalizing [domain/]user[:password] regexps to the right one 2020-04-02 07:33:52 +03:00
Roman Maksimov 865e27e0da fix decoding of byte-strings 2020-03-08 02:11:41 +03:00
asolino 8d4c91481b Print Library's installation path by default when -debug is specified 2020-02-05 19:52:39 -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
asolino f79210ac35 Minor code changes and grammar fixes 2019-11-21 17:50:07 -03:00
asolino 0776ddbe02 Updated copyright and removing unused import 2019-11-21 17:42:59 -03:00
JaGoTu be6181e7fe Addcomputer: Workaround for python bug
https://bugs.python.org/issue11874
2019-09-24 13:10:24 +02:00
Jan Gocník 66c76985ad AddComputer: new example script
AddComputer.py can add a computer to a domain using LDAP or SAMR (SMB)
2019-08-23 15:20:03 +02:00