longvanren
Newbie
- Jan 24, 2022
- 14
- 0
Hi all.
Im currently develop a php script to check if email exists for email provider like outlook.com or hotmail.com
But when im try to disguise as a browser i still get error 500 from them. This is the code
// first time access
$header[] = "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
$header[] = "cache-Control: max-age=0";
$header[] = "connection: keep-alive";
$header[] = "keep-Alive: 300";
$header[] = "accept-Language: en-us,en;q=0.5";
// $header[] = "Pragma: "; // browsers keep this blank.
$opts = array(
'http' => array(
'method' => "GET",
'header' => $header
)
);
$context = stream_context_create($opts);
$body = file_get_contents('https://signup.live.com/signup');
$headers = $http_response_header;
// print_r($headers);
$regexUaid = preg_match('/uaid\s*=\s*([\S\s]{32})/', $body, $matches);
$regexhpgid = preg_match('/\"(hpgid)\"[\S\s]{6})/', $body, $matchehpgids);
$regexscid = preg_match('/\"(scid)\"[\S\s]{6})/', $body, $matchescids);
$regextcxt = preg_match('/\"(tcxt)\":"(.*?)"/', $body, $matchetcxts);
$regexuiflvr = preg_match('/\"(uiflvr)\"[^\s]{4})/', $body, $matcheuiflvrs);
$regexapiCanary = preg_match('/\"(apiCanary)\":"(.*?)"/', $body, $matcheapiCanarys);
$uaid = $matches[1];
$hpgid = $matchehpgids[2];
$scid = $matchescids[2];
$tcxt = $matchetcxts[2];
$uiflvr = $matcheuiflvrs[2];
$apiCanary = $matcheapiCanarys[2];
$fp = fopen('hotmail.html', 'w');
fwrite($fp, $body);
fclose($fp);
// print_r(array($uaid, $hpgid, $scid, $uiflvr, $apiCanary, $tcxt));
foreach ($headers as $hdr) {
if (preg_match('/^Set-Cookie:\s*(.*?.*?$/i', $hdr, $matches)) {
$cookies[] = $matches[1];
}
}
$cookies = implode(' ', $cookies);
// print_r($cookies);
// second time access
$headers = array();
$headers[] = 'origin: https://signup.live.com';
$headers[] = 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9';
$headers[] = 'accept-encoding: gzip, deflate, br';
$headers[] = 'accept-language: en-US,en;q=0.9,vi;q=0.8,zh-TW;q=0.7,zh;q=0.6,mt;q=0.5,en-GB;q=0.4';
$headers[] = 'canary: ' . $apiCanary;
$headers[] = 'content-type: application/json';
$headers[] = 'hpgid: ' . $hpgid;
$headers[] = 'scid: ' . $scid;
$headers[] = 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Microsoft Edge";v="98"';
$headers[] = 'sec-ch-ua-mobile: ?0';
$headers[] = 'sec-ch-ua-platform: "Windows"';
$headers[] = 'sec-fetch-dest: empty';
$headers[] = 'sec-fetch-mode: cors';
$headers[] = 'sec-fetch-site: same-origin';
$headers[] = 'tcxt: ' . $tcxt;
$headers[] = 'uaid: ' . $uaid;
$headers[] = 'uiflvr: ' . $uiflvr;
$headers[] = 'x-ms-apitransport: xhr';
$headers[] = 'x-ms-apiversion: 2';
$headers[] = 'authority: signup.live.com';
$headers[] = 'method: POST';
$headers[] = 'path: /API/CheckAvailableSigninNames?lic=1&uaid=' . $uaid;
$headers[] = 'scheme: https';
$headers[] = 'cache-control: max-age=0';
$headers[] = 'cookie: ' . $cookies;
$headers[] = 'origin: https://signup.live.com';
$headers[] = 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
$postdata = json_encode(
array(
'signInName' => "[email protected]",
'uaid' => $uaid,
'includeSuggestions' => true,
'uiflvr' => $uiflvr,
'scid' => $scid,
'hpgid' => $hpgid
)
);
$ch = curl_init();
$proxies = [
'103.199.155.26:1080'
];
$proxy = '184.178.172.13:15311';
curl_setopt($ch, CURLOPT_URL, ('https://signup.live.com/API/CheckAvailableSigninNames?lic=1&uaid=' . $uaid));
// curl_setopt($ch, CURLOPT_PROXY, $proxy); // PROXY details with port
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_REFERER, "https://signup.live.com/API/CheckAvailableSigninNames?lic=1&uaid=$uaid");
// curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.12011-10-16 20:23:00");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$server_output = curl_exec($ch);
$fp = fopen('hotmailprocess.json', 'w');
fwrite($fp, $server_output);
fclose($fp);
curl_close($ch);
Did the code wrong or contain something that should not be sent to? Anyone can give me hint or some technique to overcome this?
Thanks in advanced
Im currently develop a php script to check if email exists for email provider like outlook.com or hotmail.com
But when im try to disguise as a browser i still get error 500 from them. This is the code
// first time access
$header[] = "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
$header[] = "cache-Control: max-age=0";
$header[] = "connection: keep-alive";
$header[] = "keep-Alive: 300";
$header[] = "accept-Language: en-us,en;q=0.5";
// $header[] = "Pragma: "; // browsers keep this blank.
$opts = array(
'http' => array(
'method' => "GET",
'header' => $header
)
);
$context = stream_context_create($opts);
$body = file_get_contents('https://signup.live.com/signup');
$headers = $http_response_header;
// print_r($headers);
$regexUaid = preg_match('/uaid\s*=\s*([\S\s]{32})/', $body, $matches);
$regexhpgid = preg_match('/\"(hpgid)\"[\S\s]{6})/', $body, $matchehpgids);
$regexscid = preg_match('/\"(scid)\"[\S\s]{6})/', $body, $matchescids);
$regextcxt = preg_match('/\"(tcxt)\":"(.*?)"/', $body, $matchetcxts);
$regexuiflvr = preg_match('/\"(uiflvr)\"[^\s]{4})/', $body, $matcheuiflvrs);
$regexapiCanary = preg_match('/\"(apiCanary)\":"(.*?)"/', $body, $matcheapiCanarys);
$uaid = $matches[1];
$hpgid = $matchehpgids[2];
$scid = $matchescids[2];
$tcxt = $matchetcxts[2];
$uiflvr = $matcheuiflvrs[2];
$apiCanary = $matcheapiCanarys[2];
$fp = fopen('hotmail.html', 'w');
fwrite($fp, $body);
fclose($fp);
// print_r(array($uaid, $hpgid, $scid, $uiflvr, $apiCanary, $tcxt));
foreach ($headers as $hdr) {
if (preg_match('/^Set-Cookie:\s*(.*?.*?$/i', $hdr, $matches)) {
$cookies[] = $matches[1];
}
}
$cookies = implode(' ', $cookies);
// print_r($cookies);
// second time access
$headers = array();
$headers[] = 'origin: https://signup.live.com';
$headers[] = 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9';
$headers[] = 'accept-encoding: gzip, deflate, br';
$headers[] = 'accept-language: en-US,en;q=0.9,vi;q=0.8,zh-TW;q=0.7,zh;q=0.6,mt;q=0.5,en-GB;q=0.4';
$headers[] = 'canary: ' . $apiCanary;
$headers[] = 'content-type: application/json';
$headers[] = 'hpgid: ' . $hpgid;
$headers[] = 'scid: ' . $scid;
$headers[] = 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Microsoft Edge";v="98"';
$headers[] = 'sec-ch-ua-mobile: ?0';
$headers[] = 'sec-ch-ua-platform: "Windows"';
$headers[] = 'sec-fetch-dest: empty';
$headers[] = 'sec-fetch-mode: cors';
$headers[] = 'sec-fetch-site: same-origin';
$headers[] = 'tcxt: ' . $tcxt;
$headers[] = 'uaid: ' . $uaid;
$headers[] = 'uiflvr: ' . $uiflvr;
$headers[] = 'x-ms-apitransport: xhr';
$headers[] = 'x-ms-apiversion: 2';
$headers[] = 'authority: signup.live.com';
$headers[] = 'method: POST';
$headers[] = 'path: /API/CheckAvailableSigninNames?lic=1&uaid=' . $uaid;
$headers[] = 'scheme: https';
$headers[] = 'cache-control: max-age=0';
$headers[] = 'cookie: ' . $cookies;
$headers[] = 'origin: https://signup.live.com';
$headers[] = 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
$postdata = json_encode(
array(
'signInName' => "[email protected]",
'uaid' => $uaid,
'includeSuggestions' => true,
'uiflvr' => $uiflvr,
'scid' => $scid,
'hpgid' => $hpgid
)
);
$ch = curl_init();
$proxies = [
'103.199.155.26:1080'
];
$proxy = '184.178.172.13:15311';
curl_setopt($ch, CURLOPT_URL, ('https://signup.live.com/API/CheckAvailableSigninNames?lic=1&uaid=' . $uaid));
// curl_setopt($ch, CURLOPT_PROXY, $proxy); // PROXY details with port
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_REFERER, "https://signup.live.com/API/CheckAvailableSigninNames?lic=1&uaid=$uaid");
// curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.12011-10-16 20:23:00");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$server_output = curl_exec($ch);
$fp = fopen('hotmailprocess.json', 'w');
fwrite($fp, $server_output);
fclose($fp);
curl_close($ch);
Did the code wrong or contain something that should not be sent to? Anyone can give me hint or some technique to overcome this?
Thanks in advanced