<?php
$uid = ""; // Bot ID
$pwd = ""; // Bot Pwd
$target = ""; // TargetID
include 'YMSG.class.php'; // YMSG Protocol Class
$ymsg = new YMSG();
// Connect to server
$server = file_get_contents('http://vcs1.msg.yahoo.com/capacity');
$server = substr($server, strpos($server, "CS_IP_ADDRESS=") + strlen("CS_IP_ADDRESS="));
$fp = fsockopen($server, 80, $errno, $errstr, 2) or die('Cannot connect!!!');
if ($fp != null)
{
stream_set_timeout($fp, 1);
}
// Create Send IM Packet
$sendPM = $ymsg->sendPM($uid, $target, "Test Message");
// Create preConnect Packet
$preChk = $ymsg->preCheck();
fwrite($fp, $preChk);
// Preconnect result
$chkStr = fread($fp, 20);
if ($ymsg->getPacketType($chkStr) == 'L')
{
print 'Precheck success!!!<br/>';
// Create Challenge Request Packet
$chkStr = $ymsg->getChallenge($uid);
fwrite($fp, $chkStr);
$chlStr = fread($fp, 150);
}
if ($ymsg->getPacketType($chkStr) == 'W')
{
print 'Challenge Succes!!!<br/>';
// Get Status and Challenge String from Server Response
$status = $ymsg->parseToken($chlStr, "13".$ymsg->sepStr, chr(0xC0));
$challenge = $ymsg->parseToken($chlStr, "94".$ymsg->sepStr, chr(0xC0));
// Get and Parse Login Cookie Info
$info = $ymsg->getLoginInfo($uid, $pwd, $challenge);
$crumb = $ymsg->parseToken($info, "crumb=", chr(0xD));
$T = $ymsg->parseToken($info, "T=", chr(0xD));
$Y = $ymsg->parseToken($info, "Y=", chr(0xD));
// Create Login Packet
$loginStr = $ymsg->Login($uid, $challenge, $Y, $T, $crumb, true);
fwrite($fp, $loginStr);
// Login Result
$loginRes = fread($fp, 1024);
}
if ($ymsg->getPacketType($loginRes) == 'U')
{
print 'Login Succes!!!<br/>';
// Account info: Friend List, Ignore List, etc...
$nextData = '';
do {
$nextData = fread($fp, 500);
} while (strlen($nextData) > 0);
}
// Login Done
print 'Send PM!!!<br/>';
fwrite($fp, $sendPM);
$result = fread($fp, 1024);
?>
|