前言
由于小米官方获取root密码的步骤过于繁琐,故编写php脚本进行计算,代码如下。
计算代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <?php
$salt = array( 'r1d' => 'A2E371B0-B34B-48A5-8C40-A7133F3B5D88', 'others' => 'd44fb0960aa0-a5e6-4a30-250f-6d2df50a' );
isset($argv[1]) or die('Usage: ' . $argv[0] . " SN\n"); print_line(get_passwd($argv[1]));
function print_line($message) { echo $message . "\n"; }
function get_passwd($sn) { return substr(md5($sn . get_salt($sn)), 0, 8); }
function get_salt($sn) { global $salt; if (false === strpos($sn, '/')) { return $salt['r1d']; } else { return swap_salt($salt['others']); } }
function swap_salt($salt) { return implode('-', array_reverse(explode('-', $salt))); }
|
使用教程
1
| php password.php <路由器SN>
|
passwd.php为计算代码保存的文件名