Read Mode
Default

Properly 'Encode / Obfuscate' Your Code | ObfuscateBatch Plugin | By dbenham

Hey, Everyone! It's me PaperTronics and I'm back with an article based on a popular question, "How Do I Encrypt/Encode/Obfuscate My Code?" If you have the same question, or if you're interested in obfuscation then you're in the right place! Here, in this article. I'm Going to Tell You about the meaning of Encryption. And, How you can achieve it Using the Great creation of Dave Benham. Who is one of the Top level Batch programmers. And, They have created this great plugin for helping others around the globe. 

Properly 'Encode / Obfuscate' Your Code | ObfuscateBat | By dbenham
Code Encryption

What is Obfuscation? 

Before, we take a detailed look into the method of Obfuscation. You might want to know what is obfuscation? Here's a simple Explanation - Obfuscation is the art of making something obscure, unclear, or unintelligible. In other words, obfuscation of code means making your code confusing so that other programmers may not be able to snoop or modify your code!

What is ObfuscateBatch Plugin?

There are several different methods to obfuscate your code, e.g MD5, ROT13, etc. Depending on the method you use, your code may or may not be that much secure. TheBATeam has already published an article on How to manually obfuscate your code. But, Manually obfuscating your code is a lot of work to go through, especially if your code is a lengthy one.

Properly 'Encode / Obfuscate' Your Code | ObfuscateBat Plugin | By dbenham
Layering Your Original Data!
This is a great batch plugin of 5.33 KBs of Size, And it uses JREPL plugin for its proper functioning. Both the ObfuscateBatch Plugin & JREPL are created and distributed by Dave Benham. And, Analyzing their work - We can simply say that - the guy is a genius. And, helping others with his amazing abilities. We, as a team - really appreciate their work.
“The meaning of life is to find your gift. The purpose of life is to give it away.” - Pablo Picasso
So, that's why, Today TheBATeam has brought you the ObfuscateBat Application | By dbenham. Which will enable you to automatically obfuscate your code efficiently! It uses the ROT13 cipher and HiByte (which represents an extended ASCII character between \xA1-\xFF) to give you the optimal layer of security over your code. It requires the JRepl Plugin which is also created by dbenham to work as desired. You can download both of them using the download link below. 

Features of ObfuscateBatch

Now that you've gained knowledge of the application and how it functions. You should take a look at its astonishing features:
  • Light Weight - Only 5.33 KB size 
  • Obfuscates everything - Including labels, variables, variable values, plain text, etc. 
  • Allows preserving - Comments and other text surrounded with {: } will be preserved 
  • Easy To Use - Only takes in 2 parameters to obfuscate the Code 
  • Fast and Efficient - Optimal Obfuscation in only a few milliseconds
  • Highly Effective on Simple batch files... (Not tested on Complicated ones).

Rules For Using This Plugin on Your batch Programs

And, As you know - To Control a big system. We need some rules and regulations. That is the same case with this great batch plugin. you need to understand few Rules of using the ObfuscateBatch Plugin on your batch files. Here are some descriptions from the Programmer Dave Benham. 
  • - Labels should be enclosed in braces:
    :{Label}
    goto {Label}
    call :{Label}
  • User defined variable names should be enclosed in braces:
    set "{VarName}=value"
    echo %{VarName}% or %{VarName}:find=replace%  etc.
    echo !{VarName}! or !{VarName}:find=replace!  etc.
  • Standard "variable" names like %comspec%, %random%, etc. should NOT be enclosed in braces. Such variables will not be obfuscated. If possible, use delayed expansion instead. For example - !comspec!, !random!, etc. Variable names within delayed expansion are obfuscated.
  • Text that should remain human readable within the resultant code should be enclosed in {: }
    {: This text is not obfuscated}
  • Text that should have the ROT13 cipher applied, but not encoded as %HiByte%, should be enclosed in {< }
    {< This text has the ROT13 cipher applied only }
  • Comments of the form %=Comment=% should be enclosed within braces %={ ROT13 will be applied to this comment }=%
  • Remember to use /M if text between braces spans multiple lines

Properly 'Encode / Obfuscate' Your Code | ObfuscateBat Plugin | By dbenham
Properly 'Encode / Obfuscate' Your Code | ObfuscateBat Plugin | By dbenham

Usage 

The syntax of ObfuscateBat is quite unsophisticated. Although, You can simply Use it by calling the plugin and writing the Filename in front of it. And, it will generate a Obfuscated version of your batch File. TheBATeam has converted a 1.5 KBs of Simple PDF reader Test plugin. And, it results in 5.6 KBs of Obfuscated file. And, On Execution - It worked fine as before. But still, its efficiency is unbeatable! So, without any further ado, let's jump right into it!

ObfuscateBatch [/M] SourceFile [OutputFile]

Where: 

/M: Enables multi-line text/comment preserving
SourceFile: The name of the file you want to obfuscate
OutputFile: The name of the file you want the obfuscated code to be placed in 

Note: If OutputFile is undefined, then the output file is named the same as the base name of SourceFile, with _obfuscated appended, and the extension is preserved.

Take a peek at the comments provided in the Source Code of ObfuscateBat for more info on optimal obfuscation and to know how the code is actually obfuscated. Anyways, that's it for the article! You can support TheBATeam by giving your precious feedback in the comment section below! If you want your application/plugin to be featured on our website then feel free to click the Your Work tab above. Thanks for your time!

VirusTotal verification for File Safety: Link
Official Source Code From Dave: Link

Keep Learning, Keep Sharing...
Be Happy, Spread Happiness...

11 comments:

  1. Do not work, JS error in console.

    ReplyDelete
    Replies
    1. I'm Not Sure - but, I Think - you need to install java for this. And, as Most of us already have it installed. That is why, the plugin worked in Our systems (maybe).

      Perhaps, PaperTronics or Dave may help you in this case. I've asked them for help - they'll reply as soon as they could. :)

      Regards,
      Kvc

      Delete
    2. Hi Michal,

      Can You please Elaborate about the Problem you are facing while Using the Plugin. Like, The Error Code, The Screenshot of the scenario etc. etc. :) That would be helpful for debugging.

      Regards,
      TheBATeam

      Delete
  2. Even Test.bat doesnt work.
    Jscript runtime error: Array or arguments object expected

    Tested on 2 computers.

    File creating Hello_obfuscated.bat:

    @echo off&(if defined @lo@ goto ~0,1 tokens=2" %%A in ('chcp') do set "@chcp@=chcp %%A>nul"&chcp 708>nul&set ^"@args@=%*"
    set "@lo@= !#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~""
    set "@hi@="
    (setlocal enableDelayedExpansion&for /l %%N in (0 1 93) do set "!@hi@:~%%N,1!=!@lo@:~%%N,1!")&cmd /c ^""%~f0" !@args@!"
    %@chcp@%&exit /b
    :~0,1

    ReplyDelete
    Replies
    1. First of all - we wanted to know about the language - in which you are using your PC. It seems like - The language maybe the problem.

      And, then here's the link to the Updated version of Dave's Code (ver.1.1) Please Copy and paste the code - inside the 'Files\ObfuscateBatch.bat' (Replace the older Code) And, Then try to run the Test.bat (Deleting the already existing Hello_obfuscated.bat)

      Here's the Link to official responces of the creator of plugin. Maybe this helps Link.

      TheBATeam

      Delete
  3. Windows language: Polish.

    Chcp 852

    I replaced the code. By now program do nothing. Just empty black console window with blinking cursor :)

    ReplyDelete
  4. It's not working for me :/. Output from Test.bat:
    JScript runtime error: Nieprawidłowe wywołanie procedury lub nieprawidłowy argument
    JScript runtime error: Nieprawidłowe wywołanie procedury lub nieprawidłowy argument
    Created Hello_obfuscated.bat file - Done!

    (JScript runtime error: Incorrect procedure call or incorrect argument)

    I tried updating ObfuscateBatch.bat, changing chcp etc. but still doesn't work.

    Windows language: Polish
    Chcp: 852

    ReplyDelete
    Replies
    1. It seems like, the project is not compatible with many Asian languages. Although, You may use a more simplistic way of achieving obfuscation in Batch.

      Delete
    2. Ok, but Poland is in Europe, hah.

      Delete
    3. :) Did We mention the word 'only' anywhere? - like... "not compatible only with asian languages" (something of this kind)

      Try to get the intentions! 'Cuz language is just a tool for passing your intentions to others.
      In which language did people think, when no language had been invented?

      Delete

Powered by Blogger.