1

I have a batch-file which includes some JScript, but I want to convert it to a .exe so the script can't be seen by others (encrypted)

How can I do this?

I tried with Bat to Exe, but doesn't work since I have JScript.

The code is basically launching a site and entering key inputs, and the .exe manages to launch the site, but that's it

Script:

@if (@CodeSection == @Batch) @then

@echo off

title Top Top
color 0c

if "%inputParty%" == "0" (
  set title= %site% - Bean - Partyless
)

set /p site= Site: 
set /p Clas= Username or Email: 
set /p Party= Party: 
set /p Cars= Cars: 
set /p capture= Capture: 

set inputsite= Site: %site%
set inputClas= Clas: UNKNOWN
set inputParty= Party: %Party%
set inputCars= Cars: %Cars%
set inputcapture= Capture: %capture%
set inputhide= [hide] *Bean* [/hide] 


if "%Clas%" == "Username" (
  set inputClas= Clas: Username:Password
)

if "%Clas%" == "Email" (
  set inputClas= Clas: Email:Password
)

if "%Clas%" == "username" (
  set inputClas= Clas: Username:Password
)

if "%Clas%" == "email" (
  set inputClas= Clas: Email:Password
)


set title= %site% - Bean
if "%Party%" == "0" (
  set title= %site% - Bean - Partyless
)

set SendKeys=CScript //nologo //E:JScript "%~F0"
START https://Cear.io/xxxxx.php?fid=30
timeout /t 5

:: ACCESS TITLE INPUT BOX
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"
%SendKeys% "{TAB}"

:: INPUT TITLE
%SendKeys% "%title%"

:: REDIRECT INPUT TO DESCRIPTION
%SendKeys% "{TAB}"

:: INPUT DESCRIPTION
%SendKeys% "%inputsite%"
%SendKeys% "{ENTER}"
%SendKeys% "%inputClas%"
%SendKeys% "{ENTER}"
%SendKeys% "%inputParty%"
%SendKeys% "{ENTER}"
%SendKeys% "%inputCars%"
%SendKeys% "{ENTER}"
%SendKeys% "%inputcapture%"
%SendKeys% "{ENTER}"
%SendKeys% "{ENTER}"
%SendKeys% "%inputhide%"

if "%Party%"=="0" (goto prefix)
ELSE (
    goto end
)

:prefix 

:: INPUT PREFIX
set x= 20
for /L %%A in (1,1,%x%) do (
    %SendKeys% "{TAB}"
)
    %SendKeys% "{DOWN}"

:end 

goto :EOF


@end
// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

Output:

enter image description here

phuclv
  • 37,963
  • 15
  • 156
  • 475
Hubgum
  • 23
  • 1
  • 5
  • Show us the code... – npocmaka Feb 25 '17 at 10:36
  • 2
    code and text output should be [copy and paste here](http://meta.stackoverflow.com/q/303812/995714), not in image, not in an external link – phuclv Feb 25 '17 at 15:25
  • 1
    You realize you are not encrypting anything. All you are doing is obfuscating or what I like to call security through obscurity. Bat to exe programs just create a self extracting exe. When you launch the exe it is extracting the script to a temp directory and then executing the script. Anyone with half a brain will realize that the first time they run your so called encrypted exe. – Squashman Feb 25 '17 at 16:46

2 Answers2

1

Hybrid JSBatch files are basically a 'hack' and the don't work as expected if compiled.
Try using 'Bat to Exe Converter' from f2ko.de

Instead of using a hybrid JSBatch, it would be easier if you the programs 'Extended commands' to input keyboard keys.

Example Script

@echo off
start notepad.exe
timeout 3 >nul
%extd% /sendkeys "Hello World"

Your Script (Modified)

@echo off


title Top Top
color 0c

if "%inputParty%" == "0" (
  set title= %site% - Bean - Partyless
)


set /p site= Site: 
set /p Clas= Username or Email: 
set /p Party= Party: 
set /p Cars= Cars: 
set /p capture= Capture: 

set inputsite= Site: %site%
set inputClas= Clas: UNKNOWN
set inputParty= Party: %Party%
set inputCars= Cars: %Cars%
set inputcapture= Capture: %capture%
set inputhide= [hide] *Bean* [/hide] 


if "%Clas%" == "Username" (
  set inputClas= Clas: Username:Password
)

if "%Clas%" == "Email" (
  set inputClas= Clas: Email:Password
)

if "%Clas%" == "username" (
  set inputClas= Clas: Username:Password
)

if "%Clas%" == "email" (
  set inputClas= Clas: Email:Password
)



set title= %site% - Bean
if "%Party%" == "0" (
  set title= %site% - Bean - Partyless
)

START https://Cear.io/xxxxx.php?fid=30
timeout /t 5

:: ACCESS TITLE INPUT BOX
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}
%extd% /sendkey {TAB}

