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

    Joined:
    Sep 2, 2010
    Messages:
    39
    Likes Received:
    7
    Trophy Points:
    0
    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
    ----------------------------------------------------
    Code:
    Const ForReading = 1
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("Your File Name Here.txt", ForReading)
    
    strSearchString = objFile.ReadAll
    
    objFile.Close
    
    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
        Next
    End If
     

Share This Page