YMSG Protocol Class / package YMSG | Pentru YMSG16
Referitor la articolul anterior in care spuneam ca fac un script clona la imvisible.ro am hotarat intre timp sa fac siteul 100% independent. Ceia ce necesita scanarea prin buti, necesitatea de a trimite pachete si de le a citi. Foarte complicat.
De ce fac totul de capul meu si nu cer ajutorul la altii? Pentru ca am cerut si toti sunt doar niste inganfati si iti dau doar cateva informatii si te lasa in ceata.
Pun la dispozitie YMSG Protocol Class / package YMSG, pentru ymsg16:
<?php
/**
* YMSG Protocol Class.
* Donate PayPal claudiupetreanu18@gmail.com
* @package YMSG
* @author Petreanu Claudiu
*/
class YMSG
{
// 0×57 : W, 0×54 : T
var $serviceCode = array(‘getChallenge’ => 0×57, ‘loginRequest’ => 0×54);var $clientVer = ’9.0.0.2034′; //’9.0.0.1389′;
var $protocolVer = ’16′;
var $sepStr;// Define Separate
public function __construct()
{
$this->sepStr = chr(0xC0).chr(0×80);
}// Return YMSG header
public function getHeader($length)
{
$value = “YMSG”.chr(0×0).chr($this->protocolVer).chr(0×0).chr(0×0);
$value .= chr(intval($length/256));
$value .= chr(fmod($length, 256));
$value .= chr(0×0);return $value;
}// Create Preconnect packet
public function preCheck()
{
$Packet = “”; // Return packet// 0×00000000 Client Request
// Giống str_pad(chr(0×0), 4)
$Packet.= chr(0×0).chr(0×0).chr(0×0).chr(0×0);// SessionID
$Packet.= chr(0×0).chr(0×0).chr(0×0).chr(0×0);return $this->getHeader(0).chr(0x4C).$Packet;
}// Create Challenge Request packet
public function getChallenge($userName)
{
//Client Request & SessionID
$status = chr(0×0).chr(0×0).chr(0×0).chr(0×0);
$status.= chr(0×0).chr(0×0).chr(0×0).chr(0×0);$Packet = “”; // Return packet
$Packet .= “1″.$this->sepStr.$userName.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0×57).$status.$Packet;
}// Create Login packet
public function Login($Username, $Challenge, $Y, $T, $Crumb, $invisible)
{
$Packet = “”; // Return packet
/*
* Client receives the challenge string, the client will
* then add the value of the challenge string
* to the password and compute a MD5 hash.
*/
$hash = $this->MD5($Crumb.$Challenge);
$encodePass = trim($this->Y64($hash));// Sign in invisible
$invisibleByte = “”;
if ($invisible)
{
$invisibleByte = chr(0×0).chr(0×0).chr(0×0).chr(0xC).chr(0×0).chr(0x5A).chr(0×14).chr(0xFB);
}
else
{
$invisibleByte = chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×57).chr(0x8C).chr(0xAA);
}$Packet .= “1″.$this->sepStr.$Username.$this->sepStr.”0″.$this->sepStr.$Username.$this->sepStr;
$Packet .= “277″.$this->sepStr.$Y.$this->sepStr.”278″.$this->sepStr.$T.$this->sepStr;
$Packet .= “307″.$this->sepStr.$encodePass.$this->sepStr.”244″.$this->sepStr.”0″.$this->sepStr;
$Packet .= “2″.$this->sepStr.$Username.$this->sepStr.”2″.$this->sepStr.”1″.$this->sepStr;
$Packet .= “59″.$this->sepStr.”B.86n2ttt5so3nn&b=3&s=bf”.$this->sepStr;
$Packet .= “98″.$this->sepStr.”us”.$this->sepStr.”135″.$this->sepStr.$this->clientVer.$this->sepStr;return $this->getHeader(strlen($Packet)).”T”.$invisibleByte.$Packet;
}// Create Friend Avatar Icon packet
public function normalCheck($username, $target)
{
//Client Request & SessionID
$status = chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0);
$Packet = “”; // Return packet$Packet .= “1″.$this->sepStr.$username.$this->sepStr;
$Packet .= “5″.$this->sepStr.$target.$this->sepStr;
$Packet .= “57″.$this->sepStr.$this->sepStr;
$Packet .= “13″.$this->sepStr.”1″.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0xBE).$status.$Packet;
}// Create P2P Request packet
public function P2PScan($username, $target)
{
//Client Request & SessionID
$status = chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0);
$Packet = “”; // Return packet$Packet .= “1″.$this->sepStr.$username.$this->sepStr;
$Packet .= “4″.$this->sepStr.$username.$this->sepStr;
$Packet .= “12″.$this->sepStr.”LTQ1Njg4ODUxMA==”.$this->sepStr;
$Packet .= “61″.$this->sepStr.”0″.$this->sepStr.”2″.$this->sepStr.$this->sepStr;
$Packet .= “5″.$this->sepStr.$target.$this->sepStr;
$Packet .= “13″.$this->sepStr.”0″.$this->sepStr;
$Packet .= “49″.$this->sepStr.”PEERTOPEER”.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0x4F).$status.$Packet;
}// Create Send IM packet
public function sendPM($username, $target, $message)
{
//5A 55 AA 56 00 4E 86 62
//5A 55 AA 56 00 5F 89 DD
$status = chr(0x5A).chr(0×55).chr(0xAA).chr(0×56).chr(0×0).chr(0×0).chr(0×0).chr(0×0);$Packet = “”; //Packet to send
$Packet .= “0″.$this->sepStr.$username.$this->sepStr;
$Packet .= “1″.$this->sepStr.$username.$this->sepStr;
$Packet .= “5″.$this->sepStr.$target.$this->sepStr;
$Packet .= “14″.$this->sepStr.$message.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0×06).$status.$Packet;
}// Create Deny Buddy packet
public function denyBuddy($username, $target, $message)
{
//Client Request & SessionID
$status = chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0);
$Packet = “”; // Return packet$Packet .= “1″.$this->sepStr.$username.$this->sepStr;
$Packet .= “7″.$this->sepStr.$target.$this->sepStr;
$Packet .= “14″.$this->sepStr.$message.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0×86).$status.$Packet;
}// Create Add Buddy packet
public function addBuddy($username, $target, $group)
{
//Client Request & SessionID
$status = chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0);
$Packet = “”; // Return packet$Packet .= “1″.$this->sepStr.$username.$this->sepStr;
$Packet .= “7″.$this->sepStr.$target.$this->sepStr;
$Packet .= “65″.$this->sepStr.$group.$this->sepStr;return $this->getHeader(strlen($Packet)).chr(0×83).$status.$Packet;
}// Create Magic Login packet
public function newLogin($Y, $T)
{
$packet = “6″.$this->sepStr.$Y.” “.$T.$this->sepStr;
$header = “YMSG”.chr(0×0).chr(0×10);
$header .= chr(0×0).chr(0×0);
$header .= chr(intval(strlen($packet) / 256)).chr(fmod(strlen($packet), 256));
$header .= chr(0×02).chr(0×26).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0).chr(0×0);return $header.$packet;
}// Get Login cookie info
public function getLoginInfo($userName, $passWord, $chl)
{
$token = “”;
$url = “https://login.yahoo.com/config/pwtoken_get?src=ymsgr&login=”.$userName.”&passwd=”.$passWord;
$buff = file_get_contents($url);
$status = $buff[0];
/*
0 – OK
100 – if username or password is missing.
1013 – username contains @yahoo.com or similar which needs removing.
1212 – is the username or password is incorrect.
1213 – is a security lock from to many failed login attempts
1214 – is a security lock
1218 – if the account has been deactivated by Yahoo
1235 – if the username does not exist.
1236 – locked due to to many login attempts
*/
#echo “Status Token: “.$status;
if ($status == ’0′)
{
$token = $this->parseToken($buff, “ymsgr=”, chr(0xA));
}
else
{
// Your token here
$token = “ALAyy0u_ChIwdguQv.vNBTorupqAtcnJhsQjXgDKLcxGPW8-”; //xp20688
}$url = trim(“https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=”.$token);
$content = file_get_contents($url);return $content;
}// Parse data from string
public function parseToken($src, $begin, $end)
{
$start = substr($src, strpos($src, $begin) + strlen($begin));
$result = substr($start, 0, strpos($start, $end));
return $result;
}// Raw MD5 function
public function MD5($str)
{
$md5 = md5($str);
$ctx = ”;
for ($i = 0; $i < 32; $i += 2)
{
$ctx .= chr(hexdec($md5{$i} . $md5{$i + 1}));
}
return $ctx;
}// Yahoo Base64 function
public function Y64($str)
{
$length = 16;
$string = base64_encode(substr($str, 0, $length));
$string = str_replace(‘+’, ‘.’, $string);
$string = str_replace(‘/’, ‘_’, $string);
$string = str_replace(‘=’, ‘-’, $string);
return $string;
}// Get Packet Type function
function getPacketType($data)
{
return substr($data, 11, 1);
}// Format time function
public function timeFormat($start, $end)
{
$time = substr(($end – $start), 0, 7);
return str_replace(‘-’, ”, $time);
}// ReadLine from text file function
public function readln($file, $line_number)
{
/*** read the file into the iterator ***/
$file_obj = new SplFileObject($file);
/*** seek to the line number ***/
$file_obj->seek($line_number);
/*** return the current line ***/
return $file_obj->current();
}
}
?>













June 25th, 2010 at 2:14 pm
Caut de foarte mult timp un cod php, complet, care citeste pachetele de la yahoo. Ar fi fain daca ai pune o modalitate prin care se logheaza idurile la yahoo prin ymsg16. Iti multumesc frumos, si ti-am trimis 2 euro pe paypal. Ai facut o treaba grozava.