r/Batch • • 26d ago

Question (Unsolved) Which batch to exe software to use?

Hi all, long story short I have used bat2exe and windows defender is picking up as threat and removing it. Not sure if its the actual script or the software itself. Anyways, which batch to exe is safest and wont likely get flagged by antivirus? Thank you

3 Upvotes

20 comments sorted by

9

u/Shadow_Thief 26d ago

All of the converters have been used maliciously enough in the past that they all get flagged by heuristic scanners.

1

u/pc1350 25d ago

Adding to what everybody wrote: see this: https://www.dostips.com/forum/viewtopic.php?p=28277#p28277

Dave Benham's masterpiece Colossal Cave Adventure in batch.

Snippet of obfuscated batch file:

cls
<nul set /p "=Initializing "

::{ Inevnoyr qrsvavgvbaf:
::
::  = znpeb qrsvavgvba
:: $kkkkk = fgngvp inyhr, hfhnyyl qrevirq sebz qngnonfr
:: #kkkkk = qlanzvp inyhr arrqrq sbe fnir svyrf
:: kkkkk = qlanzvp inyhr bs grzc vzcbegnapr
::
....and more....
::}
set @{zbir}=for %%. in (1 2) do if %%.==2 (for /f "tokens=1,2 delims= " %%1 in ("!args!") do (%\n%
  if %%1 lss 100 (%\n%
    set /a "{zbir.byqYbp}=#{bowCynpr}.%%1, #{bowCynpr}.%%1=%%2"%\n%
    for %%O in (!{zbir.byqYbp}!) do set "#{cynprBowf}.%%O=!#{cynprBowf}.%%O: %%1 = !"%\n%
    set "#{cynprBowf}.%%2= %%1!#{cynprBowf}.%%2!"%\n%
  ) else (%\n%
    set /a "{zbir.bow100}=%%1-100"%\n%
    set /a "{zbir.byqYbp}=#{bowSvkrq}.!{zbir.bow100}!, #{bowSvkrq}.!{zbir.bow100}!=%%2"%\n%
    for %%O in (!{zbir.byqYbp}!) do set "#{cynprBowf}.%%O=!#{cynprBowf}.%%O: %%1 = !"%\n%
    if %%2 gtr 0 set "#{cynprBowf}.%%2= %%1!#{cynprBowf}.%%2!"%\n%
  )%\n%
)) else set args=

1

u/Boorchu 25d ago

Sorry for being newbie but what is this and how does it relate or help with my question? 😅

1

u/pc1350 25d ago

As I wrote: comments mention obfuscation of a batch file. So here is a real example and how it looks like.

1

u/BellaTheUni112 23d ago

don't use one. they're not good. you should write your program in a compiled language like c if you want an exe file.

1

u/Boorchu 23d ago

I have no clue about programming or anything. Just have this batch only

3

u/capoapk 26d ago

What is your script used for? There can be commands that are suspicious

2

u/BrainWaveCC 26d ago

I've tested a bunch of them over the years, including last year.

I've never found a good reason to rely on one since they come with security drawbacks, like been flagged as malicious code more often than not.

0

u/stevesfara 26d ago

i usually used converters to protect my code. but now i have a trick to encrypt my code using HxD, you have to add FF FE at the start of the file (Remember to ADD, NOT REPLACE) and if you then try to edit in notepad, your code will be encrypted.

2

u/Boorchu 26d ago

Care to share how it works or is there an tutorial for this? That is what I am trying to do - protect my batch. Dont want people to see it by opening it with notepad.

4

u/ProCompSys 26d ago edited 25d ago

Please note this is NOT encryption! At its best it's obfuscation. Just use a hex-editor to create/change the file-header/BOM to "FF FE". This way text-editors stumble over the text-encoding of the file and display gibberish. Execution of the batch-script does work nonetheless.  One who knows or guesses or recognizes the gibberish can easily revert by removing the added header from the file again.

For me, wrapping the batch in a self-extracting RAR- or ZIP-archive that starts the extracted batch-file worked for most cases... it's more or less exactly what bat2exe does. But also this approach extracts the readable script at some point during runtime; grabbing and looking at it in readable form isn't rocket-science.

To cut a long story short:  The is NO way to completely hide a batch-file from other's eyes... if you want closed source, you have to use other approaches than a batch-script.

3

u/BrainWaveCC 26d ago

Dont want people to see it by opening it with notepad.

The script to exe converters are still going to deposit a clear text version of the script on the target machine at runtime. Some leave it in the temp folder, and some clean it up after execution, but it is trivial to recover while the script is running.

2

u/Shadow_Thief 26d ago

It works by converting the text to UTF-16. Anybody with a hex editor will still be able to see your source code. If you want to hide your code, pick a language that actually compiles.

4

u/BrainWaveCC 26d ago

your code will be encrypted.

The word you're looking for is obfuscated, and it is trivial to get direct access to the script again.

3

u/vip17 25d ago

any of such obfuscation method is extremely easy to revert. Game engines have far more complicated methods of obfuscation and yet they can still be c******. The OP really need to think about it differently, not obfuscating it this way

1

u/Glidepath22 25d ago

AI cuts through he encoding so fast it’s like not even there

1

u/Intrepid_Ad_4504 26d ago

None of them

1

u/Glidepath22 25d ago

I had a GTP created well little program I guess to call it trigger defender so I stopped in to look at the actual code and there was absolutely nothing harm on it not even remote possibility at least that I saw so I just don’t defend her to ignore it

1

u/FAMICOMASTER 12d ago

There used to be a tool a long time ago called Advanced Batch to EXE that I got some use out of for obfuscating code in some of my games (makes it harder to cheat).

That was over a decade ago so I don't know if it's still available or still useful or will work for your application. Best of luck.