No Life Poster
Join Date: Feb 2006 Location: Caribbean
Posts: 1,034
Member: 237911
Status: Offline
Thanks Meter: 632 | if you know php?
then this will help you Quote:
<?php
// use: http://localhost/master.php?imei=111111111111119
// *********************************
function string_to_array($cadena)
{
for ($i = 0; $i < strlen($cadena); $i++)
$nueva[$i] = ord(substr($cadena, $i, 1));
return $nueva;
}
function char_of($cadena, $pos)
{
return ord(substr($cadena, $pos, 1));
}
//**********************************
function convertir_byte_a_hex ($byte)
{
if (($byte > 47) && ($byte < 58)) // '0' a '9'
return ($byte-48);
else if (($byte > 64) && ($byte < 71)) // 'A' a 'F' o otro caracter
return ($byte-55);
else
return $byte;
}
function ASCII2HEX ($origen, $caracteres, $comienzo)
{
$j=$comienzo;
for($i=0; $i<$caracteres; $i+=2)
{
$aux1 = (convertir_byte_a_hex(base_convert($origen[$i],16,10))<<4);
if ($i+1 < $caracteres)
$aux2 = convertir_byte_a_hex(base_convert($origen[$i+1],16,10));
else
$aux2 = 0;
$destino[$j] = ($aux1 | $aux2)&0xFF;
$j++;
}
return $destino;
}
// **************
function SecCode( $IMEI )
{
$MSID_TABLE_SIZE = 12;
$MSIDencodeseeds =
array( 0xB1, 0x73, 0xE6, 0x5A, 0xAB, 0x47, 0x8E, 0x0D, 0x1A, 0x34, 0x68, 0x0B );
$hash = array( 0x62, 0x34, 0x92, 0x58, 0x13, 0x76, 0x97, 0x25, 0x28, 0x56, 0x13, 0x68 );
memset( $cIMEI, 0, $MSID_TABLE_SIZE );
str2hex( $cIMEI, $IMEI, 2 );
$cIMEI[ 9 ] = 0;
// cryptMSID( $cIMEI, $MSIDencodeseeds, $hash );
$cIMEI = permu1( $cIMEI, $MSIDencodeseeds, $hash);
for( $i = 0; $i < 5; $i++ )
$code .= sprintf( "%02X", ( $cIMEI[ $i ] & 0x77 ));
return $code;
}
function memset( &$dst, $byte, $count )
{
for( $i = 0; $i < $count; $i++ )
$dst[ $i ] = $byte;
}
function str2hex( &$dst, $src, $shift = 0 )
{
$length = strlen( $src );
for( $i = 0; $i < $length; $i++ )
{
if(( $i & 1 ) ^ 1 )
$dst[ ( $i >> 1 ) + $shift ] = 0;
$data = base_convert( $src[ $i ], 16, 10 );
$dst[ ( $i >> 1 ) + $shift ] |= $data << ( 4 * (( $i & 1 ) ^ 1 ));
}
}
function calculo4_a ($caracter)
{
$aux1=0;
$aux2=7;
$temp=0;
for ($i=0; $i<8; $i++)
{
$aux3=$caracter;
$aux3=$aux3>>$aux2;
$aux3&=1;
$aux3=($aux3<<$aux1)&0xFF;
$temp|=$aux3;
$aux1++;
$aux2--;
}
return $temp & 0xFF;
}
function calculo4 ($cadena)
{
$temp=$cadena;
for ($i=0; $i<12; $i++)
{
$cadena[11-$i]=calculo4_a($temp[$i]);
}
return $cadena;
}
function calculo3 ($cadena)
{
$temp=$cadena;
$temp2=12;
$temp1=7;
$aux1=3;
for($i=0; $i<12; $i++)
{
$aux2=$temp1;
$aux3=$aux1;
$aux2=$temp[$aux2];
$aux2^=0xFF;
$aux2|=$temp[$aux3];
$temp2--;
$temp2&=0xFF;
if ($temp1==0)
$temp1=12;
$temp1--;
$temp1&=0xFF;
if ($aux1==0)
$aux1+=12;
$aux1&=0xFF;
$aux3=$temp2;
$cadena[$aux3]=$cadena[$aux3] ^ $aux2;
$aux1--;
$aux1&=0xFF;
}
return $cadena;
}
function calculo2_a ($cadena, $byte, $byte2)
{
if ($byte==0)
return;
for ($i=0; $i<$byte; $i++)
{
$aux1=$cadena[$byte2+3];
$aux1&=1;
$puntero=$byte2;
for ($j=0; $j<4; $j++)
{
$aux2=$cadena[$puntero];
$aux3=$aux2;
$aux2=$aux2>>1;
$aux1=($aux1<<7)&0xFF;
$aux2|=$aux1;
$aux3&=1;
$cadena[$puntero]=$aux2;
$aux1=$aux3;
$puntero++;
}
}
return $cadena;
}
function calculo2 ($cadena, $byte, $byte2)
{
$cadena = calculo2_a($cadena, 10, $byte);
$cadena = calculo2_a($cadena, 31, $byte2);
return $cadena;
}
function calculo1_a ($cadena)
{
$tabla1 = array(0x01,0x09,0x04,0x08,0x0B,0x05,0x09,0x08,0x06 ,0x0A,
0x01,0x03,0x0B,0x06,0x0A,0x00,0x08,0x07,0x0B,0x0A,
0x01,0x05,0x00,0x08,0x03,0x01,0x09,0x00,0x02,0x0A,
0x05,0x03,0x07,0x02,0x0A,0x00,0x04,0x03,0x0B,0x02,
0x05,0x09,0x00,0x04,0x07,0x01,0x05,0x04,0x02,0x06,
0x09,0x07,0x0B,0x02,0x06,0x04,0x08,0x03,0x07,0x06) ;
$tabla2 = array(0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00 ,0x00,
0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x00,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01) ;
$puntero=0;
$contador1=0;
$aux1=0;
$aux2=0;
while ($contador1<12) {
$contador2=5;
$aux2^=$cadena[$puntero];
while ($contador2>0) {
if (($tabla2[$aux1] == 0) && ($contador1 <6)) {
$variable_8c[$tabla1[$aux1]]=$cadena[$puntero];
}
else {
$variable_8c[$tabla1[$aux1]]^=$cadena[$puntero];
}
$aux1++;
$contador2--;
}
$contador1++;
$puntero++;
}
for ($contador3=0; $contador3<12; $contador3++)
$variable_8c[$contador3]^=$aux2;
return $variable_8c;
}
function calculo1 ($byte, $network_code_h, $imei_h)
{
$puntero=0;
$puntero2=0;
$contador=0;
$aux1=0;
while ($contador < 12)
{
$aux2=$aux1;
$aux2=($aux2>>1) % 3;
$aux2&=1;
$aux2*=$byte;
$aux2^=$imei_h[$puntero2];
$network_code_h[$puntero]=$network_code_h[$puntero] ^ $aux2;
$aux1++;
$puntero++;
$puntero2++;
$contador++;
}
$network_code_h = calculo1_a($network_code_h);
return $network_code_h;
}
function permu1($network_code_hex, $tabla, $imei_hex)
{
$j=0;
for ($i=0; $i<11; $i++) {
$network_code_hex = calculo1($tabla[$j], $network_code_hex, $imei_hex);
$network_code_hex = calculo2($network_code_hex, 0, 8);
$network_code_hex = calculo3($network_code_hex);
$network_code_hex = calculo2($network_code_hex, 8, 0);
$j++;
}
$network_code_hex = calculo1($tabla[11], $network_code_hex, $imei_hex);
$network_code_hex = calculo4($network_code_hex);
return $network_code_hex;
}
function calcular_dct3 ($imei, $network_code)
{
$tabla = array(0xb1,0x73,0xe6,0x5a,0xab,0x47,0x8e,0x0d,0x1a ,0x34,0x68,0x0b);
$network_code_h = ASCII2HEX($network_code, strlen($network_code), 0);
$imei_h = ASCII2HEX($imei, 14, 2);
$imei_h[0]=0;$imei_h[1]=0;
for ($i=2; $i<12; $i++)
$imei_h[$i]^=0xa5;
$network_code_h = permu1($network_code_h, $tabla, $imei_h);
$j=0;
for ($i=0; $i<5; $i++)
{
$aux1=$network_code_h[$i];
if (($aux1&0x80) == 0x80)
$aux1=($aux1+0xa0)&0xFF;
if (($aux1&0x08) == 0x08)
$aux1=($aux1+0xfa)&0xFF;
$convertido=base_convert($aux1, 10, 16);
if ($convertido > 9)
$destino[$j]=$convertido;
else {
$destino[$j]=0;
$j++;
$destino[$j]=$convertido;
}
$j++;
}
return $destino;
}
echo "<h3>Nokia Security code voor<br>IMEI nummer: " , $_GET[imei] , "</h3>";
echo "</center>";
echo "";
echo "</font>";
echo"<p><p>";
echo "Nokia Mastercode: ". SecCode($_GET[imei]);
?>
|
you just need to search it...
this was posted a long time ago on reverse engineering section...
credit goes to the people who upload this,
i just forget who he was... its been a long time
gudluck |