[PHP] UUID - offline mode nicky

Message
Autor
Uživatelský avatar
zdenda204
Příspěvky: 3617
Věk: 35
Registrován: 23 kvě 2012, 21:38
Reputation: 0

[PHP] UUID - offline mode nicky

#1 Příspěvekod zdenda204 » 13 črc 2014, 23:51

Spousta z Vás má jistě trable s tím, jak zjistit UUID pro hráče, který si hru nezakoupil.
Tento kód si uložte na svůj web a pak pouze stačí do adresy zadat uživatelské jméno (Příklad: http://www.epic.cz/skript.php?nick=zdenda204)

  1. <?php
  2. function uuidFromString($string) {
  3.     $val = md5($string, true);
  4.     $byte = array_values(unpack('C16', $val));
  5.  
  6.     $tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3];
  7.     $tMi = ($byte[4] << 8) | $byte[5];
  8.     $tHi = ($byte[6] << 8) | $byte[7];
  9.     $csLo = $byte[9];
  10.     $csHi = $byte[8] & 0x3f | (1 << 7);
  11.  
  12.     if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
  13.         $tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24);
  14.         $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
  15.         $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
  16.     }
  17.  
  18.     $tHi &= 0x0fff;
  19.     $tHi |= (3 << 12);
  20.    
  21.     $uuid = sprintf(
  22.         '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
  23.         $tLo, $tMi, $tHi, $csHi, $csLo,
  24.         $byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15]
  25.     );
  26.     return $uuid;
  27. }
  28.  
  29. function uuidConvert($string)
  30. {
  31.     $string = uuidFromString("OfflinePlayer:".$string);
  32.     return $string;
  33. }
  34.  
  35. var_dump(uuidConvert($_GET['nick']));
Přijímám zakázky na skripty/pluginy v PHP/Javě za malý poplatky! A kup mi sušenku :) Obrázek Obrázek
⇨Projekt Market⇦

Uživatelský avatar
siOnzee
Příspěvky: 810
Věk: 27
Registrován: 30 lis 2011, 21:40
Reputation: 4
Bydliště: siOnzee.cz
Kontaktovat uživatele:

Re: [PHP] UUID - warez nicky

#2 Příspěvekod siOnzee » 14 črc 2014, 00:39

Dobře ty. Na tyhle blásty jsem nikdy neměl náladu, chce to moc přemýšlení a už jen vymyslet celej ten algoritmus je na hrozně dlouho.

Uživatelský avatar
Mysteria
Příspěvky: 9122
Registrován: 26 pro 2009, 15:40
Reputation: 7
Bydliště: Česká republika
Kontaktovat uživatele:

Re: [PHP] UUID - warez nicky

#3 Příspěvekod Mysteria » 14 črc 2014, 11:07

To jsi psal ty sám? 8-)

vojtamaniak
Příspěvky: 3512
Věk: 25
Registrován: 18 úno 2012, 21:02
Reputation: 11

Re: [PHP] UUID - warez nicky

#4 Příspěvekod vojtamaniak » 14 črc 2014, 11:35

Samozřejmě že to psal sám, máš ho snad za podvodníka?

[Pro všechny kromě zdendy](Nepsal, samozřejmě :D)[/Pro všechny kromě zdendy]

Uživatelský avatar
Mysteria
Příspěvky: 9122
Registrován: 26 pro 2009, 15:40
Reputation: 7
Bydliště: Česká republika
Kontaktovat uživatele:

Re: [PHP] UUID - warez nicky

#5 Příspěvekod Mysteria » 14 črc 2014, 12:44

Myslel jsem si to, protože né že bych ho podceňoval, ale tyhle bitové operace a další věci nejsou zrovna nejlehčí věc na pochopení. :)

V886b
Příspěvky: 10
Registrován: 14 črc 2014, 12:51
Reputation: 0

Re: [PHP] UUID - warez nicky

#6 Příspěvekod V886b » 14 črc 2014, 12:53

co je uuid

-- 14 črc 2014, 11:54 --

pls co to je

Uživatelský avatar
LpBahos
Příspěvky: 934
Věk: 24
Registrován: 30 dub 2013, 15:52
Reputation: 0
Bydliště: Opava
Kontaktovat uživatele:

Re: [PHP] UUID - warez nicky

#7 Příspěvekod LpBahos » 14 črc 2014, 13:01

Kód: Vybrat vše

<?php

/*
 * Example of using the Classes.
 */

$profile = ProfileUtils::getProfile("Shadowwolf97");
$result = $profile->getProfileAsArray();
echo 'username: '.$result['username'].'<br>';
echo 'uuid: '.$result['uuid'].'<br/>';
//I am honestly not sure what the properties are at this point, but I included them just in case they are needed.
//echo 'properties: '.$result['properties'].'<br />';

$profile = ProfileUtils::getProfile("c465b1543c294dbfa7e3e0869504b8d8");
$result = $profile->getProfileAsArray();
echo 'username: '.$result['username'].'<br>';
echo 'uuid: '.$result['uuid'].'<br/>';

/*
 * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                    OutPuts                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * username: KingTiger
 * uuid:  34346c234f8a4736b2cd79bd9c8d91b0
 */

class MinecraftProfile {
    private $username;
    private $uuid;
    private $properties;

    /**
     * @param string $username The player's username.
     * @param string $uuid The player's UUID.
     * @param array $properties The player's properties specified on their Mojang profile.
     */
    function __CONSTRUCT($username, $uuid, $properties = array()) {
        $this->username = $username;
        $this->uuid = $uuid;
        $this->properties = $properties;
    }

    /**
     * @return string The player's username.
     */
    public function getUsername() {
        return $this->username;
    }

    /**
     * @return string The player's UUID.
     */
    public function getUUID() {
        return $this->uuid;
    }

    /**
     * @return array The player's properties listed on their mojang profile.
     */
    public function getProperties() {
        return $this->properties;
    }

    /**
     * @return array Returns an array with keys of 'properties, usernname and uuid'.
     */
    public function getProfileAsArray() {
        return array("username" => $this->username, "uuid" => $this->uuid, "properties" => $this->properties);
    }
}

class ProfileUtils {
    /**
     * @param string $identifier Either the player's Username or UUID.
     * @param int $timeout The length in seconds of the http request timeout.
     * @return MinecraftProfile|null Returns null if fetching of profile failed. Else returns completed user profile.
     */
    public static function getProfile($identifier, $timeout = 5) {
        if(strlen($identifier) <= 16)
            $identifier = ProfileUtils::getUUIDFromUsername($identifier, $timeout)['uuid'];
        $url = "https://sessionserver.mojang.com/session/minecraft/profile/".$identifier;
        $ctx = stream_context_create(array(
                'http' => array(
                    'timeout' => $timeout
                )
            )
        );
        $ret = file_get_contents($url, 0, $ctx);
        if(isset($ret) && $ret != null && $ret != false) {
            $data = json_decode($ret, true);
            return new MinecraftProfile($data['name'], $data['id'], $data['properties']);
        }else {
            return null;
        }
    }

    /**
     * @param int $timeout http timeout in seconds
     * @param $username string Minecraft username.
     * @return array (Key => Value) "username" => Minecraft username (properly capitalized) "uuid" => Minecraft UUID
     */
    public static function getUUIDFromUsername($username, $timeout = 5) {
        if(strlen($username) > 16)
            return array("username" => "", "uuid" => "");
        $url = 'https://api.mojang.com/profiles/page/1';
        $options = array(
            'http' => array(
                'header'  => "Content-type: application/json\r\n",
                'method'  => 'POST',
                'content' => '{"name":"'.$username.'","agent":"minecraft"}',
                'timeout' => $timeout
            ),
        );
        $context  = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
       
        // Verification
        if(isset($result) && $result != null && $result != false)
        {
            $ress = json_decode($result, true);
            $ress = $ress["profiles"][0];
            $res = Array("username" =>  $ress['name'], "uuid" => $ress['id']);
            return $res;
        }
        else
            return null;
    }

    /**
    * @param $uuid string UUID to format
    * @return string Properly formatted UUID (According to UUID v4 Standards xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx WHERE y = 8,9,A,or B and x = random digits.)
    */
    public static function formatUUID($uuid) {
        $uid = "";
        $uid .= substr($uuid, 0, 8)."-";
        $uid .= substr($uuid, 8, 4)."-";
        $uid .= substr($uuid, 12, 4)."-";
        $uid .= substr($uuid, 16, 4)."-";
        $uid .= substr($uuid, 20);
        return $uid;
    }
}

Uživatelský avatar
nejento
Příspěvky: 9815
Registrován: 28 lis 2011, 14:09
Reputation: 55
Kontaktovat uživatele:

Re: [PHP] UUID - warez nicky

#8 Příspěvekod nejento » 14 črc 2014, 13:35

Obrázek

Obrázek Přidejte se ke komunitě zákazníků na FakaHeda.eu Discord! Poznejte nové lidi nebo vyřešte svůj technický problém živě: http://discord.fakaheda.eu/

Uživatelský avatar
zdenda204
Příspěvky: 3617
Věk: 35
Registrován: 23 kvě 2012, 21:38
Reputation: 0

Re: [PHP] UUID - warez nicky

#9 Příspěvekod zdenda204 » 14 črc 2014, 13:38

Bahosi, to je jen na online UUID, ne?

Mysty, samozřejmě že jsem to nepsal :D Toto jde naprosto mimo mě, netuším stále co to dělá :D Každopádně bych uvedl autora, jenže jaksi nevím kde jsem to tenkrát našel :)
Přijímám zakázky na skripty/pluginy v PHP/Javě za malý poplatky! A kup mi sušenku :) Obrázek Obrázek
⇨Projekt Market⇦

Uživatelský avatar
Mysteria
Příspěvky: 9122
Registrován: 26 pro 2009, 15:40
Reputation: 7
Bydliště: Česká republika
Kontaktovat uživatele:

Re: [PHP] UUID - offline mode nicky

#10 Příspěvekod Mysteria » 14 črc 2014, 13:47

To jeho je jenom pro newarez, to tvoje je i pro warez, takže lepší. :) Rozhodně se bude hodit. No, jak jsem říkal bitový operace no... taky bych ti neřekl co přesně to dělá každý kus. :)


Zpět na „Návody“

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 28 hostů