1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Vbscript to grab ip addresses from a text file

Discussion in 'Web Design, HTML And CSS Forums' started by Cleptography, Sep 6, 2010.

  1. Cleptography

    Cleptography New Member

    This one here is a vbscript that grabs all the ips from a text file. Modifiy the file name section to point to the file you are using. I use this one mostly for parsing wireshark output.

    Vbscript to grab ip addresses from a text file
    Const ForReading = 1
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("Your File Name Here.txt", ForReading)
    strSearchString = objFile.ReadAll
    Set objRegEx = CreateObject("VBScript.RegExp")
    objRegEx.Global = True   
    objRegEx.Pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
    Set colMatches = objRegEx.Execute(strSearchString)  
    If colMatches.Count > 0 Then
        For Each strMatch in colMatches   
           Wscript.Echo strMatch.Value
    End If

Share This Page