-
May 26th, 2009, 06:31 PM
#1
[HELP]WinINet login to facebook.com!
I need to login to facebook, but my code doesnt work:
#include <windows.h>
#include <wininet.h>
#include <string>
#include <iostream.h>
using namespace std;
void main()
{
string m_strURL;
HINTERNET hSession, hDownload, hRequest;
hSession = InternetOpen("MFFS", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
hDownload = InternetConnect(hSession, "login.facebook.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
hRequest = HttpOpenRequest(hDownload, "POST", "/login.php?login_attempt=1", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
HttpSendRequest(hRequest, NULL, 0, "email=johnjohnjohn@hotmail.com&pass=123123123", 401);
if ( hRequest )
{
CHAR buffer[1024];
DWORD dwRead;
while ( InternetReadFile( hRequest, buffer, 1023, &dwRead ) )
{
if ( dwRead == 0 )
break;
buffer[dwRead] = 0;
m_strURL += buffer;
cout << buffer << endl;
}
}
}
Any idea whats wrong?
Thanks!
-
May 27th, 2009, 05:53 PM
#2
Re: [HELP]WinINet login to facebook.com!
Websites these days don't simply rely on the form fields data, there may be a host of other security measures implemented against people like you The form itself may have hidden data fields, it may use cookies and reloading of the page for repeated authentication. I'm sure, facebook uses all that as well.
-
May 28th, 2009, 08:09 AM
#3
Re: [HELP]WinINet login to facebook.com!
Facebook doesn't have a lot of security in the way you login... I made a script in php with curl to login to facebook, it was very easy... But with WinINet idk what is the problem:
I dont get a msg like:
Cookies Required
Cookies are not enabled on your browser. Please adjust this in your security preferences before continuing.
or
You are using an incompatible web browser.
or
Incorrect Email/Password Combination
So i fink I'm not even sending POST data....
I used tamper data to see what is necessary to login to facebook and you only need the pass and the email (there are 4 more hidden fields like char_set passholder etc...)
But i still cant find where is the problem :*(
-
May 28th, 2009, 09:39 AM
#4
Re: [HELP]WinINet login to facebook.com!
Here is the new code:
#include <windows.h>
#include <wininet.h>
#include <string>
#include <iostream.h>
using namespace std;
void main()
{
static char hdrs[] = ("Content-Type: application/x-www-form-urlencoded");
static char frmdata[] = ("email=qiller@hotmail.com&pass=qwertyasdf");
static LPSTR accept = ("*/*", NULL);
string m_strURL, url;
HINTERNET hSession, hDownload, hRequest;
hSession = InternetOpen("MFFS", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
hDownload = InternetConnect(hSession, "login.facebook.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
hRequest = HttpOpenRequest(hDownload, "POST", "/login.php?login_attempt=1", "HTTP/1.1", NULL, NULL, INTERNET_FLAG_SECURE, 0);
HttpSendRequest(hRequest, hdrs, strlen(hdrs), frmdata, strlen(frmdata));
if ( hRequest )
{
CHAR buffer[1024];
DWORD dwRead;
while ( InternetReadFile( hRequest, buffer, 1023, &dwRead ) )
{
if ( dwRead == 0 )
break;
buffer[dwRead] = 0;
m_strURL += buffer;
cout << buffer << endl;
}
}
}
Now the problem are cookies :P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|