search
Homephp教程php手册PHP模拟登陆MSN并获得用户信息

PHP模拟登陆MSN并获得用户信息

Jun 13, 2016 am 10:36 AM
msnphpsuperiorcodeinformationCansimulationuserLoginofObtainget

一个可以获取msn上用户信息的代码

<font face="NSimsun"><?php </font></font>
/*
* bkJia中文网,整体提供,测试通过
* www.bkJia.com
*/<font face="NSimsun"><br> $msn = new myMSN(php100@2cto.com, "123");<br> // MSNv9<br> class myMSN {<br> private $server = "messenger.hotmail.com";<br> private $port = 1863;<br> private $nexus = "https://nexus.passport.com/rdr/pprdr.asp";<br> private $sshLogin = "login.live.com/login2.srf"; //loginnet.passport.com/login2.srf<br> private $getCode = null;<br> private $_ip = null;<br> private $_port = null;<br> private $connect = null;<br> private $trID = 1;<br> private $maxMessage = 4096;<br> private $userName = null;<br> private $passWord = null;<br> private $debug = true;<br> function myMSN($userName="", $passWord="") {<br> if (!empty($userName) && !empty($passWord)) {<br> $this->userName = $userName;<br> //$this->passWord = urlencode($passWord);<br> $this->passWord = $passWord;<br> $this->startTalk();<br> }<br> }<br> function put($data) {<br> if ($this->isConnect()) {<br> fputs($this->connect, $data);<br> $this->trID ;<br> if ($this->debug)<br> print("<div style="color:green;font-size:13px;">>>>{$data}</div>");<br> }<br> }<br> function get() {<br> if ($data = @fgets($this->connect, $this->maxMessage)) {<br> if ($this->debug)<br> print("<div style="color:red;font-size:13px;">");<br> return $data;<br> } else {<br> return false;<br> }<br> }<br> function isConnect() {<br> if (!is_null($this->connect))<br> return true;<br> else<br> return false;<br> }<br> function close() {<br> @fclose($this->connect);<br> }<br> function startTalk() {<br> if ($this->connect = fsockopen($this->server, $this->port, $errno, $errstr, 2))<br> $this->verTalk();<br> }<br> function verTalk() // MSN 协议协商 {<br> $this->put("VER {$this->trID} MSNP9 CVR0 rn");<br> $data = $this->get();<br> //echo $data;<br> if (false !== strripos($data, "VER"))<br> $this->envTalk();<br> }<br> function envTalk() // 环境协商 {<br> $this->put("CVR {$this->trID} 0x0409 winnt 5.0 i386 MSNMSGR 7.0.0816 MSMSGS {$this->userName} rn");<br> $data = $this->get();<br> //echo $data;<br> if (false !== strripos($data, "CVR"))<br> $this->reqTalk();<br> }<br> function reqTalk() // 请求确认 {<br> $this->put("USR {$this->trID} TWN I {$this->userName} rn");<br> $data = $this->get(); // XFR 3 NS 207.46.107.41:1863 0 65.54.239.210:1863 XFR 3 NS 207.46.107.25:1863 U D<br> //echo $data;<br> if (false !== strripos($data, "XFR")) {<br> list(, , , $serv) = explode(" ", $data); // 分析服务器<br> list($ip, $port) = explode(":", $serv); // 分析IP和端口<br> $this->_ip = $ip;<br> $this->_port = $port;<br> $this->reLink($ip, $port);<br> } else {<br> //echo $data; // USR 3 TWN S ct=1205292058,rver=5.0.3270.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http://messenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0<br> list(, , , , $this->getCode) = explode(" ", trim($data));<br> //echo $data;<br> if (empty($this->sshLogin))<br> $this->reLoginTalk(); // 重新获取登陆服务器地址<br> else<br> $this->getLoginCode($this->sshLogin);<br> }<br> }<br> function reLink($server, $port) // 重置连接 {<br> $this->connect = null;<br> $this->server = $server;<br> $this->port = $port;<br> $this->trID = 1;<br> $this->startTalk();<br> }<br> function reLoginTalk() // 重新获取服务器地址 {<br> $ch = curl_init($this->nexus);<br> curl_setopt($ch, CURLOPT_HEADER, 1);<br> curl_setopt($ch, CURLOPT_NOBODY, 1);<br> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br> $header = curl_exec($ch);<br> //print_r($header);<br> curl_close($ch);<br> preg_match (/DALogin=(.*?),/, $header, $out); // 捕捉服务器登陆匹配<br> //print_r($out);<br> if (isset($out[1])) {<br> $this->getLoginCode($out[1]);<br> }<br> else {<br> //return false;<br> exit("无法捕捉到登陆服务器的URL");<br> }<br> }<br> function getLoginCode($slogin) // 获取登陆代码 {<br> //echo($this->getCode);<br> if (!is_null($this->getCode)) {<br> $ch = curl_init("https://" . $slogin);<br> $loginInfo = array(<br> "Authorization: Passport1.4 rgVerb=GET,OrgURL=http://messenger.msn.com,sign-in=" . $this->userName . ",pwd=" . $this->passWord . "," . $this->getCode,<br> "Host: login.passport.com"<br> );<br> curl_setopt($ch, CURLOPT_HTTPHEADER, $loginInfo);<br> //print_r($loginInfo);<br> //$this->getCode = null;<br> curl_setopt($ch, CURLOPT_HEADER, 1);<br> curl_setopt($ch, CURLOPT_NOBODY, 1);<br> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);<br> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); </div></font>

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor