달력

1

« 2025/1 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2009. 6. 22. 16:28

원격 포트 접속 확인 VBS (Script) Etc.2009. 6. 22. 16:28

strMessage = ""

set shellobj=WScript.CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (".\RUNNETSTAT.BAT", 8, True)

objTextFile.WriteLine("netstat -an | findstr " & Chr(34) & "168.126.63.1:53" & Chr(34) & " | findstr " & Chr(34) & "EST" & Chr(34))
objTextFile.Close
set objTextFile = nothing

set execObj=shellobj.Exec(".\RUNNETSTAT.BAT")
OutData=execObj.StdOut.ReadAll()
val=execObj.StdOut.Line - 3

Set aFile = objFSO.GetFile(".\RUNNETSTAT.BAT")
aFile.Delete
Set aFile = nothing

If val = 0 Then
strMsg = MsgBox("Port Error!!",16,"Caution")
End If

set OutData = nothing
set execObj = nothing
set shellobj = nothing

:
Posted by 커널64