:: INPUT TITLE
%extd% /sendkeys "%title%"

:: REDIRECT INPUT TO DESCRIPTION
%extd% /sendkey {TAB}


:: INPUT DESCRIPTION
%extd% /sendkeys "%inputsite%"
%extd% /sendkey {ENTER}
%extd% /sendkeys "%inputClas%"
%extd% /sendkey {ENTER}
%extd% /sendkeys "%inputParty%"
%extd% /sendkey {ENTER}
%extd% /sendkeys "%inputCars%"
%extd% /sendkey {ENTER}
%extd% /sendkeys "%inputcapture%"
%extd% /sendkey {ENTER}
%extd% /sendkey {ENTER}
%extd% /sendkeys "%inputhide%"

if "%Party%"=="0" (goto prefix)
ELSE (
goto end
)


:prefix 
:: INPUT PREFIX
set x= 20
for /L %%A in (1,1,%x%) do (
%extd% /sendkey {TAB}
)
%extd% /sendkey {DOWN}

:end 
goto :EOF
Sam Denty
  • 3,693
  • 3
  • 30
  • 43
  • Thank you for the reply, I tried what you sent me, but I get this error instead: '/sendkey' is not recognized as an internal or external command, operable program or batch file. – Hubgum Feb 25 '17 at 14:38
  • @Hubgum You have to use the Bat To Exe converter to convert it into an EXE first – Sam Denty Feb 25 '17 at 14:39
  • Ok, so I just tried after converting it to a .exe, it launches the site, but does not enter any keys, then the .exe closes. – Hubgum Feb 25 '17 at 14:53
  • %extd% /sendkey {ENTER} is not working for me... my version of FKO bat2exe is 2.4.6--- ?is this a version problem??? – ZEE Jan 08 '22 at 00:00
0

Although converting a .bat to .exe is a bad idea in all cases, this method should solve your problem:

@echo off

title Top Top
color 0c

if "%inputParty%" == "0" (
   set title= %site% - Bean - Partyless
)


set /p site= Site: 
set /p Clas= Username or Email: 
set /p Party= Party: 
set /p Cars= Cars: 
set /p capture= Capture: 

set inputsite= Site: %site%
set inputClas= Clas: UNKNOWN
set inputParty= Party: %Party%
set inputCars= Cars: %Cars%
set inputcapture= Capture: %capture%
set inputhide= [hide] *Bean* [/hide] 


if /I "%Clas%" == "Username" (
   set inputClas= Clas: Username:Password
)

if /I "%Clas%" == "Email" (
   set inputClas= Clas: Email:Password
)


set title= %site% - Bean
if "%Party%" == "0" (
   set title= %site% - Bean - Partyless
)


rem // JScript section

echo var WshShell = WScript.CreateObject("WScript.Shell"); > SendKeys.js
echo WshShell.SendKeys(WScript.Arguments(0)); >> SendKeys.js

set SendKeys=CScript //nologo SendKeys.js
START https://Cear.io/xxxxx.php?fid=30
timeout /t 5

:: ACCESS TITLE INPUT BOX
for /L %%i in (1,1,14) do %SendKeys% "{TAB}"

:: INPUT TITLE
%SendKeys% "%title%"

:: REDIRECT INPUT TO DESCRIPTION
%SendKeys% "{TAB}"

:: INPUT DESCRIPTION
%SendKeys% "%inputsite%{ENTER}"
%SendKeys% "%inputClas%{ENTER}"
%SendKeys% "%inputParty%{ENTER}"
%SendKeys% "%inputCars%{ENTER}"
%SendKeys% "%inputcapture%{ENTER}{ENTER}"
%SendKeys% "%inputhide%"

if "%Party%" neq "0" goto end

:: INPUT PREFIX
for /L %%A in (1,1,20) do %SendKeys% "{TAB}"
%SendKeys% "{DOWN}"

:end 
del SendKeys.js

goto :EOF
Aacini
  • 65,180
  • 12
  • 72
  • 108