<%
'============ ASP Port Scanner by lake2 ===================
'http://lake2.0x54.org
'Version: 0.1
'For SpringBoard
'==========================================================
Server.ScriptTimeout = 7776000
PortList = "21,23,25,80,110,135,139,445,1433"
%>
<style type="text/css">
body,td,th {color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;}
body {background-color: #ffffff;font-size:14px; }
a:link {color: #0000FF;text-decoration: none;}
a:visited {text-decoration: none;color: #0000FF;}
a:hover {text-decoration: none;color: #FF0000;}
a:active {text-decoration: none;color: #FF0000;}
.buttom {color: #FFFFFF; border: 1px solid #084B8E; background-color: #719BC5}
.TextBox {border: 1px solid #084B8E}
.styleRed {color: #FF0000}
</style>
<title>ASP TCP Port Scanner for SpringBoard</title>
<%
If request.Form("scan") <> "" Then
timer1 = timer
response.Write("This is Report: <br><br>")
tmp = Split(request.Form("port"),",")
ip = Split(request.Form("ip"),",")
For hu = 0 to Ubound(ip)
If InStr(ip(hu),"-") = 0 Then
For i = 0 To Ubound(tmp)
If Isnumeric(tmp(i)) Then
Call Scan(ip(hu), tmp(i))
Else
seekx = InStr(tmp(i), "-")
If seekx > 0 Then
startN = Left(tmp(i), seekx - 1 )
endN = Right(tmp(i), Len(tmp(i)) - seekx )
If Isnumeric(startN) and Isnumeric(endN) Then
For j = startN To endN
Call Scan(ip(hu), j)
Next
Else
Response.Write(startN & " or " & endN & " is not number<br>")
End If
Else
Response.Write(tmp(i) & " is not number<br>")
End If
End If
Next
Else
ipStart = Mid(ip(hu),1,InStrRev(ip(hu),"."))
For xxx = Mid(ip(hu),InStrRev(ip(hu),".")+1,1) to Mid(ip(hu),InStr(ip(hu),"-")+1,Len(ip(hu))-InStr(ip(hu),"-"))
For i = 0 To Ubound(tmp)
If Isnumeric(tmp(i)) Then
Call Scan(ipStart & xxx, tmp(i))
Else
seekx = InStr(tmp(i), "-")
If seekx > 0 Then
startN = Left(tmp(i), seekx - 1 )
endN = Right(tmp(i), Len(tmp(i)) - seekx )
If Isnumeric(startN) and Isnumeric(endN) Then
For j = startN To endN
Call Scan(ipStart & xxx,j)
Next
Else
Response.Write(startN & " or " & endN & " is not number<br>")
End If
Else
Response.Write(tmp(i) & " is not number<br>")
End If
End If
Next
Next
End If
Next
timer2 = timer
thetime=cstr(int(timer2-timer1))
response.write "<hr>Process in "&thetime&" s"
Else
%>
<p>仅用于测试! </p>
<p>你可以使用本页面进行端口扫描~~</p>
<form name="form1" method="post" action="" onSubmit="form1.submit.disabled=true;">
<p>需扫描的IP:
<input name="ip" type="text" class="TextBox" id="ip" value="<%= Request.ServerVariables("HTTP_HOST") %>" size="60">
*Example: 10.0.0.1-2 = 10.0.0.1,10.0.0.2<br>
需扫描的端口:
<input name="port" type="text" class="TextBox" size="60" value="<%=PortList%>">
*Example: 1-5 = 1,2,3,4,5<br>
<br>
<input name="submit" type="submit" class="buttom" value=" Scan ">
<input name="scan" type="hidden" id="scan" value="111">
</p>
</form>
<%
End If
Sub Scan(targetip, portNum)
On Error Resume Next
set conn = Server.CreateObject("ADODB.connection")
connstr="Provider=SQLOLEDB.1;Data Source=" & targetip &","& portNum &";User ID=lake2;Password=;"
conn.ConnectionTimeout = 1
conn.open connstr
If Err Then
If Err.number = -2147217843 or Err.number = -2147467259 Then
If InStr(Err.description, "(Connect()).") > 0 Then
Response.Write(targetip & ":" & portNum & ".........Close<br>")
Else
Response.Write(targetip & ":" & portNum & ".........<font color=red>Open</font><br>")
End If
End If
End If
End Sub
%>