I too had this problem, albeit with smbexec.py. I realised that calling the script from the impacket/examples dir where it resides normally worked fine… but calling it from a dir in my root directory raised the exception. If you look in the impacket directory, there’s a folder called impacket/krb5 containing a file called keytab.py… calling the script from somewhere outside this directory sometimes means the smbexec.py/psexec.py can’t find that krb5 dir for some reason… but that’s mystery partially solved I guess…
Clone the files from the github repo, then run pip3 install . in the cloned directory.
IMPORTANT: The install process will create a new build folder. Navigate to the build folder then locate the scripts within the build directory. Mine are in a subfolder titled scripts-3.8. You’ll want to run your scripts from the build directory. I think most issues here are from people running the python scripts from outside of the build directory–i.e., in the examples folder.
Clone the files from the github repo, then run pip3 install . in the cloned directory.
IMPORTANT: The install process will create a new build folder. Navigate to the build folder then locate the scripts within the build directory. Mine are in a subfolder titled scripts-3.8. You’ll want to run your scripts from the build directory. I think most issues here are from people running the python scripts from outside of the build directory–i.e., in the examples folder.
This was my issue, thank you for this! Appreciate you taking the time to comment.
hay, I also have a problem with psexec.py. So, now I am working with the first machine and when i enter the next command:
psexec.py administrator@10.10.10.27
i enter the pass and get this:
Password:
[] Requesting shares on 10.10.10.27…
[] Found writable share ADMIN$
[*] Uploading file tdDuQHqv.exe
And then nothing happens, I have waited for about 15 minutes, but nothing
may be someone can help me with such problem
In general, here are some steps you can take to try to fix errors related to the “psexec.py” script:
Make sure you have the latest version of the script. You can download it from the official Sysinternals website.
Check that you have the necessary permissions to run the script. Depending on how you’re using the script, you may need to run it as an administrator or from an elevated command prompt.
Verify that you have the required dependencies installed. The psexec.py script requires Python to be installed on the system. Make sure you have the correct version of Python and any necessary packages installed.
Double-check your command syntax. Make sure you’re using the correct options and arguments when running the script.
If all else fails, try running the script with the “-d” option to enable debug output. This may provide more information about the root cause of the error.