byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.37k stars 1.64k forks source link

Windows Binary Error #426

Closed Bl4d3666 closed 3 years ago

Bl4d3666 commented 3 years ago

Describe the bug I am getting the following error when i try to run the windows binary. I have also copy the powersploit modules and still had the same issue. FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Admin.shiv\cme_51b7721208fc3d0af7e301aa9a56e1da0a38e9ec5bc08bfe8cc9ba14853ac5d1.tmp\site-packages\cme\data\powersploit\CodeExecution\Invoke-ReflectivePEInjection_Resources\DemoDLL_RemoteProcess\DemoDLL_RemoteProcess\DemoDLL_RemoteProcess.vcxproj.filters'

To Reproduce Steps to reproduce the behavior: python cme

Screenshots If applicable, add screenshots to help explain your problem.

Crackmapexec info

mpgn commented 3 years ago

Hello, I just found a solution

exec this command in windows: REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f

image

Then exec the binary.

mpgn commented 3 years ago

Closing since no update. Feel free to reopen.

Hackndo commented 3 years ago

Unfortunately, this doesn't work on Windows Server 2012r2 (https://social.technet.microsoft.com/Forums/en-US/c647ddbb-ab02-4368-b73c-38bc7d5de26b/how-to-enable-paths-longer-than-260-characters-in-windows-2012-r2?forum=winserverfiles)

ebfe90 commented 3 years ago

I think in Windows CME needs to append the prefix "\\?\" to avoid these problems. https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

mpgn commented 3 years ago

@ebfe90 good idea, I need to test this !

mpgn commented 3 years ago

not elegant solution

https://github.com/byt3bl33d3r/CrackMapExec/blob/master/build_collector.py#L45

xoverride commented 2 years ago

Hitting Path limit again with Windows Server 2012

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\svc_apache\.shiv\cme_c737b6bdcbf6ff5c31b5142a88315 dbe40d040271aa27b4e1228ea55757a0318.tmp\site-packages\cme\data\powersploit\CodeExecution\Invoke-ReflectivePEInject ion_Resources\DemoDLL_RemoteProcess\DemoDLL_RemoteProcess\DemoDLL_RemoteProcess.vcxproj'