Jump to content

calling the xbox.class.php file


darkfreaks

Recommended Posts

xbobx.class.php


    <?php
     
    /*****************************************************
     
    You must use a GOLD xbox live account for this script to work
    Make sure you change perrmissions on xbox-cookie.jar to 0777
     
    Xbox.com allows you to send a message every 15 seconds
    But, I do not advise using these scripts to spam an xbox live user
    Your account/ip will probably be banned.
     
    I, gt: l RaH l, made this script so that
    I could verify a users access to a gamertag before authorizing
    the permissions on a website.
     
    ******************************************************/
     
    class Xbox {
        var $email, $password;
        var $cookieFile = "xbox-cookie.jar";
        var $loggedIn = false;
       
        function __construct($cookieFile = false) {
            if($cookieFile) {
                $this->cookieFile = $cookieFile;
            }
            $this->checkCookieFile();
        }
       
        function setEmail($value) {
            $this->email = str_replace("@", "%40", strtolower($value));
        }
       
        function setPassword($value) {
            $this->password = $value;
        }
       
        function login() {
            if($this->loggedIn == true) {
                return true;
            } else if($this->email == "") {
                return false;
            } else if($this->password == "") {
                return false;
            } else {
                $this->addCookie(".xbox.com", "s_vi", "[CS]v1|26AD650A85162062-6000017800043E74[CE]", "/", time()+60*60*24*365);
                $this->addCookie(".xbox.com", "s_sa", "%5B%5BB%5D%5D", "/", time()+60*60*24*365);
                $this->addCookie(".xbox.com", "s_ria", "flash%2010%7Csilverlight%20not%20detected", "/", time()+60*60*24*365);
                $this->addCookie(".xbox.com", "s_cc", "true", "/", time()+60*60*24*365);
                $this->addCookie(".xbox.com", "s_nr", time(), "/", time()+60*60*24*365);
                $this->addCookie(".xbox.com", "UtcOffsetMinutes", "0", "/", time()+60*60*24*365);
               
                $url = "https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&ct=".time()."&rver=6.0.5286.0&wp=MBI&wreply=https://live.xbox.com:443/xweb/live/passport/setCookies.ashx%3Frru%3Dhttp%253a%252f%252fwww.xbox.com%252fen-US%252f&flc=3d1033&lc=1033&cb=reason=0&returnUrl=http%253a%252f%252fwww.xbox.com%252fen-US%252f%253flc%253d1033&id=66262";
                $result = $this->launchPage($url, "http://www.xbox.com/en-US/");
               
                $this->addCookie(".login.live.com", "CkTst", "G".time(), "/", time()+60*60*24*365);
               
                $url = $this->findString($result, "srf_uPost='", "';");
                $PPFT = $this->findString($result, "name=\"PPFT\" id=\"i0327\" value=\"", "\"");
                $PPSX = $this->findString($result, "srf_sRBlob='", "';");
               
                $postData = "login=". $this->email ."&passwd=". $this->password ."&type=11&LoginOptions=3&MEST=&PPSX=".$PPSX."&PPFT=".$PPFT."&idsbho=1&PwdPad=&sso=";
                $result = $this->launchPage($url, "", true, $postData);
             
                $this->addCookie(".live.com", "wlidperf", "throughput=8&latency=363", "/", time()+60*60*24*365);
                $this->addCookie("login.live.com", "CkTst", time(), "/ppsecure/", time()+60*60*24*365);
               
                $url = $this->findString($result, "id=\"fmHF\" action=\"", "\"");
                $NAP = $this->findString($result, "id=\"NAP\" value=\"", "\"");
                $ANON = $this->findString($result, "id=\"ANON\" value=\"", "\"");
                $t = $this->findString($result, "id=\"t\" value=\"", "\"");
               
                $postData = "NAPExp=".date('c', mktime(date("H"), date("i"), date("s"), date("n")+1))."&NAP=".$NAP."&ANONExp=".date('c', mktime(date("H"), date("i"), date("s"), date("n")+1))."&ANON=".$ANON."&t=".$t;
                $result = $this->launchPage($url, "", true, $postData);
                if(strpos($result, "Sign Out</a>") || strpos($result, "Object moved")) {
                    $this->loggedIn = true;
                    return true;
                } else {
                    return false;
                }
            }
        }
       
        function sendMessage($gamertag, $message) {
            $postData = "Recipients=". $gamertag ."&Message=". $message;
            $result = $this->launchPage("http://live.xbox.com/en-US/MessageCenter/Compose", true, $postData);
            return $result;
        }
       
        function checkCookieFile() {
            if(file_exists($this->cookieFile)) {
                if(time() - filemtime($this->cookieFile) >= 3600 || filesize($this->cookieFile) == 0) {
                    $f = fopen($this->cookieFile, "w");
                    fclose($f);
                    $this->loggedIn = false;
                } else {
                    $this->loggedIn = true;
                }
            } else {
                $f = fopen($this->cookieFile, "w");
                fclose($f);
                $this->loggedIn = false;
            }
        }
       
        function checkLogin($result) {
            if(strpos($result, "Sign Out</a>")) {
                $this->loggedIn = true;
                return true;
            } else {
                $this->loggedIn = false;
                return false;
            }
        }
       
        function addCookie($domain, $name, $value, $path = "/", $expires = 0) {
            if(!file_exists($this->cookieFile)) {
                $this->error("The cookie file does not exist.");
                return false;
            } else {
                $c = fopen($this->cookieFile, "a");
                if(!$c) {
                    $this->error("Could not write to cookie file.");
                    return false;
                } else {
                    fwrite($c, $domain."    TRUE    ".$path."       FALSE   ".$expires."    ".$name."       ".$value."\r\n");
                    fclose($c);
                    return true;
                }
            }
        }
       
        function launchPage($url, $referer = "", $post = false, $postdata = null) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
            curl_setopt($ch, CURLOPT_TIMEOUT, 60);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookieFile);
            curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookieFile);
            if($referer != "") {
                curl_setopt($ch, CURLOPT_REFERER, $referer);
            }
            curl_setopt($ch, CURLOPT_AUTOREFERER, true);
            if($post) {
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
            }
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest"));
            $result = curl_exec($ch);
            curl_close($ch);
            return $result;
        }
       
        function findString($haystack, $start, $finish) {
            $s = explode($start, $haystack);
            $s = explode($finish, $s[1]);
            return $s[0];
        }
    }
     
    ?>

 

how would i take this class and use it to send  messages to users on xbox.com, i just need an example really so i can understand how the class works. thanks.

Link to comment
https://forums.phpfreaks.com/topic/241439-calling-the-xboxclassphp-file/
Share on other sites

Have you tried something like:

<?php
include xbobx.class.php;

$xbox = new Xbox();
$xbox->setEmail('[email protected]');
$xbox->setPassword('mypassword');
$xbox->login();
$xbox->sendMessage('mygamertag','Hey it works!');
?>

 

Of course, this is from 2 minutes with that script.  I can't promise that will work, but that is the general idea behind it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.