| View previous topic :: View next topic |
| Author |
Message |
iostream How do I cheat?
Reputation: 0
Joined: 06 Apr 2009 Posts: 9 Location: georgia
|
Posted: Sun Jul 12, 2009 4:26 am Post subject: [c#] website interaction |
|
|
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 |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Sun Jul 12, 2009 5:16 am Post subject: |
|
|
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 |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Jul 15, 2009 12:04 am Post subject: |
|
|
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 |
|
 |
LolSalad Grandmaster Cheater
Reputation: 1
Joined: 26 Aug 2007 Posts: 988 Location: Australia
|
Posted: Wed Jul 15, 2009 1:59 am Post subject: |
|
|
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 |
|
 |
|