Best way to obfuscate a Batch File?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
kumarchat
Posts: 1
Joined: 13 Dec 2017 05:54

Re: Best way to obfuscate a Batch File?

#61 Post by kumarchat » 13 Dec 2017 06:04

This doesn't work if I use a HTA application for generating input HTML boxes inside the batch script. The HTML box displays the entire code, any way to do the same?

Squashman
Expert
Posts: 4111
Joined: 23 Dec 2011 13:59

Re: Best way to obfuscate a Batch File?

#62 Post by Squashman » 13 Dec 2017 08:03

Dave, they also posted on SO

FifthAxiom
Posts: 1
Joined: 11 May 2018 08:15

Re: Best way to obfuscate a Batch File?

#63 Post by FifthAxiom » 11 May 2018 08:26

Hi Dave,

There is an error in the batch file. It has to do with re-calling the obfuscated batch file with full path. The problem is you can't determine whether the batch is started from an active console or from the Explorer. Furthermore the pushd and popd commands will not work. I would advise to change the following line:
echo (setlocal enableDelayedExpansion^&for /l %%%%N in (0 1 93) do set "^!@hi@:~%%%%N,1^!=^!@lo@:~%%%%N,1^!")^&cmd /c ^^^^^""%%~f0" ^^!@args@^^!"
echo (setlocal enableDelayedExpansion^&for /l %%%%N in (0 1 93) do set "^!@hi@:~%%%%N,1^!=^!@lo@:~%%%%N,1^!")^&cmd /c ^^^^^""%%~0" ^^!@args@^^!"
I've tested the changes and gave me no errors, even when executed from a parent or child folder.

But hey, thank you for your script. It helped me a lot. Great work!

Curious
Posts: 1
Joined: 11 Aug 2019 08:27

Re: Best way to obfuscate a Batch File?

#64 Post by Curious » 11 Aug 2019 09:50

dbenham wrote:
06 Aug 2017 16:35

Edit 2017-08-31: Bug fix from penpen applied - Added dot to FOR /F delims and bumped version to 1.1
Edit 2017-10-11: Better obscured character mapping in obfuscated file, and bumped version to 1.2
It works great but kasperksy and ESET detect obcusated batch file like a virus, any idea for solve this?

Thanks

Post Reply