Advertisement
Guest User

Untitled

a guest
Feb 26th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.93 KB | None | 0 0
  1. hello i have a probem with my injector here is my code :
  2.  
  3. Public Class Form1
  4.  
  5. Dim dlls As New Dictionary(Of String, String)
  6.  
  7. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
  8. 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
  9. 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
  10. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
  11. Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
  12. 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
  13. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Integer, ByVal dwMilliseconds As Integer) As Integer
  14. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
  15.  
  16. Private Function Inject(ByVal pID As Integer, ByVal dllLocation As String) As Boolean
  17.  
  18. Dim hProcess As Integer = OpenProcess(&H1F0FFF, 1, pID)
  19. If hProcess = 0 Then Return False
  20. Dim dllBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(dllLocation)
  21. Dim allocAddress As Integer = VirtualAllocEx(hProcess, 0, dllBytes.Length, &H1000, &H4)
  22. If allocAddress = Nothing Then Return False
  23. Dim kernelMod As Integer = GetModuleHandle("kernel32.dll")
  24. Dim loadLibAddr = GetProcAddress(kernelMod, "LoadLibraryA")
  25. If kernelMod = 0 OrElse loadLibAddr = 0 Then Return False
  26. WriteProcessMemory(hProcess, allocAddress, dllBytes, dllBytes.Length, 0)
  27. Dim libThread As Integer = CreateRemoteThread(hProcess, 0, 0, loadLibAddr, allocAddress, 0, 0)
  28.  
  29. If libThread = 0 Then
  30. Return False
  31. Else
  32. WaitForSingleObject(libThread, 5000)
  33. CloseHandle(libThread)
  34. End If
  35. CloseHandle(hProcess)
  36. Label3.Text = "DLL Successfully Injected."
  37. If CheckBox1.Checked = True Then
  38. Me.Close()
  39. End If
  40.  
  41. Return True
  42. End Function
  43.  
  44. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  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(TextBox1.Text)
  71. If TargetProcess.Length = 0 Then
  72. Label3.Text = ("Waiting for " + TextBox1.Text + ".exe")
  73.  
  74. Else
  75. Dim ProcID As Integer = Process.GetProcessesByName(TextBox1.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 TextBox1.Text = "" Then
  88. Label3.Text = "Waiting for process to be set."
  89.  
  90. Timer1.Stop()
  91. ElseIf ListBox1.Items.Count = 0 Then
  92. Label3.Text = "Waiting for DLL path."
  93. Timer1.Stop()
  94. Else
  95. Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
  96. If TargetProcess.Length = 0 Then
  97. Label3.Text = ("Waiting for " + TextBox1.Text + ".exe")
  98.  
  99. Else
  100. If RadioButton2.Checked = True Then
  101. Timer1.Start()
  102. End If
  103. End If
  104. End If
  105. End Sub
  106.  
  107. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  108. OpenFileDialog1.Filter = "DLL (*.dll) |*.dll"
  109. OpenFileDialog1.ShowDialog()
  110. End Sub
  111.  
  112. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  113. If ListBox1.SelectedIndex >= 0 Then
  114. OpenFileDialog1.Reset()
  115. dlls.Remove(ListBox1.SelectedItem)
  116. For i As Integer = (ListBox1.SelectedItems.Count - 1) To 0 Step -1
  117. Dim i2 As Integer = i + 2
  118. ListBox1.Items.Remove(ListBox1.SelectedItems(i))
  119. Next
  120. End If
  121. End Sub
  122.  
  123. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  124. ListBox1.Items.Clear()
  125. dlls.Clear()
  126. End Sub
  127.  
  128. Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
  129. If CheckBox1.Checked = True Then
  130. My.Settings.close = 1
  131. Else
  132. My.Settings.close = 0
  133. End If
  134. My.Settings.Save()
  135. My.Settings.Reload()
  136. End Sub
  137.  
  138. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  139. My.Settings.inject = "manual"
  140. My.Settings.Save()
  141. My.Settings.Reload()
  142. Button4.Enabled = True
  143. Timer1.Stop()
  144. End Sub
  145.  
  146. Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
  147. My.Settings.inject = "auto"
  148. My.Settings.Save()
  149. My.Settings.Reload()
  150. Button4.Enabled = False
  151. Timer1.Start()
  152. End Sub
  153.  
  154. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  155. If ListBox1.Items.Count > 0 Then
  156. If TextBox1.Text <> "" Then
  157. Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
  158. If TargetProcess.Length = 0 Then
  159. MsgBox(TextBox1.Text + ".exe i not running.", MsgBoxStyle.Critical, "Error")
  160. Else
  161. Timer1.Stop()
  162. Dim ProcID As Integer = Process.GetProcessesByName(TextBox1.Text)(0).Id
  163.  
  164. End If
  165. Else
  166. MsgBox("You haven't specified a process.", MsgBoxStyle.Critical, "Error")
  167. End If
  168. Else
  169. MsgBox("You need to select a DLL file to inject.", MsgBoxStyle.Critical, "Error")
  170. End If
  171. End Sub
  172.  
  173. Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  174.  
  175. End Sub
  176.  
  177. Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs )
  178.  
  179. End Sub
  180.  
  181. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
  182. System.Diagnostics.Process.Start("www.mpgh.net/forum/201-alliance-valiant-arms-ava-hacks-cheats/")
  183. End Sub
  184. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement