Author Posts

August 21, 2014 at 5:25 am

Hi,
I made the base 64 encoding of a powershell script to run from the console remotely within a batch file.
You can encrypt the base 64 encoding for not trace the structure of the code?
Alternatively, there is a method to do this?
Thanks

August 21, 2014 at 5:29 am

There's never going to be a 100% secure way to prevent people from reading your script code; it always has to be decrypted before it can be executed, and whoever is able to run the script is also able to decrypt it.

That said, the "compile to exe" functionality of Sapien's PowerShell Studio product creates .NET executables which contain encrypted script code, and the process to decrypt that code is pretty well obfuscated. Like I said, it's not perfect, but it would discourage all but the most determined people. So far, that's the only product I've seen which doesn't make it completely trivial to extract the original PowerShell code.

August 21, 2014 at 5:47 am

Time ago I also tried the feature "compile to exe" but some antivirus (AVG, Avast, ...) detect infected .exe file.
Something wrong?

August 21, 2014 at 5:51 am

I don't know. Depends on which tool you used to compile the script to exe. If it was a malicious program, then maybe it produced infected executables of some sort. Or maybe it was a legitimate compiled EXE, but the executable triggered some heuristic analysis flag in the AV software.

August 21, 2014 at 5:55 am

I used a trial version of Sapien's PowerShell Studio .....
Probably the executable triggered some heuristic analysis flag in the AV software.
Thanks!