First of all, not sythe, second, my function.
so... im guessing i need a new security token each time, i want to do that in the same function, but i really honestly dont know how to parse something out in c# i need to parse
out of the javascript near the top of the page of a vBulletin forum.
Code:
private void HKPV(string URL, string PDATA, string GDATA, string REFERRER)
{
try
{
if (GDATA != "" && PDATA == "")
{
URL = URL + GDATA;
}
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
if (PDATA != "" && GDATA == "")
{
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] buffer = Encoding.ASCII.GetBytes(PDATA);
req.ContentLength = buffer.Length;
Stream PostData = req.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
}
// req.Proxy = PROXY;
if (REFERRER != "")
{
req.Referer = REFERRER;
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
// MessageBox.Show(resp.StatusCode + " : " + req.Referer);
Stream dataStream = resp.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
String responseFromServer = reader.ReadToEnd();
html = responseFromServer;
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex.Message));
}
}
private void button1_Click(object sender, EventArgs e)
{
// Disable some controls
button1.Enabled = false;
textBox1.Enabled = false;
textBox2.Enabled = false;
checkBox1.Enabled = false;
// Disabled all controls fine
// Login initiate
try
{ // Try to log in, just in case an error happens we have a solution to it
// Attempt to login with the given details
// Encrypt the login passwords.
String hashpass = HashString(textBox2.Text);
String hashputf = Encoding.UTF8.GetString(
Encoding.Convert(
Encoding.UTF8, Encoding.UTF8,
Encoding.UTF8.GetBytes(hashpass)));
// End encryption
HKPV("http://www.someforum.net/login.php?do=login", "?vb_login_username=" + textBox1.Text + "&vb_login_password=" + textBox2.Text + "&securitytoken=guest&do=login&vb_login_md5password=" + hashpass + "&vb_login_md5password_utf=" + hashputf, "", "http://www.someforum.net/index.php");
textBox3.Text = html;
// End attempt, success if you have made it this far
} // End of trying to log in, or an error arose
catch (Exception ex)
{ // Error reporting
// If an error occurs we don't want the program to quit, we will just assume that the site is now offline
} // End error reporting
finally
{ // After we do all that, do the stuff at the end
button1.Enabled = true;
textBox1.Enabled = true;
textBox2.Enabled = true;
checkBox1.Enabled = true;
} // Finished cleanup
// Login close
}
so... im guessing i need a new security token each time, i want to do that in the same function, but i really honestly dont know how to parse something out in c# i need to parse
Code:
SESSIONURL = "?s=34095383945340&";
out of the javascript near the top of the page of a vBulletin forum.


