Ok guys kali ini CahBoedi akan share tentang Cara membuat Injector dengan Visual Basic 6. Ok guys gak usah lama-lama langsung aja yok ke tutorialnya
Visual Basic 6 .
Fitur:
- Suspend Otomatis
- Multiple Dll Injection
- Commond Dialog API <-- jadi ga perlu lagi harus pasang component commond dialog
Form dan kode pada form
buat 1 form dengan nama form1
buat 5 command button, masing2 beri nama : command1,command2,cmdInjector,cmdExecute,cmdTerminate.
untuk cmdInjector beri nama caption "Select DLL For Inject" tanpa tanda kutip
untuk cmdExecute beri nama caption "Resume".
untuk cmdTerminate beri nama caption "Terminate"
buat timer pada form, masing2 beri nama : timer1 dan timer2
masukkan listing ini pada form1 :
Private resmue As String
Private winHwnd As Long
Private bSuspend As Boolean
Private Sub cmdExecute_Click()
resmue = "yes"
Unload Me
End Sub
Private Sub cmdInjector_Click()
On Error GoTo errLine
If Not cmdInjector.Caption = "Inject Now" Then
Dim theTemp As String
theTemp = OpenDialog(Me, "DLL files (*.dll)|*.dll", "Select DLL File For Inject...", App.Path)
If Trim$(theTemp) <> "" Then
If Dir$(theTemp) <> "" Then
sFlDLL = theTemp
cmdInjector.Caption = "Inject Now"
Else
sFlDLL = "None"
cmdInjector.Caption = "Select DLL For Inject"
End If
End If
Else
If sFlDLL = "None" Then
MsgBox "You can't Injector execute", 48, "Error Injector"
Exit Sub
Else
InjectExecute sFlDLL
sFlDLL = "None"
cmdInjector.Caption = "Select DLL For Inject"
End If
End If
Exit Sub
errLine:
MsgBox "File tidak respon atau tidak support", 48, "Error"
End Sub
Private Sub cmdTerminate_Click()
resmue = "yes"
On Error Resume Next
Dim lExitCode As Long
If MsgBox("Terminate Hackshield sekarang?", _
vbYesNo + vbExclamation, "Terminate Proses") = vbYes Then
lExitCode = TerminateTargetOne
If lExitCode = 0 Then
MsgBox "Proses terminate gagal.", _
vbExclamation, "Terminate info"
cmdTerminate.Enabled = False
Else
lExitCode = TerminateTargetTwo
If lExitCode = 0 Then
MsgBox "Proses terminate sukses.", _
vbExclamation, "Terminate info"
Else
Unload Me
End If
End If
End If
End Sub
Private Sub Command1_Click()
InjectExecute App.Path & "\example1.dll"
End Sub
Private Sub Command2_Click()
InjectExecute App.Path & "\example2.dll"
End Sub
Private Sub Form_Load()
bSuspend = False
Me.Left = (Screen.Width - Width) / 2
' Me.Top = -1000
Timer2.Interval = 20
Timer2.Enabled = True
FileTargetOne = "PointBlank.exe"
FileTargetTwo = "HSUpdate.exe"
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If bSuspend = True Then
If Not resmue = "yes" Then
If MsgBox("Klik Yes untuk Terminate (PB dan HS) dan No Untuk Membatalkan", vbYesNo, "") = vbYes Then
cmdTerminate_Click
Else
Cancel = -1
End If
Else
OpenURL "http://www.blazetorm.net", Me.hwnd
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If bSuspend = True Then SetSuspendResumeThread False
End
End Sub
Private Sub Timer1_Timer()
winHwnd = FindWindow(vbNullString, "HSUpdate")
If winHwnd <> 0 Then
NTProcessList
SetSuspendResumeThread True
cmdTerminate.Enabled = True
cmdExecute.Enabled = True
cmdInjector.Enabled = True
'pengaturan tombol jadi aktif
Command1.Enabled = True
Command2.Enabled = True
bSuspend = True
Vibrate Me, 100, 20
MoveToTop
Timer1.Enabled = False
Else
cmdTerminate.Enabled = False
cmdExecute.Enabled = False
cmdInjector.Enabled = False
'-------------------------
'pengaturan tombol jadi tidak aktif
Command1.Enabled = False
Command2.Enabled = False
Timer1.Enabled = True
bSuspend = False
End If
End Sub
Private Sub Timer2_Timer()
Me.Top = (Screen.Height - Height) / 2
Timer2.Enabled = False
Timer1.Enabled = True
Timer1.Interval = 20
End Sub
Sub SlideWindow(frmSlide As Form, iSpeed As Integer)
While frmSlide.Top - frmSlide.Height < Screen.Height
DoEvents
frmSlide.Top = frmSlide.Top + iSpeed
Wend
End Sub
Private Sub MoveToTop()
Dim currentTop As Long
Dim TargetTop As Long
Dim currentLeft As Long
Dim TargetLeft As Long
Dim i As Long
currentTop = Me.Top
TargetTop = (Screen.Height - Height) / 50
For i = currentTop To TargetTop Step -2
Me.Top = i
Next i
currentLeft = Me.Left
TargetLeft = (Screen.Width - Me.Width) - 100
For i = currentLeft To TargetLeft Step 2
Me.Left = i
Next i
End Sub
Private Sub Vibrate(Frm As Form, rScale As Integer, Times As Integer)
Dim Lft As Long, Tp As Long
Dim i
Lft = Frm.Left
Tp = Frm.Top
For i = 1 To Times
Frm.Move Lft + Sgn(rScale)
Pause 20
Frm.Move Lft + rScale
Pause 20
Frm.Move Lft, Tp + Sgn(rScale), Frm.Width, Frm.Height
Pause 20
Frm.Move Lft, Tp + rScale, Frm.Width, Frm.Height
Pause 20
Next i
End Sub
Private Sub Pause(ms)
Dim secs
Dim g
secs = ms / 1000
g = Timer
Do While Timer - g < secs
DoEvents
Loop
End Sub
kemudian langkah selanjutnya, buat 4 modul masing beri nama
ModCDialog,ModInjector, ModBrowser, dan ModProcess.
masukkan kode berikut pada ModCDialog:
Option Explicit
'Common Dialog
Private Type OPENFILENAME
lStructSize As Long
hWndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Const OFN_READONLY = &H1
Public Const OFN_OVERWRITEPROMPT = &H2
Public Const OFN_HIDEREADONLY = &H4
Public Const OFN_NOCHANGEDIR = &H8
Public Const OFN_SHOWHELP = &H10
Public Const OFN_ENABLEHOOK = &H20
Public Const OFN_ENABLETEMPLATE = &H40
Public Const OFN_ENABLETEMPLATEHANDLE = &H80
Public Const OFN_NOVALIDATE = &H100
Public Const OFN_ALLOWMULTISELECT = &H200
Public Const OFN_EXTENSIONDIFFERENT = &H400
Public Const OFN_PATHMUSTEXIST = &H800
Public Const OFN_FILEMUSTEXIST = &H1000
Public Const OFN_CREATEPROMPT = &H2000
Public Const OFN_SHAREAWARE = &H4000
Public Const OFN_NOREADONLYRETURN = &H8000
Public Const OFN_NOTESTFILECREATE = &H10000
Public Const OFN_NONETWORKBUTTON = &H20000
Public Const OFN_NOLONGNAMES = &H40000 ' force no long names for 4.x modules
Public Const OFN_EXPLORER = &H80000 ' new look commdlg
Public Const OFN_NODEREFERENCELINKS = &H100000
Public Const OFN_LONGNAMES = &H200000 ' force long names for 3.x modules
Public Const OFN_SHAREFALLTHROUGH = 2
Public Const OFN_SHARENOWARN = 1
Public Const OFN_SHAREWARN = 0
Private Declare Function GetOpenFileName Lib "COMDLG32.DLL" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName Lib "COMDLG32.DLL" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
'Browse Folder Declarations
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const MAX_PATH = 260
Public Const BIF_STATUSTEXT = &H4&
Public Const BIF_DONTGOBELOWDOMAIN = 2
Public Const WM_USER = &H400
Public Const BFFM_INITIALIZED = 1
Public Const BFFM_SELCHANGED = 2
Public Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
Public Const BFFM_SETSELECTION = (WM_USER + 102)
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Function OpenDialog(Form1 As Form, Filter As String, Title As String, InitDir As String) As String
Dim ofn As OPENFILENAME
Dim A As Long
Dim theTemp As String
ofn.lStructSize = Len(ofn)
ofn.hWndOwner = Form1.hwnd
ofn.hInstance = App.hInstance
If Right$(Filter, 1) <> "|" Then Filter = Filter + "|"
For A = 1 To Len(Filter)
If Mid$(Filter, A, 1) = "|" Then Mid$(Filter, A, 1) = Chr$(0)
Next
ofn.lpstrFilter = Filter
ofn.lpstrFile = Space$(254)
ofn.nMaxFile = 255
ofn.lpstrFileTitle = Space$(254)
ofn.nMaxFileTitle = 255
ofn.lpstrInitialDir = InitDir
ofn.lpstrTitle = Title
ofn.Flags = OFN_HIDEREADONLY Or OFN_FILEMUSTEXIST
A = GetOpenFileName(ofn)
If (A) Then
theTemp = Trim$(ofn.lpstrFile)
If Asc(Right$(theTemp, 1)) = 0 Then theTemp = Left$(theTemp, Len(theTemp) - 1)
OpenDialog = theTemp
Else
OpenDialog = ""
End If
End Function
Public Function BrowseForFolder(hWndOwner As Long, sPrompt As String) As String
'**************************************
' Name: Win95DirectoryPrompt
' Description:Prompting the User for a D
' irectory in Win95. Windows' common dialo
' gs are great if you want the user to sel
' ect a file, but what if you want them to
' select a directory? Call the following f
' unction, which relies on Win32's new SHB
' rowseForFolder function:
' By: Found on the World Wide Web
Dim iNull As Integer
Dim lpIDList As Long
Dim lResult As Long
Dim sPath As String
Dim udtBI As BrowseInfo
With udtBI
.hWndOwner = hWndOwner
.lpszTitle = lstrcat(sPrompt, "")
.ulFlags = BIF_RETURNONLYFSDIRS
End With
lpIDList = SHBrowseForFolder(udtBI)
If lpIDList Then
sPath = String$(MAX_PATH, 0)
lResult = SHGetPathFromIDList(lpIDList, sPath)
Call CoTaskMemFree(lpIDList)
iNull = InStr(sPath, vbNullChar)
If iNull Then
sPath = Left$(sPath, iNull - 1)
End If
End If
If InStr(LCase$(sPath), "\nethood") > 0 Then
MsgBox "The item that you selected is a folder shortcut, not a folder.", vbCritical, "Browse Folders"
BrowseForFolder = ""
Else
BrowseForFolder = sPath
End If
End Function
masukkan kode berikut pada ModInjector:
Option Explicit
Public Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Public Declare Function PostMessage Lib "USER32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function Process32First Lib _
"kernel32" (ByVal hSnapShot As Long, _
uProcess As PROCESSENTRY32) As Long
Public Declare Function Process32Next Lib _
"kernel32" (ByVal hSnapShot As Long, _
uProcess As PROCESSENTRY32) As Long
Public Declare Function CloseHandle Lib _
"kernel32" (ByVal hObject As Long) As Long
Public FileTargetOne As String
Public FileTargetTwo As String
Public sFlDLL As String
Public IdTargetOne As Long
Private IdTargetTwo As Long
Private Const TH32CS_SNAPHEAPLIST = &H1
Private Const TH32CS_SNAPPROCESS = &H2
Private Const TH32CS_SNAPTHREAD = &H4
Private Const TH32CS_SNAPMODULE = &H8
Private Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or _
TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Private Const MAX_PATH = 260
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Type MODULEENTRY32
dwSize As Long
th32ModuleID As Long
th32ProcessID As Long
GlblcntUsage As Long
ProccntUsage As Long
modBaseAddr As Long
modBaseSize As Long
hModule As Long
szModule As String * 256
szExePath As String * 260
End Type
Private Type THREADENTRY32
dwSize As Long
cntUsage As Long
th32ThreadID As Long
th32OwnerProcessID As Long
tpBasePri As Long
tpDeltaPri As Long
dwFlags As Long
End Type
Private Const THREAD_SUSPEND_RESUME = &H2
Private Declare Function OpenThread Lib _
"kernel32.dll" (ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Boolean, _
ByVal dwThreadId As Long) As Long
Private Declare Function ResumeThread Lib _
"kernel32.dll" (ByVal hThread As Long) As Long
Private Declare Function SuspendThread Lib _
"kernel32.dll" (ByVal hThread As Long) As Long
Private hThread As Long
Private Declare Function CreateToolhelp32Snapshot Lib _
"kernel32" (ByVal lFlags As Long, _
ByVal lProcessID As Long) As Long
Private Declare Function Module32First Lib _
"kernel32" (ByVal hSnapShot As Long, _
uProcess As MODULEENTRY32) As Long
Private Declare Function lstrlen Lib _
"kernel32" Alias "lstrlenA" ( _
ByVal lpString As String) As Long
Private Declare Function GetFileTitle Lib _
"COMDLG32.DLL" Alias "GetFileTitleA" ( _
ByVal lpszFile As String, _
ByVal lpszTitle As String, _
ByVal cbBuf As Integer) As Integer
Private Declare Function Thread32First Lib _
"kernel32.dll" (ByVal hSnapShot As Long, _
ByRef lpte As THREADENTRY32) As Boolean
Private Declare Function Thread32Next Lib _
"kernel32.dll" (ByVal hSnapShot As Long, _
ByRef lpte As THREADENTRY32) As Boolean
Public Declare Function OpenProcess Lib _
"kernel32" (ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib _
"kernel32" (ByVal hProcess As Long, _
ByVal uExitCode As Long) As Long
Public Function NTProcessList() As Long
On Error Resume Next
Dim FileName As String, ExePath As String
Dim hProcSnap As Long, hModuleSnap As Long, _
lProc As Long
Dim uProcess As PROCESSENTRY32, _
uModule As MODULEENTRY32
Dim intLVW As Integer
hProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
lProc = Process32First(hProcSnap, uProcess)
Do While lProc
If uProcess.th32ProcessID <> 0 Then
hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, uProcess.th32ProcessID)
uModule.dwSize = Len(uModule)
Module32First hModuleSnap, uModule
If hModuleSnap > 0 Then
ExePath = StripNulls(uModule.szExePath)
FileName = GetFName(ExePath)
If FileTargetOne = FileName Then IdTargetOne = uProcess.th32ProcessID
If FileTargetTwo = FileName Then IdTargetTwo = uProcess.th32ProcessID
End If
End If
lProc = Process32Next(hProcSnap, uProcess)
Loop
Call CloseHandle(hProcSnap)
Call CloseHandle(lProc)
End Function
Function StripNulls(ByVal sStr As String) As String
StripNulls = Left$(sStr, lstrlen(sStr))
End Function
Public Function GetFName(fn) As String
Dim f%, n%
GetFName = fn
f% = InStr(fn, "\")
Do While f%
n% = f%
f% = InStr(n% + 1, fn, "\")
Loop
If n% > 0 Then GetFName = Mid$(fn, n% + 1)
End Function
Private Function Thread32Enum(ByRef Thread() As THREADENTRY32, _
ByVal lProcessID As Long) As Long
On Error Resume Next
ReDim Thread(0)
Dim THREADENTRY32 As THREADENTRY32
Dim hThreadSnap As Long
Dim lThread As Long
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, lProcessID)
THREADENTRY32.dwSize = Len(THREADENTRY32)
If Thread32First(hThreadSnap, THREADENTRY32) = False Then
Thread32Enum = -1
Exit Function
Else
ReDim Thread(lThread)
Thread(lThread) = THREADENTRY32
End If
Do
If Thread32Next(hThreadSnap, THREADENTRY32) = False Then
Exit Do
Else
lThread = lThread + 1
ReDim Preserve Thread(lThread)
Thread(lThread) = THREADENTRY32
End If
Loop
Thread32Enum = lThread
Call CloseHandle(hThreadSnap)
End Function
Public Function SetSuspendResumeThread(SuspendNow As Boolean) As Long
Dim Thread() As THREADENTRY32, hPID As Long, hThread As Long, i As Long
hPID = IdTargetOne
Thread32Enum Thread(), hPID
For i = 0 To UBound(Thread)
If Thread(i).th32OwnerProcessID = hPID Then
hThread = OpenThread(THREAD_SUSPEND_RESUME, False, (Thread(i).th32ThreadID))
If SuspendNow = True Then
SetSuspendResumeThread = SuspendThread(hThread)
Else
SetSuspendResumeThread = ResumeThread(hThread)
End If
End If
Next i
Call CloseHandle(hThread)
End Function
Public Function TerminateTargetOne() As Long
Dim hPID As Long
hPID = OpenProcess(PROCESS_ALL_ACCESS, 0, IdTargetOne)
TerminateTargetOne = TerminateProcess(hPID, 0)
Call CloseHandle(hPID)
End Function
Public Function TerminateTargetTwo() As Long
Dim hPID As Long
hPID = OpenProcess(PROCESS_ALL_ACCESS, 0, IdTargetTwo)
TerminateTargetTwo = TerminateProcess(hPID, 0)
Call CloseHandle(hPID)
End Function
selesai. tinggal di compile/make ke exe.
tambahan:
perhatikan kode command1 dan command2 pada listing code pada form1
Private Sub Command1_Click()
InjectExecute App.Path & "\example1.dll"
End Sub
silakan ganti example1.dll dengan nama dll yang diinginkan.
Jika Ingin Membuat Text Kedap Kedip:
-Buat 1 label = Beri nama Caption nya dengan Text yang ingin di buat Berkedap-kedip
-Buat 1 Timer = Intervalnya 200
Masukan Code Sebagai Berikut :
Private Sub Timer3_Timer()
If Label1.Visible = True Then
Label1.Visible = False
Else
Label1.Visible = True
End If
End Sub
If Label1.Visible = True Then
Label1.Visible = False
Else
Label1.Visible = True
End If
End Sub
NB : Cocokan Timer Dan Label Nya !!
Jika Ingin Membuat Text Berjalan(Dari Kanan Ke Kiri) :
-Buat 1 Label : Beri nama Captionnya dengan Text Yang ingin di Buat Berjalan.
-Buat 1 Timer : Beri Intervalnya 200
Masukan Code Berikut :
Private Sub timer4_Timer()
timer4.Interval = 200
Label1.Caption = Mid(Label1.Caption, 2, Len(Label1.Caption) - 1) + Mid(Label1.Caption, 1, 1)
d Sub
timer4.Interval = 200
Label1.Caption = Mid(Label1.Caption, 2, Len(Label1.Caption) - 1) + Mid(Label1.Caption, 1, 1)
d Sub
Ingin Membuat Exit Injector Menjadi Keren:
-Buat 1 Command Button : Captionnya Exit
Masukan Code Berikut Ke Form :
Private Sub Command1_Click()
ExitLayout
Unload Me
End Sub
Private Sub ExitLayout()
On Error Resume Next
Dim fHeight As Long
Dim fWidth As Long
For fHeight = Me.Height To 1000
Step -1
Me.Height = fHeight
'Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 3
Next fHeight
If Me.Height = 1000 Then
For fWidth = Me.Width To
1000 Step -2
Me.Width = fWidth
Next fWidth
End If
Me.Refresh
End Sub
ExitLayout
Unload Me
End Sub
Private Sub ExitLayout()
On Error Resume Next
Dim fHeight As Long
Dim fWidth As Long
For fHeight = Me.Height To 1000
Step -1
Me.Height = fHeight
'Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 3
Next fHeight
If Me.Height = 1000 Then
For fWidth = Me.Width To
1000 Step -2
Me.Width = fWidth
Next fWidth
End If
Me.Refresh
End Sub
Jika Ingin Membuat Command Button Unik :
Download File Ini: Disini
Setelah itu :
1.Klik kanan Di bagian toolbars Tool Atau CTRL+T.
2.Klik component (Kalau CTRL+T GAG PERLU)
3.klik browse , Arahkan ke File yang kamu download tdi .
4.Setelah itu Klik Ok .
5.Double Klik Tools Yang Baru muncul .
Jika Ingin Menambah kan Lagu :
-1 Timer :
Tekan CTRL+T , Check List Media Player .
Sisipkan Code Berikut Di bagian Form Load :
Private Sub Form_Load()
WindowsMediaPlayer1.URL = App.Path & "\sound.mp3"
End Sub
WindowsMediaPlayer1.URL = App.Path & "\sound.mp3"
End Sub
Dan Masukan Di Timer yang Anda Buat tadi :
Private Sub Timer4_Timer()
WindowsMediaPlayer1.Controls.play
End Sub
WindowsMediaPlayer1.Controls.play
End Sub
NB : CocoKan nama Lagu anda Di bagian sini :
App.Path & "\sound.mp3"
Ganti sound.mp3 dengan nama lagu anda.
Sekian dulu Tutornya gan. Capek juga Hahahaa
Thank's to : C3
Tag :
Tips,
Visual Basic
0 Komentar untuk "Cara membuat Injector dengan Visual Basic 6"