Commit Graph

75 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
RazzburyPi cb8467c384 Quality of life improvements (#1439)
* Added ability to specify an output file for smbclient.py to log commands / output while using the smbclient shell

* Improved logging to output file for smbclient

* Added increased control over execution of secretsdump.py, including ability to skip specific users when dumping NTDS.dit or skip SAM hive when dumping remote machine

* Improved relaying to ADCS endpoints

* Improved relaying to ADCS endpoints

* Requested ADCS certificates are now saved to lootdir specified in command line

* Improved writing certificate to file

* Improved log file for smbclient.py

* Bug fix with smbclient output file after rebase

* Bug fix with outputfile logic
2024-05-02 23:50:35 -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
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 8d4c91481b Print Library's installation path by default when -debug is specified 2020-02-05 19:52:39 -03: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 0a4c7872b4 Initial smbclient.py and related libs port to Python3
- You should be able to run it with Python2 and 3
- As a side effect other libs were also initially ported. Not finished and just in the context of smbclient.py
2018-10-02 12:59:16 -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
Dirkjan Mollema f148f164f4 Move smbclient.py to library (part 2/2). Allows using the shell from other examples. 2018-04-23 18:51:22 +02:00
Dirkjan Mollema 9a7fba86d5 Move smbclient.py to library (part 1/2) 2018-04-23 18:44:58 +02: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
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
Dirk-jan 40e6471434 Added interactive SMB console via local socket 2016-10-06 22:33:12 +02:00
asolino c049506e43 Minor cosmetic changes 2016-09-13 23:54:50 -03:00
asolino 267ee5e065 Adding -port parameter to support 445/tcp and 139/tcp as destination ports
* I create a new parameters group called 'connection' where you can specify the destination port, the domain controller IP and the target IP (if needed)
* We should propagate the same schema over the rest of the scripts (whenever applicable)
* Aiming at addressing https://github.com/CoreSecurity/impacket/issues/172
2016-07-01 16:07:33 -03:00
asolino 1bdba48374 Adding -dc-ip option to examples
* Allows to specifying the IP address for the DC/kdcHost
* Collateral for https://github.com/CoreSecurity/impacket/issues/160
2016-05-31 21:22:54 -03:00
asolino a8576c0172 Reformatting some code 2016-05-20 21:16:15 -03:00
asolino 8c04d96979 Updating copyright notice. Welcome 2016 2016-01-06 14:08:30 -03:00
q 88ccb48f27 smbclient.py: "cd" command failed to enter JUNCTION or read-only directory 2015-12-17 19:20:16 +09: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 b24c039d4d Adding lcd (local Change Directory) command
* Wondering why it wasn't there before
2015-07-31 19:42:03 -03:00
asolino 8c094b7998 Adding eXecute permissions to the scripts, fixing https://github.com/CoreSecurity/impacket/issues/71 2015-06-25 09:50:19 -03:00
asolino 91113242b3 A better way to test whether the target file is a directory
And also works against an OSX Yosemite SMB Server
2015-06-09 17:55:49 -03:00
asolino 4e32a0d498 Removing some pyCharm's erros/warnings
More scripts/libs changed. Hopefully doesn't break a thing. Test cases are passing
2015-05-25 20:40:17 -03:00
asolino 8b8f8a6947 Pyton imports fixups
1) Removed unnecesary imports, avoid import * whenever possible
2) Copyright updated
3) Minor typos fixed
4) File formats to Unix (LF)
2015-05-23 11:56:59 -03:00
asolino 4c2e64ad3a Second round of logging change.
Now there should be a single logger called 'impacket' the library uses.
By default is has a NullHandler so nothing is printed, but messages are
forwarded to the upstream logger.

If you are a script using the library and want to set the root logger
with a custom formatter, you can import impacket.examples.logger.

After some testing I'll merge it into master
2015-04-25 14:40:42 -03:00
asolino 119e4438dd Changing logging mechanisms everywhere.
Full details coming soon
2015-04-25 14:40:41 -03:00
asolino 0730a3428a Playing with logging, trying to get to something useful to finally have a decent logging inside impacket.
1) We basically define a logger called 'impacket' at the library's __init__, set out a NullHandler for it, and

    2) All the logging stuff in version.py removed

    With this we have a single logger called 'impacket' for the library.

    Now.. what about the example scripts?

    1) Move the impacket/logger.py to impacket/examples/logger.py, since this is something that is used just by the

    2) Example scripts should import that file in order for the library logs to be shown right (from impacket.examp

    For third-party developers that want to disable or change the logs generated by the library:

    1) They could, inside the scripts, logging.getLogger('impacket').disabled = True, or add handlers, or whatever.

    Testing needed..
2015-04-25 14:40:41 -03:00
bethus@gmail.com ff6a318df3 Adding -debug flag 2015-03-26 21:15:50 +00:00
bethus@gmail.com 957ab85864 Changed the who command so you can list the active sessions w/o the need of being Administrator. The whole trick was to use a different information level 2015-03-24 22:29:29 +00:00
bethus@gmail.com d5238f0817 Adding small description when calling the scripts w/no arguments 2015-03-20 19:25:53 +00:00
bethus@gmail.com a64365dcba getCredentials() now returns more data 2015-03-19 22:19:30 +00:00
bethus@gmail.com 0c4d21c073 Credentials are now passed by command line, aligned with other scripts. You can still logoff/logon inside the mini shell tho. 2015-02-02 13:52:43 +00:00
bethus@gmail.com 29d18e8cfd Updated copyright 2015-01-20 22:53:16 +00:00
bethus@gmail.com feb172ebc9 Initial support for Kerberos (see previous commits for the libraries).
From smb_client use:
kerberos_login {domain/username,passwd} - logs into the current SMB connection using Kerberos. If no password specified, it'll be prompted. Use the DNS resolvable domain name

It supports RC4 as of right now.
2014-12-05 12:45:37 +00:00
bethus@gmail.com e9fb70adf5 switching to unicode before processing the actual command. This is needed in case directories/files are unicode encoded. Thanks renaud for the fix. This is part of the bigger https://code.google.com/p/impacket/issues/detail?id=51 issue 2014-09-17 18:31:29 +00:00
bethus@gmail.com 439791f587 SMBConnection.listShares() ported to the new rpcrt 2014-01-27 19:58:16 +00:00
bethus@gmail.com 62de6d31c2 1) helper functions added
2) smbclient updated to use the helper functions
2014-01-15 03:21:05 +00:00
bethus@gmail.com ed8aae1dea Forgot to comment the tracebacks 2014-01-10 22:27:02 +00:00
bethus@gmail.com 041c53a0f7 Migrated to the new RPC Runtime 2014-01-10 22:21:13 +00:00
bethus@gmail.com 60aaf5cec4 Added password command, so the users can change their passwords easily 2013-12-27 15:54:49 +00:00
bethus df5b504bea Changed my mind.. strings returned are UNICODE (NULL terminated). It's up for the client to decode them. Mainly to maintain same behaviour of other functions 2013-11-02 19:04:20 +00:00
bethus@gmail.com d44e3e0b6f smbconnection.listShared() now uses NetrEnumShares(). Changed smbclient.py to reflect that change (difference is unicode decode is not needed) 2013-11-01 23:23:22 +00:00
bethus@gmail.com d90de89bd0 Added who commands, which calls NetrSessionEnum() 2013-11-01 21:29:19 +00:00
bethus@gmail.com 51208f4ed3 Added get_dce_rpc() method to the DCERPCTransport. Now clients don't need to cast a transport to a DCERPC_v5 or V4. That is handled by this method.
I'm changing the examples to reflect this move.
2013-10-29 16:04:19 +00:00