Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c#] website interaction

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iostream
How do I cheat?
Reputation: 0

Joined: 06 Apr 2009
Posts: 9
Location: georgia

PostPosted: Sun Jul 12, 2009 4:26 am    Post subject: [c#] website interaction Reply with quote

I'm wanting to create a windows form that allows website interaction such as storing a username and password to login to a web page. I dont know if im just not google'ing for the right things or what, the only thing I can find is hooking the page property where username/password is stored with something like

Code:
HtmlElement elem = webBrowser1.Document.GetElementById("usrname");


am I on the right track? any suggestions are greatly appreciated :S

also, if c# is not ideal for this i'd like to know what is so i can learn more about it

cheers

_________________
Don't wait up.
Back to top
View user's profile Send private message MSN Messenger
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Sun Jul 12, 2009 5:16 am    Post subject: Reply with quote

that's close. a guide i read a little while back told me to use an axwebbrowser, that might've been for a different reason i can't completely remember why. check this source and try to find what you need from it, i've got to go. take note of the resources if you use an axwebbrowser control.

http://rapidshare.com/files/254898233/Chess.rar

_________________
Back to top
View user's profile Send private message MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Jul 15, 2009 12:04 am    Post subject: Reply with quote

Use the Firefox plug in "Firebug" and find the POST ids. Than you can just POST them using the navigate function. I made this for a friend, you can just adapt it to suit your needs (note, this is a small chunk of code from a class, so it won't look too great or make much sense in the big picture).

Code:
WebBrowser wbBrowser = new WebBrowser();

/// <summary>
/// Login a user to the Battlefield Heroes website.
/// </summary>
/// <param name="Email">The user's email address.</param>
/// <param name="Password">The user's password.</param>
public static void Login(string Email, string Password)
{
    String sPostData = "mail=" + Email + "&password=" + Password;
    byte[] bPostData = System.Text.Encoding.UTF8.GetBytes(sPostData);
    // trimmed useless stuff out here...
    wbBrowser.DocumentCompleted += Browser_LoginEvent;
    wbBrowser.Navigate("https://www.battlefieldheroes.com/user/login?destination=http://www.battlefieldheroes.com/", "", bPostData, "Content-Type: application/x-www-form-urlencoded\r\n");
}

private static void Browser_LoginEvent(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    wbBrowser.DocumentCompleted -= Browser_LoginEvent;

    if (wbBrowser.Url.AbsoluteUri == "http://www.battlefieldheroes.com/")
    {
        int magma_index = wbBrowser.Document.Cookie.IndexOf("magma=") + "magma=".Length;
        int magma_end = wbBrowser.Document.Cookie.IndexOf(";", magma_index);
        sMagma = wbBrowser.Document.Cookie.Substring(magma_index, magma_end - magma_index);
        bLoggedIn = true;
    }
    else
    {
        bLoggedIn = false;
    }

    // More trimmed stuff here...
}
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Wed Jul 15, 2009 1:59 am    Post subject: Reply with quote

I prefer to use the Firefox extension 'Tamper Data' and view some example POST requests. That way I easily get the POST IDs and I also get an example of how the sent information is formatted.
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites