maidinhdan > 13-11-20, 09:16 PM
Function PingIP()
Dim oShell, oExec As Variant
Dim strText, strCmd, ComputerName As String
ComputerName = "MAIDINHDAN" 'Ten may tinh/IP may tinh: "192.168.1.11"
strText = ""
strCmd = "ping -n 3 -w 1000 " & ComputerName
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
Debug.Print strText
If InStr(strText, "Reply") > 0 Then
Debug.Print "oK"
Exit Do
Else
Debug.Print "Khong tim thay"
End If
Loop
End Function
Function HienThiTenMayDangOnline()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "Net view" ''HienThiTenMayDangOnline
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
If Left(strText, 2) = "\\" Then
Debug.Print strText
End If
Loop
End Function
Function HienThiIPDangOnline()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "arp -a" ''HienThiIPDangOnline
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
If Left(strText, 14) = "Interface: 192" Then Debug.Print strText
If Left(strText, 6) = " 192." And Right(strText, 10) = "dynamic " Then
Debug.Print strText
End If
Debug.Print strText
Loop
End Function
Function ThongtinMayTinh()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "SystemInfo" '
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
Debug.Print strText
Loop
End Function
Function DichvuDangchay()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "tasklist" '
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
Debug.Print strText
Loop
End Function
Function TatDichvuDangchay(TenDichVuCanTat As String)
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "taskkill /f /im " & TenDichVuCanTat '
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
Debug.Print strText
Loop
End Function
maidinhdan > 14-11-20, 11:57 PM
' --------------------------------------------------------------------------------------------------------
' Thuoc Modules/Class: Hoc Lenh CMD
' Ten ham/thu tuc : cmdNetstat
' Tao tren may PC : HENDANWIN10PRO
' Author/ Tac gia : maidinhdan@gmail.com
' Ngay tao : 03/05/2020 3:37:39 PM
' Parameters/Tham so :
'– Tham so /a: Hien thi tat ca cac ket noi va cac cong dang lang nghe (listening)
'– Tham so /e: hien thi cac thong tin thong ke Ethernet
'– Tham so /n: Hien thi cac dia chi va cac so cong ket noi…
' Cu phap/ Purpose : Netstat [/a][/e][/n]
' Pham vi ap dung : Lenh Netstat cho phep ta liet ke tat ca cac ket noi ra va vao may tinh cua chung ta.
' --------------------------------------------------------------------------------------------------------
Function cmdNetstat()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strCmd = "Netstat /a" ' Liet ke thong tin Ip
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = strText & oExec.StdOut.ReadLine() & vbCrLf
Loop
Debug.Print strText
End Function
' --------------------------------------------------------------------------------------------------------
' Thuoc Modules/Class: Hoc Lenh CMD
' Ten ham/thu tuc : cmdIPconfig
' Tao tren may PC : HENDANWIN10PRO
' Author/ Tac gia : maidinhdan@gmail.com
' Ngay tao : 03/05/2020 3:39:49 PM
' Parameters/Tham so :
' Cu phap/ Purpose :
' Pham vi ap dung : Lenh nay se cho phep hien thi cau hinh IP cua may tinh ban dang su dung, nhu ten host, dia chi IP, mat na mang…
' --------------------------------------------------------------------------------------------------------
Function cmdIPconfig()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strCmd = "ipconfig /all" ' Liet ke thong tin Ip
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = strText & oExec.StdOut.ReadLine() & vbCrLf
Loop
Debug.Print strText
End Function
Function TatMay()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "Shutdown -s -t [3600]"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
'Do While Not oExec.StdOut.AtEndOfStream
' strText = oExec.StdOut.ReadLine()
' Debug.Print strText
'Loop
End Function
Function KhoiDonglaiMay()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "Shutdown -r -t [3600]"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
'Do While Not oExec.StdOut.AtEndOfStream
' strText = oExec.StdOut.ReadLine()
' Debug.Print strText
'Loop
End Function
Public Sub TatMayKhacTrongMangLan(TenMayCanTat, TenTaiKhoanUser, MatKhau)
Dim Connection, WQL, SystemClass, System
Dim Locator
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set Connection = Locator.ConnectServer(TenMayCanTat, "root\cimv2", TenTaiKhoanUser, MatKhau)
WQL = "Select Name From Win32_OperatingSystem"
Set SystemClass = Connection.ExecQuery(WQL)
For Each System In SystemClass
System.Win32ShutDown (1)
Next
End Sub
' --------------------------------------------------------------------------------------------------------
' Thuoc Modules/Class: Hoc Lenh CMD
' Ten ham/thu tuc : cmdTracert
' Tao tren may PC : HENDANWIN10PRO
' Author/ Tac gia : maidinhdan@gmail.com
' Ngay tao : 03/05/2020 3:42:36 PM
' Parameters/Tham so :
' Cu phap/ Purpose : tracert ip/host
' Pham vi ap dung : 'Lenh nay se cho phep ban “nhin thay” duong di cua cac goi tin tu may tinh cua ban den may tinh dich,
' xem goi tin cua ban vong qua cac server nao, cac router nao… Qua hay neu ban muon tham do mot server nao do
' --------------------------------------------------------------------------------------------------------
Function cmdTracert()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strCmd = "tracert 192.168.1.8"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = strText & oExec.StdOut.ReadLine() & vbCrLf
Loop
Debug.Print strText
End Function
maidinhdan > 16-11-20, 10:22 PM
Function LietKeWifi()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "NETSH WLAN SHOW PROFILE"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = Trim(oExec.StdOut.ReadLine())
If Left(strText, 16) = "All User Profile" Then
strText = Trim(Mid(Trim(Right(strText, Len(strText) - 16)), 2))
Debug.Print strText
End If
Loop
End Function
Function LayMatKhauWifi(TenMangWifi As String)
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "netsh wlan show profile name=" & TenMangWifi & " key=clear"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = Trim(oExec.StdOut.ReadLine())
If Left(strText, 11) = "Key Content" Then
strText = Trim(Mid(Trim(Right(strText, Len(strText) - 11)), 2))
Debug.Print strText
End If
Loop
End Function
KheNgot > 17-11-20, 12:47 PM
(16-11-20, 10:22 PM)maidinhdan Đã viết: 13. Liệt kê tên tất cả Wifi từng kết nốiAnh cho em hỏi chút về lấy mật khẩu Wiffi ạ: Em tạo 1 form và tạo 1 nút trên đó rồi em paste code của anh vào không thực hiện được. Không biết là lỗi gì anh nhỉ? Mong anh chỉ giúp chỗ sai của em ạ:
Mã PHP:Function LietKeWifi()
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "NETSH WLAN SHOW PROFILE"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = Trim(oExec.StdOut.ReadLine())
If Left(strText, 16) = "All User Profile" Then
strText = Trim(Mid(Trim(Right(strText, Len(strText) - 16)), 2))
Debug.Print strText
End If
Loop
End Function
14. Lấy Mật khẩu Wifi
Mã PHP:Function LayMatKhauWifi(TenMangWifi As String)
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "netsh wlan show profile name=" & TenMangWifi & " key=clear"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = Trim(oExec.StdOut.ReadLine())
If Left(strText, 11) = "Key Content" Then
strText = Trim(Mid(Trim(Right(strText, Len(strText) - 11)), 2))
Debug.Print strText
End If
Loop
End Function
Option Compare Database
Option Explicit
Private Sub cbLayPassWiffi_Click()
LayMatKhauWifi ("KhanhMai")
End Sub
Function LayMatKhauWifi(TenMangWifi As String)
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "netsh wlan show profile name=" & TenMangWifi & " key=clear"
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = Trim(oExec.StdOut.ReadLine())
If Left(strText, 11) = "Key Content" Then
strText = Trim(Mid(Trim(Right(strText, Len(strText) - 11)), 2))
Debug.Print strText
End If
Loop
End Function
ongke0711 > 17-11-20, 01:23 PM
(17-11-20, 12:47 PM)KheNgot Đã viết: Anh cho em hỏi chút về lấy mật khẩu Wiffi ạ: Em tạo 1 form và tạo 1 nút trên đó rồi em paste code của anh vào không thực hiện được. Không biết là lỗi gì anh nhỉ? Mong anh chỉ giúp chỗ sai của em ạ:
[php]Option Compare Database
Option Explicit
Private Sub cbLayPassWiffi_Click()
LayMatKhauWifi ("KhanhMai")
End Sub
thuyyeu99 > 17-11-20, 01:36 PM
maidinhdan > 18-11-20, 01:38 AM
(17-11-20, 12:47 PM)KheNgot Đã viết: Anh cho em hỏi chút về lấy mật khẩu Wiffi ạ: Em tạo 1 form và tạo 1 nút trên đó rồi em paste code của anh vào không thực hiện được. Không biết là lỗi gì anh nhỉ? Mong anh chỉ giúp chỗ sai của em ạ:
Debug.Print strText
Msgbox(strText)