Passing parameters to an executable

1

I have an application that is split into two different executables.

The first executable is the 'brain' of my application, in this executable, in which I named it STUB, will be the main logic of the application with some additional and optional methods (some mandatory but variable) as hosts , ports, popups, etc.

The second executable is exactly the part of the optional and mandatory, in which I call it the UI, that is, the user will choose the options he wants and from that UI, create the new executable.

Using my STUB as a base * .exe, I want my UI to re-write to my STUB by setting the user-defined options, thus creating a new executable that will work according to the options that the user has chosen .

The only type of application that I can remember to have such functionality are the Remote Administration Tools (RATs) and some Keyloggers, in which you can create a remote connection server to control a computer, and in this creation you can define several options ( your ip, installation location, etc.). Connection servers are also generated from a base * .exe.

I took a random image of google to exemplify, there is a window of customization of a RAT (Note that the last tab is just the one of * .exe construction with the pre-defined settings):

@UPDATE:IdonotknowifithelpsbutbyrollingprehistoriccodeIfoundacodeinVB6thatdoessomethingsimilar.ItpicksuptheSTD.exefilewhichinitiallydoesnothingandoveritcreatesanotherone(RWSTD.exe)byaddingaMsgBox()whenitstarts.IhavealreadytriedtosearchthefunctionoftheselinesofcodeandtrytoreplicateinC#,buttonoavail.Lookatthecodes:

ClientUI:

PrivateSubCommand1_Click()DimSTDAsString,RWSTDAsString,MIDAsString,DELAsStringDEL="DELIMITADOR"

    Open App.Path & "\STD.exe" For Binary As #1
    STD = Space(LOF(1))
    Get #1, , STD
    Close #1

    If FileExists(App.Path & "\RWSTD.exe") Then
        Kill App.Path & "\RWSTD.exe"
    End If

    Open App.Path & "\RWSTD.exe" For Binary As #1
    RWSTD = Space(LOF(1))
    Get #1, , RWSTD
    Put #1, , STD & DEL & txtMsgBox.Text
    Close #1

End Sub

Private Sub Form_Load()
    If Not FileExists("STD.exe") Then
        Unload Me
    End If
End Sub

STB.exe:

Sub Starter()
    Dim DATA As String, DEL() As String, i As Long

    Open App.Path & "\" & App.EXEName & ".exe" For Binary As #1
    DATA = Space(LOF(1))
    Get #1, , DATA
    Close #1

    DEL() = Split(DATA, "DELIMITADOR")

    For i = 1 To UBound(DEL)
        If Not (DEL(i) = "MZ") Then
            MsgBox (DEL(i))
        End If
    Next
End Sub
    
asked by anonymous 20.10.2017 / 00:28

1 answer

1

If you want to change values of strings that are inside the executable, you can do the following:

1) Convert the executable into an IL (Intermediate language) file;
2) Do a search / replace in IL file. 3) Recompile the IL to generate the new executable.

The .NET SDK has the Ildasm.exe tool. to make this conversion.

    
23.10.2017 / 02:40