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 used C:\test folder. (I originally ran into this issue as I had a space in my Windows username so my path looked something like C:\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:
<img width="674" alt="Capture2" src="https://user-images.githubusercontent.com/3721692/179841942-9c7188df-b576-45da-9944-79ee77b90981.PNG">
#### How did you expect it to work?
I expected the script to run without errors.
#### Additional details / screenshot
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 theFORFILES.exe
command but I couldn't figure out a working solution.Steps to reproduce the issue
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
)FORFILES.exe
errors as shown below: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. ...