|
-
May 6th, 2002, 04:41 AM
#1
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:
Private Sub cmdStartScan_Click()
Dim tmpInt As Integer
Dim toIPend As Integer
Dim startIP As Integer
Dim bigNet As String
Dim x As Integer
Dim tmpStr As String
For x = Len(txtToIP) To 1 Step -1
If Mid$(txtToIP, x, 1) = "." Then
toIPend = Mid(txtToIP, x + 1)
Exit For
End If
Next x
For x = Len(txtFromIP) To 1 Step -1
If Mid$(txtFromIP, x, 1) = "." Then
startIP = Mid(txtFromIP, x + 1)
Exit For
End If
Next x
bigNet = Mid$(txtFromIP, 1, x)
For x = startIP To toIPend
lblOnIP.Caption = (bigNet & x)
OpenSocket (bigNet & x)
DoEvents
Next x
For x = 0 To list1.ListCount - 1
tmpStr = Inet1.OpenURL("http://" & list1.List(x) & "index.htm")
If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
list1.AddItem list1.List(x)
End If
DoEvents
Next x
End Sub
-
May 6th, 2002, 11:10 AM
#2
Bump*
-
May 6th, 2002, 12:16 PM
#3
well it looks like this is the code where you check the file name right???
VB Code:
For x = 0 To list1.ListCount - 1
tmpStr = Inet1.OpenURL("http://" & list1.List(x) & "index.htm")
If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
list1.AddItem list1.List(x)
End If
DoEvents
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:
If InStr(1, tmpStr, "index.htm", vbTextCompare) Then
you could use
If InStr(1, tmpStr, FileArray(loopctr), vbTextCompare) Then
VB Code:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|