1

I've been searching for a solution to an issue of wrapping an .hta file into an .exe so users can just click and go. The application I'm working on is a collection of batch scripts which are loaded from the GUI via .hta. I've tried various googled solutions including HTAEdit. All seem to not correctly create the .exe or appear easy targets for a new local infection.

HTAEdit which seems the most legitimate solution worked once and then continually fails, so my questions are as follows:

  • Assuming the below code is correct is there a tool out there that actually converts HTA to EXE?
  • While the below code is somewhat long, being new to programming in general I'm unsure if I messed something up?

(The below code works in the HTAEditor but every-time I try to convert it, it fails to complete conversion.)

Thank you for your time, and sorry is this post is to similar to the one I linked above, there are no further solutions I was able to find either on Stack or Google.

<html>
<title>Foo</title>
<HTA:APPLICATION

ID="Foo"
APPLICATIONNAME="Foo"
BORDERSTYLE="raised"
ICON="Logos/icon.ico"
SINGLEINSTANCE="yes"    
>

<SCRIPT LANGUAGE="VBScript">    
Sub Window_onLoad
    window.resizeTo 800,400
End Sub 

Sub SubChooseScript

For Each Button In SecureOption
    If Button.Checked Then
        If Button.Value = "Category" Then    
            For Each objButton in RadioOption
                If objButton.Checked Then
                    Select Case objButton.Value
                        Case "Selection One"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case "Selection Two"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case "Selection Three"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case Else
                            MsgBox "Something bad happened. Please try again"
                            self.close()
                    End Select
                End If
            Next
        End If
    End If
    If Button.Checked Then
        If Button.Value = "Category Two" Then
            For Each objButton in RadioOption            
                If objButton.Checked Then               
                    Select Case objButton.Value
                        Case "Selection One"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case "Selection Two"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case "Selection Three"
                            Set objShell = CreateObject("Wscript.Shell")
                            objShell.Run "Scripts\foo.bat"
                            self.close()
                        Case Else
                            MsgBox "Something bad happened. Please try again"
                            self.close()
                    End Select
                End If
            Next
        End If
    End if
Next      
End Sub

</SCRIPT>

<body>

<img src="Logos\logo.jpg" align="right" height="200" width="200"/>

<p><b>Radio Options One</b></p>
<div class="button-formatting"> 
<input type="radio" name="RadioOption" value="foo" id="foo"><b>  <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="RadioOption" value="foo" id="foo"><b>  <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="RadioOption" value="foo" id="foo"><b>  <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><P>

<p><b>Radio Options Two</b></p>
<input type="radio" name="foo" value="foo" id="foo"><b><u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="foo" value="foo" id="foo"><b>  <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
</div><BR>

<input id=runbutton  class="button" type="button" value="Options" name="run_button"  onClick="SubChooseScript">
</body>
Community
  • 1
  • 1
ImNotLeet
  • 381
  • 5
  • 19
  • Htaedit also decompresses the exe to an accessible folder structure while executing the exe. I haven't worked with this stuff for a long time, but I'd recall htaedit being commercial, so you've to pay for continuing the use after a trial period. – Teemu Feb 17 '17 at 16:44
  • @Teemu No, you don't have to pay, since the trial period never expires. The only thing is that as long as you don't pay, you get an annoying "Register Now!" dialog box showing up every time you open HtaEdit. – Donald Duck Feb 19 '17 at 13:29
  • Hmm.. I'd recall the exe conversion did work only few times in the trail, then it stopped working, if you didn't pay. – Teemu Feb 19 '17 at 18:17

1 Answers1

0

For those that may stumble upon this question in the future.

After multiple downloads of various .hta to .exe applications, formatting changes and other possible self searched solutions. I found this thread on stack, which in the end provides the functionality of the desired state but without the added headache.

If needed I can then bat2exe the file and get the desired obfuscation of the code.

Community
  • 1
  • 1
ImNotLeet
  • 381
  • 5
  • 19