Jump to content

Curl + MBNET


xploit
 Share

Recommended Posts

Boas pessoal estou a tentar aceder ao MBNET via cURL mas estou com sérias dificuldades a atinar com isto.

Portanto o código:

include_once("simple_html_dom.php");

$USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/10.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2";

$cSession = curl_init();
        
curl_setopt($cSession, CURLOPT_URL,"https://www.mbnet.pt");
curl_setopt($cSession, CURLOPT_USERAGENT, $USER_AGENT);
curl_setopt($cSession, CURLOPT_HEADER, 0);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cSession, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($cSession, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($cSession, CURLOPT_COOKIEFILE, 'cookie.txt');
$cSessionResult = curl_exec($cSession);


$page_html=str_get_html($cSessionResult);
$input_post_value = $page_html->find("input[name='TRN']",0)->value;

curl_setopt($cSession, CURLOPT_URL,"https://www.mbnet.pt/servlet/pvtn");
curl_setopt($cSession, CURLOPT_USERAGENT, $USER_AGENT);
curl_setopt($cSession, CURLOPT_HEADER, 0);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cSession, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cSession, CURLOPT_POST, 1);
curl_setopt($cSession, CURLOPT_POSTFIELDS, "TRN=".$input_post_value."");
curl_setopt($cSession, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($cSession, CURLOPT_COOKIEFILE, 'cookie.txt');

$cSessionResult = curl_exec($cSession);

$page_html_2=str_get_html($cSessionResult);
$input_post_SESID = $page_html_2->find("input[name='SESID']",0)->value;


$NewPostVars="TRN=".$input_post_value."&A037=".time()."000&C010=XXXXXXX&C011=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&SESID=".$input_post_SESID;

curl_setopt($cSession, CURLOPT_URL,"https://www.mbnet.pt/servlet/pvtn");
curl_setopt($cSession, CURLOPT_USERAGENT, $USER_AGENT);
curl_setopt($cSession, CURLOPT_HEADER, 0);
curl_setopt($cSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cSession, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cSession, CURLOPT_POST, 1);
curl_setopt($cSession, CURLOPT_POSTFIELDS, $NewPostVars);
curl_setopt($cSession, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($cSession, CURLOPT_COOKIEFILE, 'cookie.txt');

$cSessionResult_2 = curl_exec($cSession);	 

echo $cSessionResult_2;

curl_close($cSession);

No primeiro POST tudo corre bem, o MBNET recebe o post TRN e regista o inicio de uma nova sessão, quando vou a enviar o segundo post, nem sequer aparece uma mensagem de erro do MBNET a dizer login inválido por exemplo, simplesmente aparece a página https://www.mbnet.pt/servlet/pvtn e como se nada tivesse sido POSTado, o segundo posto envia estas vars:

"TRN=xxxxxxxxx&

A037=xxxxxxxxx&

C010=XXXXXXX&

C011=XXXXXXXXXXXXXXXXX&

SESID=xxxxxxxx

"

Eu realmente preciso disto a funcionar portanto caso tenha, a solução e a queiram negociar enviem-me uma PM.

Desde já agradeço a vossa ajuda!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.