Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Net;
- using System.Text;
- using System.IO;
- namespace ConsoleApp1
- {
- class Program
- {
- public static void Main(string[] args)
- {
- var cookieContainer = new CookieContainer();
- var request = (HttpWebRequest)HttpWebRequest.Create("https://filelist.ro/takelogin.php?");
- request.CookieContainer = cookieContainer;
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36";
- request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
- var data = string.Format("username={0}&password={1}", "lorand98", "kocsis26021998");
- var bytes = Encoding.UTF8.GetBytes(data);
- request.ContentLength = bytes.Length;
- using (var dataStream = request.GetRequestStream())
- {
- dataStream.Write(bytes, 0, bytes.Length);
- dataStream.Close();
- }
- using (var response = request.GetResponse())
- {
- using (var sr = new StreamReader(response.GetResponseStream()))
- {
- File.WriteAllText(@"C:\test\login.txt", sr.ReadToEnd());
- }
- }
- request = (HttpWebRequest)HttpWebRequest.Create("https://filelist.ro/browse.php");
- request.CookieContainer = cookieContainer;
- request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36";
- request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
- using (var response = request.GetResponse())
- {
- using (var sr = new StreamReader(response.GetResponseStream()))
- {
- File.WriteAllText(@"C:\test\browser.txt", sr.ReadToEnd());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement