Lol - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Lol.php

  1. <?php
  2.  
  3. $cipher = 'rijndael-128';
  4. $mode = 'cbc';
  5. $miui_key = 'miuiotavalided11';
  6. $miui_iv = '0102030405060708';
  7.  
  8. function miui_decrypt($s)
  9. {
  10.     global $cipher, $mode, $miui_key, $miui_iv;
  11.  
  12.     $td = mcrypt_module_open($cipher, '', $mode, '');
  13.     mcrypt_generic_init($td, $miui_key, $miui_iv);
  14.     $decrypted = mdecrypt_generic($td, base64_decode($s));
  15.     mcrypt_generic_deinit($td);
  16.     mcrypt_module_close($td);
  17.     $pos = strrpos($decrypted, '}');
  18.     if ($pos !== false)
  19.         return substr($decrypted, 0, $pos + 1);
  20.     return $decrypted;
  21. }
  22.  
  23. function miui_encrypt($s)
  24. {
  25.     global $cipher, $mode, $miui_key, $miui_iv;
  26.  
  27.     $td = mcrypt_module_open($cipher, '', $mode, '');
  28.     mcrypt_generic_init($td, $miui_key, $miui_iv);
  29.     $bs = mcrypt_get_block_size($cipher, $mode);
  30.     $n = $bs - (strlen($s) % $bs);
  31.     while ($bs - (strlen($s) % $bs) != $bs)
  32.         $s .= chr($n);
  33.     $encrypted = base64_encode(mcrypt_generic($td, $s));
  34.     mcrypt_generic_deinit($td);
  35.     mcrypt_module_close($td);
  36.     return $encrypted;
  37. }
  38.  
  39. $checkurl = 'http://update.miui.com/updates/miotaV3.php';
  40.  
  41. $device_data = array(
  42.     "a" => "0", # Don't know what this is.
  43.     "c" => "7.0", # Same as 'c' above, it's the Android version.
  44.     "b" => "F", # Same as above, 'X' for weekly build.
  45.     "d" => "mido_global", # The device name, same as above, chiron for Chinese, chiron_global for global.
  46.     "g" => "00000000000000000000000000000000", # This seems to be the android_id of the device. Maybe encoded somehow.
  47.     "cts" => "0", # I don't know what this is.
  48.     "i" => "0000000000000000000000000000000000000000000000000000000000000000", # This seems to be the imei of the device, obviously encoded somehow.
  49.     "isR" => "0", # I don't know what this is.
  50.     "f" => "1", # I don't know what this is.
  51.     "l" => "en_US", # The locale.
  52.     "n" => "",  # I don't know what this parameter is
  53.     "sys" => "0", # I don't know what this is.
  54.     "p" => "msm8953", # The chipset
  55.     "unlock" => "1",  # 1 means bootloader is unlocked. 0 means locked.
  56.     "r" => "CN", # I don't know what this is, maybe region of device?
  57.     "sn" => "0x00000000", # Probably the serial number of the device, maybe encoded somehow.
  58.     "v" => "MIUI-V9.0.5.0.NCFMIEI", # The version of MIUI installed.
  59.     "bv" => "9", # I don't know what this is.
  60.     "id" => "", # I don't' know what this is.
  61. );
  62.  
  63. $js = json_encode($device_data);
  64.  
  65. $postdata = "q=".urlencode(miui_encrypt($js))."&t=&s=1";
  66.  
  67. $curl = curl_init();
  68. curl_setopt($curl, CURLOPT_URL, $checkurl);
  69. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  70. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  71. curl_setopt($curl, CURLOPT_HEADER, 0);
  72. curl_setopt($curl, CURLOPT_POST, 1);
  73. curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
  74. $data = curl_exec($curl);
  75. if ($data === false) {
  76.     echo "*** curl_exec() failed: ".curl_errno($curl)." => ".curl_error($curl)."\n";
  77.     curl_close($curl);
  78.     exit;
  79. }
  80.  
  81. $r = miui_decrypt($data);
  82. $result = json_decode($r);
  83. print_r($result);
  84.  
  85. exit
  86. ?>
File Description
  • Lol
  • PHP Code
  • 05 Dec-2023
  • 2.91 Kb
You can Share it: