Code: Select all
(
echo line1
echo line2
rem I am actually echoing over 13,700 lines that are 64 bytes each.
)>decode.tmp
The executable I am encoding is only 644 bytes but when you run it through certutil it creates over 13,700 encoded lines.
Code: Select all
@echo off
set suffix=create.bat
if "%~1"=="" (
echo( Syntax: "%~0" "filename.mp3"
echo( to encode the filename.mp3 into a filename.%suffix% batch script
echo( - any filetype can be encoded into a batch script, even another .bat file
echo(
pause & goto :EOF
)
echo(creating "%~n1.%suffix%"
certutil /encode /f "%~1" "encode.tmp"
find /v /i "CERTIFICATE---" <"encode.tmp" >"encode.tm"
(
echo @echo off
echo if not exist "%~nx1" (
echo echo creating "%~nx1"
echo (
for /f "usebackq delims=" %%a in ("encode.tm") do echo echo %%a
echo ^)^>"decode.tmp"
echo certutil /decode /f "decode.tmp" "%~nx1" ^>nul
echo del "decode.tmp"
echo ^)
)>"%~n1.%suffix%"
del "encode.tm*"
Code: Select all
@echo off
set suffix=create.bat
if "%~1"=="" (
echo( Syntax: "%~0" "filename.mp3"
echo( to encode the filename.mp3 into a filename.%suffix% batch script
echo( - any filetype can be encoded into a batch script, even another .bat file
echo(
pause & goto :EOF
)
echo(creating "%~n1.%suffix%"
certutil /encode /f "%~1" "encode.tmp"
find /v /i "CERTIFICATE---" <"encode.tmp" >"encode.tm"
(
echo @echo off
echo if not exist "%~nx1" (
echo echo creating "%~nx1"
echo (
echo FOR %%%%G IN (
for /f "usebackq delims=" %%a in ("encode.tm") do echo "%%a"
echo ^) DO echo %%%%~G
echo ^)^>"decode.tmp"
echo certutil /decode /f "decode.tmp" "%~nx1" ^>nul
echo del "decode.tmp"
echo ^)
)>"%~n1.%suffix%"
del "encode.tm*"