sasfvs icon

Untitled

sasfvs | PRO | 07/04/17 11:09:36 AM UTC | 0 ⭐ | 267 👁️ | Never ⏰ | []
C# |

1.64 KB

|

None

|

0 👍

/

0 👎

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
 
namespace NliWebSec
{
    class sourcecodeleak
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the url of your target: ");
            string url = Console.ReadLine(); //here I input my target
            // reading the html response from the target in
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK) //here I see the response code (thanks to google i know)
            {
                Stream receiveStream = response.GetResponseStream();
                StreamReader readStream = null;
 
                if (response.CharacterSet == null)
                {
                    readStream = new StreamReader(receiveStream);
                }
                else
                {
                    readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                }
 
                string html = readStream.ReadToEnd(); //here I read the hole html from the first request and I put it in a string
                
                response.Close(); //do not forget to close
                readStream.Close(); //do not forget to close
            }
            //searching for urls / paths in the html response of the target 
                //at this point for sure I was checking google!
            Console.ReadLine();
        }
    }
}

Comments