Ask a questionAsk a question
 

QuestionC# help to login (security problem)

  • Wednesday, November 04, 2009 10:35 AMSjums Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have this code snippet, and i have used it before to login to sites, but this website i can't get in to, could i get some help please?

     CookieContainer cookieJar = new
    
    
    CookieContainer();
    private
    void
    button1_Click(object
    sender, EventArgs e)
    {

    byte
    [] POST_login = Encoding.ASCII.GetBytes("index.php?action=login&user=Sjums07&pwd=myPass&rem=on&submit=Login&soLogin=MGM4Y2U1NTE2MzA1NWM0ZGE1MGE4MWUwYTI3MzQ2OGM4MA=="
    );
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://hacker-project.com/index.php"
    );
    req.Method = "POST"
    ;
    req.ContentType = "application/x-www-form-urlencoded"
    ;
    req.ContentLength = POST_login.Length;
    req.CookieContainer = cookieJar;
    Stream postdata = req.GetRequestStream();
    postdata.Write(POST_login, 0, POST_login.Length);
    postdata.Close();
    HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
    foreach
    (Cookie cook in
    resp.Cookies)
    {
    cookieJar.Add(new
    Cookie(cook.Name, cook.Value, cook.Path, cook.Domain));

    That's what i've made so far.. and hacker-project is a game ;) nothing illegal :p