Results 1 to 3 of 3

Thread: Scan for html file

  1. #1
    Phrozeman
    Guest

    Red face Scan for html file

    i am creating an program that scans ip ranges for an specafic file, for example index.htm, index.php, or index.asp

    i found some help from examples from this forum, but now my next question:

    This code only checks each ip for index.htm, but how do i change it that it checks each ip for index.htm, index.php, and index.asp?
    Please help me out..

    The form contains textfields fromIp and toIp and an list1 for listing the ips with the servers who has one of the files...

    VB Code:
    1. Private Sub cmdStartScan_Click()
    2. Dim tmpInt As Integer
    3. Dim toIPend As Integer
    4. Dim startIP As Integer
    5. Dim bigNet As String
    6. Dim x As Integer
    7. Dim tmpStr As String
    8.  
    9. For x = Len(txtToIP) To 1 Step -1
    10.     If Mid$(txtToIP, x, 1) = "." Then
    11.        toIPend = Mid(txtToIP, x + 1)
    12.        Exit For
    13.     End If
    14. Next x
    15.  
    16. For x = Len(txtFromIP) To 1 Step -1
    17.     If Mid$(txtFromIP, x, 1) = "." Then
    18.        startIP = Mid(txtFromIP, x + 1)
    19.        Exit For
    20.     End If
    21. Next x
    22.  
    23. bigNet = Mid$(txtFromIP, 1, x)
    24.  
    25. For x = startIP To toIPend
    26.     lblOnIP.Caption = (bigNet & x)
    27.     OpenSocket (bigNet & x)
    28.     DoEvents
    29. Next x
    30.  
    31. For x = 0 To list1.ListCount - 1
    32.     tmpStr = Inet1.OpenURL("http://" & list1.List(x) & "index.htm")
    33.     If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
    34.         list1.AddItem list1.List(x)
    35.     End If
    36.     DoEvents
    37. Next x
    38.  
    39.  
    40. End Sub

  2. #2
    Phrozeman
    Guest
    Bump*

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    well it looks like this is the code where you check the file name right???
    VB Code:
    1. For x = 0 To list1.ListCount - 1
    2.     tmpStr = Inet1.OpenURL("http://" & list1.List(x) & "index.htm")
    3.     If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
    4.         list1.AddItem list1.List(x)
    5.     End If
    6.     DoEvents
    7. Next x

    so you should put a loop on the outside of this.. maybe fill a string array with all the filenames you want to find... then loop from 0 to the ubound of the array and instead of
    VB Code:
    1. If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
    you could use

    If InStr(1, tmpStr, FileArray(loopctr), vbTextCompare) Then
    VB Code:
    1. something like that should work??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width