Skip to content

Instantly share code, notes, and snippets.

@phoenixthrush
Created October 5, 2022 15:47
Show Gist options
  • Save phoenixthrush/4a1ac593f333ae3d98f51754cb0db989 to your computer and use it in GitHub Desktop.
Save phoenixthrush/4a1ac593f333ae3d98f51754cb0db989 to your computer and use it in GitHub Desktop.
Quickly obfuscate batch files (not secure)
@echo off
if "%~1"=="" exit /b
if /i "%~x1" neq ".bat" if /i "%~x1" neq ".cmd" exit /b
for /f %%i in ("certutil.exe") do if not exist "%%~$path:i" (
echo CertUtil.exe not found.
pause
exit /b
)
>"temp.~b64" echo(//4mY2xzDQo=
certutil.exe -f -decode "temp.~b64" "%~n1-obfuscated%~x1"
del "temp.~b64"
copy "%~n1-obf%~x1" /b + "%~1" /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment