Advertisement
xxmakarovxx

Untitled

Dec 26th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.93 KB | None | 0 0
  1. Public Class Form1
  2.  
  3. Dim dlls As New Dictionary(Of String, String)
  4.  
  5. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
  6. Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
  7. Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer() As Byte, ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As UInteger) As Boolean
  8. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
  9. Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
  10. Private Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByVal lpThreadId As Integer) As Integer
  11. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Integer, ByVal dwMilliseconds As Integer) As Integer
  12. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
  13.  
  14. Private Function Inject(ByVal pID As Integer, ByVal dllLocation As String) As Boolean
  15.  
  16. Dim hProcess As Integer = OpenProcess(&H1F0FFF, 1, pID)
  17. If hProcess = 0 Then Return False
  18. Dim dllBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(dllLocation)
  19. Dim allocAddress As Integer = VirtualAllocEx(hProcess, 0, dllBytes.Length, &H1000, &H4)
  20. If allocAddress = Nothing Then Return False
  21. Dim kernelMod As Integer = GetModuleHandle("kernel32.dll")
  22. Dim loadLibAddr = GetProcAddress(kernelMod, "LoadLibraryA")
  23. If kernelMod = 0 OrElse loadLibAddr = 0 Then Return False
  24. WriteProcessMemory(hProcess, allocAddress, dllBytes, dllBytes.Length, 0)
  25. Dim libThread As Integer = CreateRemoteThread(hProcess, 0, 0, loadLibAddr, allocAddress, 0, 0)
  26.  
  27. If libThread = 0 Then
  28. Return False
  29. Else
  30. WaitForSingleObject(libThread, 5000)
  31. CloseHandle(libThread)
  32. End If
  33. CloseHandle(hProcess)
  34. Label2.Text = "DLL Successfully Injected."
  35. If CheckBox1.Checked = True Then
  36. Me.Close()
  37. End If
  38.  
  39. Return True
  40. End Function
  41.  
  42. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  43. MessageBox.Show("Thanks For choosing our program.-STEALTH TEAM", "STEALTH DLL INJECTOR")
  44.  
  45. If My.Settings.inject = "auto" Then
  46. RadioButton2.Checked = True
  47. ElseIf My.Settings.inject = "manual" Then
  48. RadioButton1.Checked = True
  49. Else
  50. RadioButton2.Checked = True
  51. End If
  52.  
  53. If My.Settings.close = 1 Then
  54. RadioButton2.Checked = True
  55. Else
  56. RadioButton2.Checked = False
  57.  
  58. End If
  59. End Sub
  60.  
  61. Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
  62. Dim FileName As String = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
  63. Dim DllFileName As String = FileName.Replace("\", "")
  64. ListBox1.Items.Add(DllFileName)
  65. dlls.Add(DllFileName, OpenFileDialog1.FileName)
  66. End Sub
  67.  
  68. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  69. If ListBox1.Items.Count > 0 Then
  70. Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox1.Text)
  71. If TargetProcess.Length = 0 Then
  72. Label2.Text = ("Waiting for " + ProcessTextBox1.Text + ".exe to run")
  73.  
  74. Else
  75. Dim ProcID As Integer = Process.GetProcessesByName(ProcessTextBox1.Text)(0).Id
  76. Timer1.Stop()
  77. Timer2.Stop()
  78.  
  79. For Each inj As KeyValuePair(Of String, String) In dlls
  80. Inject(ProcID, inj.Value)
  81. Next
  82. End If
  83. End If
  84. End Sub
  85.  
  86. Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  87. If ProcessTextBox1.Text = "PointBlank" Then
  88. Label2.Text = "Waiting for PointBlank.exe"
  89.  
  90. Timer1.Stop()
  91. ElseIf ListBox1.Items.Count = 0 Then
  92. Label2.Text = "Waiting for DLL path."
  93. Timer1.Stop()
  94. Else
  95. Dim TargetProcess As Process() = Process.GetProcessesByName("PointBlank.exe")
  96. If TargetProcess.Length = 0 Then
  97. Label2.Text = ("Waiting for PointBlank.exe")
  98.  
  99. Else
  100. If RadioButton2.Checked = True Then
  101. Timer1.Interval = 5000
  102. Timer1.Start()
  103.  
  104. End If
  105. End If
  106. End If
  107. End Sub
  108.  
  109. Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
  110. OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
  111. OpenFileDialog1.ShowDialog()
  112. End Sub
  113.  
  114. Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
  115. If ListBox1.SelectedIndex >= 0 Then
  116. OpenFileDialog1.Reset()
  117. dlls.Remove(ListBox1.SelectedItem)
  118. For i As Integer = (ListBox1.SelectedItems.Count - 1) To 0 Step -1
  119. Dim i2 As Integer = i + 2
  120. ListBox1.Items.Remove(ListBox1.SelectedItems(i))
  121. Next
  122. End If
  123. End Sub
  124.  
  125. Private Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click
  126. ListBox1.Items.Clear()
  127. dlls.Clear()
  128. End Sub
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Private Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click ' Inject Button
  137.  
  138. If ListBox1.Items.Count > 0 Then
  139. If ProcessTextBox1.Text <> "" Then
  140. Dim TargetProcess As Process() = Process.GetProcessesByName(ProcessTextBox1.Text)
  141. If TargetProcess.Length = 0 Then
  142. MsgBox(ProcessTextBox1.Text + ".exe is not running.", MsgBoxStyle.Critical, "Error")
  143. Else
  144. Timer1.Stop()
  145. Dim ProcID As Integer = Process.GetProcessesByName(ProcessTextBox1.Text)(0).Id
  146.  
  147. End If
  148. Else
  149. MsgBox("You haven't specified a process.", MsgBoxStyle.Critical, "Error")
  150. End If
  151. Else
  152. MsgBox("You need to select a DLL file to inject.", MsgBoxStyle.Critical, "Error")
  153. End If
  154.  
  155. Timer1.Start()
  156.  
  157.  
  158. End Sub
  159.  
  160.  
  161. Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
  162. If CheckBox1.Checked = True Then
  163. My.Settings.close = 1
  164. Else
  165. My.Settings.close = 0
  166. End If
  167. My.Settings.Save()
  168. My.Settings.Reload()
  169. End Sub
  170.  
  171. Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
  172.  
  173. My.Settings.inject = "auto"
  174. My.Settings.Save()
  175. My.Settings.Reload()
  176. Button4.Enabled = False
  177. Timer1.Interval = 5000
  178. Timer1.Start()
  179.  
  180.  
  181.  
  182.  
  183.  
  184. End Sub
  185.  
  186. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  187. My.Settings.inject = "manual"
  188. My.Settings.Save()
  189. My.Settings.Reload()
  190. Button4.Enabled = True
  191. Timer1.Stop()
  192. End Sub
  193. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement