VM-Packages
VM-Packages copied to clipboard
VM-Install-Shortcut uses unnecessary amount of characters for "executableArgs"
What's the problem?
The function VM-Install-Shortcut
creates an argument $executableArgs
with a long list of arguments that can each be long themselves, leading to the possibility of hitting the character limit when creating a shortcut (which is a quiet error that doesn't display).
I propose we remove the && echo $executableDir^> $executablePath $arguments
piece as this doesn't serve much functionality and it extends the command that is put inside the shortcut by almost double.
Steps to Reproduce
Attempt to create a shortcut whose $executablePath
+ $arguments
may be long, for example:
$executablePath = "%ProgramFiles%\Google\Chrome\Application\chrome.exe" $arguments = "C:\Tools\cyberchef\CyberChef_v10.5.2.html & exit"
This gets cut off around C:\Tools\cyb
which is incomplete for me to perform the action I'm intending to do to fix another issue.
Environment
Environment Independent
Additional Information
No response
Detected by test suite
No
I think the echo
is useful to know what has been run for console applications. From https://github.com/mandiant/VM-Packages/issues/676 (issue for discussion on how to unify and improve shortcuts):
It's useful to display what commands get executed when a LNK is clicked
I think it would be good idea in the shortcut helper to either:
- fail the installation if we exceed the limit
- render a warning remove the
echo
in this case (I prefer this option)
But CyberChef is not a console application, so it should not be run as a console application and the echo
is not used in that case. Or am I missing something @emtuls ? 🤔
Cyberchef is not normally a console application, but due to how I would like to have chrome
open the local cyberchef
.html page (programmatically modifying Chrome config files is fairly inconsistent and will likely break), it would work best if I utilized a command prompt shortcut, which is essentially what our consoleapp
flag creates for VM-Install-Shortcut
.
One other alternative that may resolve the current issue with cyberchef
specifically, if we don't take either of your suggested routes, would be fixing https://github.com/mandiant/VM-Packages/issues/842, as I believe that should reduce the length of the command as well.
I do think it may be worth considering your second option though if we want to be safe for future occurrences of this issue.
@emtuls what is the state of this issue? :thinking: