PEASS-ng
PEASS-ng copied to clipboard
Space in directory path breaks ColorLine/FORFILES logic within winPEAS.bat
Issue description
If the batch script is run from a directory path with a space, it breaks the ColorLine logic specifically within the FORFILES.exe
loop. I attempted to debug the issue by adding quotes to the FORFILES.exe
command but I couldn't figure out a working solution.
Steps to reproduce the issue
- Place the
winPEAS.bat
file in a path with a space, in my example I usedC:\test folder
. (I originally ran into this issue as I had a space in my Windows username so my path looked something likeC:\Users\Bob Jones\Desktop
) - Run the script and you should see
FORFILES.exe
errors as shown below:
C:\test folder>winPEAS.bat
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
ERROR: Invalid argument/option - 'folder\'.
Type "FORFILES /?" for usage.
...
Which parameters did you use for executing the script and how did you execute it?
none
If winpeas, did you use a clean or obfuscated winpeas, and for which architecture?
Just used the vanilla batch file from the repo.
Is there any AV / Threat protection in the system?
Yes, but its all disabled.
Please, indicate the OS, the OS version, and the kernel version (build number in case of Windows)
Windows 10 Build 19043.1826
Please, indicate the check that is failing and add a screenshot showing the problem
As described above, the ColorLine logic breaks when the batch script is run from a directory path with a space, resulting in FORFILES errors:
How did you expect it to work?
I expected the script to run without errors.
Additional details / screenshot
Hey @naterobbified, Sorry for the waiting. Could you send a PR that if the current path contains spaces Winpeas notifies it and ends the execution?