1
I have the following challenge:
Log in to a website with the following data:
POST */kodoreq.php HTTP/1.1
Host: eofclub.in
Cookie: logado=sim
User-Agent: Lynx/3.15
usuario=desafio&senha=987654321&submit=sim
I’ve tried it in many ways and I can’t
class Program
{
static void Main(string[] args)
{
string usuario = "desafio";
string senha = "987654321";
string submit = "sim";
System.Net.ServicePointManager.Expect100Continue = false;
Uri url = new Uri("http://eofclub.in/desafio/kodo/35p42s5436po63nnsr9o20rssp6647q3/kodoreq.php");
UTF8Encoding encoding = new UTF8Encoding();
string postData = "{ \"usuario\" : \"" + usuario + "\", \"senha\": \"" + senha + "\", \"submit\": \"" + submit + "\"}";
byte[] data = Encoding.GetEncoding("UTF-8").GetBytes(postData);
CookieContainer cookieContainer = new CookieContainer();
Cookie usuarioCookie = new Cookie("logado", "sim", "/") { Domain = url.Host };
cookieContainer.Add(usuarioCookie);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.CookieContainer = cookieContainer;
request.Method = "POST";
request.ContentType = "application/json";
request.UserAgent = "Lynx/3.15";
request.ContentLength = data.Length;
Stream stream = request.GetRequestStream();
stream.Write(data, 0, data.Length);
stream.Close();
WebResponse response = request.GetResponse();
stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
Console.WriteLine(sr.ReadToEnd());
sr.Close();
stream.Close();
Console.ReadKey();
}
But you can’t because specifically?
– Jéf Bueno
Btw, do not use code snnipets for C#code. They are only for client-side code.
– Jéf Bueno
It always displays the error "invalid".
– Rickafds
The idea of the challenge is to get to the result... here is the answer, you will find out how to get it or follow from that point... proximo lvl .. /o9ps9p2ro0n89r3n4o958rr7o7o01r9r/
– Leandro Angelo
Thanks, but anyway I’ll keep trying, thanks for the help @Leandroangelo
– Rickafds