asp实现端口扫描源码

今天碰到一个站很恶心,小马传上了大马楞是写不上,后来想了个办法只能把一个大马给拆解了。这是一个扫描端口的。以后碰到的时候直接就好用了。


<style type="text/css">
body,td,th {color: #0000FF;font-family: Verdana, Arial, Helvetica, sans-serif;}
ASP实现TCP端口扫描的方法
ASP实现TCP端口扫描的方法
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>

 

<%

ScanPort()

 


Sub RRS(str)
response.write(str)
End Sub

 

 

sub ScanPort()
Server.ScriptTimeout=7776000
if request.Form("port")="" then
PortList="21,23,25,80,110,135,139,445,1433,3389,43958"
else
PortList=request.Form("port")
end if
if request.Form("ip")="" then
IP="127.0.0.1"
else
IP=request.Form("ip")
end if
RRS("<br><p>端口扫描器(如果扫描多个端口,速度比较慢,个人推荐使用CMD)</p><form name='form1' method='post' action='' onSubmit='form1.submit.disabled=true;'><p>Scan IP:&nbsp;<input name='ip' type='text' class='TextBox' id='ip' value='"&IP&"' size='60'><br>Port List:<input name='port' type='text' class='TextBox' size='60' value='"&PortList&"'><br><br><input name='submit' type='submit' class='buttom' value=' scan '><input name='scan' type='hidden' id='scan' value='111'></p></form>")

If request.Form("scan") <> "" Then
timer1=timer
RRS("<b>扫描报告:</b><br><hr>")
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
RRS(startN&" or "&endN&" is not number<br>")
End If
Else
RRS(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
RRS(startN&" or "&endN&" is not number<br>")
End If
Else
RRS(tmp(i)&" is not number<br>")
End If
End If
Next
Next
End If
Next
timer2=timer
thetime=cstr(int(timer2-timer1))
RRS"<hr>Process in "&thetime&" s"
END IF
end sub

 

 

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
RRS(targetip&":"&portNum&".........关闭<br>")
Else
RRS(targetip&":"&portNum&".........<font color=red>开放</font><br>")
End If
End If
End If

End Sub
%>




[本日志由 admin 于 2010-05-31 10:44 AM 编辑]

有什么问题可以加群,100852896
点击这里加入此群 在线提问
文章来自: 本站原创
Tags: 代码 asp 扫描 端口 源码
评论: 0 | 查看次数: 7597
博主QQ: 友情链接请找我
QQ群: 灰色档案
返回顶部 关闭