sasfvs

Untitled

Jul 4th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Net;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace NliWebSec
  10. {
  11.     class sourcecodeleak
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Console.WriteLine("Please enter the url of your target: ");
  16.             string url = Console.ReadLine(); //here I input my target
  17.             // reading the html response from the target in
  18.             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  19.             HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  20.             if (response.StatusCode == HttpStatusCode.OK) //here I see the response code (thanks to google i know)
  21.             {
  22.                 Stream receiveStream = response.GetResponseStream();
  23.                 StreamReader readStream = null;
  24.  
  25.                 if (response.CharacterSet == null)
  26.                 {
  27.                     readStream = new StreamReader(receiveStream);
  28.                 }
  29.                 else
  30.                 {
  31.                     readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
  32.                 }
  33.  
  34.                 string html = readStream.ReadToEnd(); //here I read the hole html from the first request and I put it in a string
  35.                
  36.                 response.Close(); //do not forget to close
  37.                 readStream.Close(); //do not forget to close
  38.             }
  39.             //searching for urls / paths in the html response of the target
  40.                 //at this point for sure I was checking google!
  41.             Console.ReadLine();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment