Jump to content

Recommended Posts

Posted (edited)

Ok, so I was browsing 00Z3 ROM and found that there is a method to check unlock code which can also be used to calculate unlock codes.

Cleaned up code with some comments is available here: http://pastebin.com/yy299wJZ

EDIT: I've also attached a simple implementation in Python so all paranoid people can now be really sure their imei is not going to be sent anywhere :(

EDIT2: Separate Python 2 and Python 3 versions.

EDIT3: Added php, ruby and java functions to archive.

blade_unlock.zip

Edited by MDCFan
Guest isambard
Posted
Ok, so I was browsing 00Z3 ROM and found that there is a method to check unlock code which can also be used to calculate unlock codes.

Cleaned up code with some comments is available here: http://pastebin.com/WZZ6Q7fe

EDIT: I've also attached a simple implementation in Python so all paranoid people can now be really sure their imei is not going to be sent anywhere :(

i got the same algorithm, but the hard way. where did you locate it in the rom?

Posted (edited)
i got the same algorithm, but the hard way. where did you locate it in the rom?

It was in com.android.phone.apk, Netlock class, although the code was somewhat less readable.

Edited by MDCFan
Guest isambard
Posted
It was in com.android.phone.apk, Netlock class, although the code was somewhat less readable.

more readable than mine! i reversed it from dalvik opcodes! :(

Posted (edited)
more readable than mine! i reversed it from dalvik opcodes! ;)

From same apk? :(

Edited by MDCFan
Guest isambard
Posted (edited)
From same apk? :(

edit: i've located it now also in the ZTE Blade ROM in the phone APK. the algorithm is there as plain as day. i wonder if all android phones are as easy to unlock? i'm surprised they located it so high in the phone.

Edited by isambard
  • 2 weeks later...
Guest nonamer123
Posted

I hope its okay to copy your algorithm to my own litte program? (first its only for me, for learning java :D)

And please help a noob like me ... I check the input for containing only digits and also having a length of 15, did i forgot something to check? Because in my program its possible to enter for example 222222222222222 as a "valid" imei ... but onlinegenerators throw me a "not valid imei" ... So how is a valid format for imei defined? :P

Posted
I check the input for containing only digits and also having a length of 15, did i forgot something to check? Because in my program its possible to enter for example 222222222222222 as a "valid" imei ... but onlinegenerators throw me a "not valid imei" ... So how is a valid format for imei defined? :D

http://en.wikipedia.org/wiki/International...ipment_Identity

Guest isambard
Posted (edited)
I hope its okay to copy your algorithm to my own litte program? (first its only for me, for learning java :D)

And please help a noob like me ... I check the input for containing only digits and also having a length of 15, did i forgot something to check? Because in my program its possible to enter for example 222222222222222 as a "valid" imei ... but onlinegenerators throw me a "not valid imei" ... So how is a valid format for imei defined? :P

second hit in google:

http://titus-herwin.blogspot.com/2009/08/m...i-checksum.html

Edited by isambard
Guest nonamer123
Posted

Thx for that ... Didn´t read the article carefully enough :D

So i will try to implement such a function in java :P

Really really thanks for such a fast help B)

Posted
I hope its okay to copy your algorithm to my own litte program? (first its only for me, for learning java :D)

I don't restrict anyone using provided code.

  • 4 months later...
Guest energy6uk
Posted
Ok, so I was browsing 00Z3 ROM and found that there is a method to check unlock code which can also be used to calculate unlock codes.

Cleaned up code with some comments is available here: http://pastebin.com/yy299wJZ

EDIT: I've also attached a simple implementation in Python so all paranoid people can now be really sure their imei is not going to be sent anywhere :P

EDIT2: Separate Python 2 and Python 3 versions.

Any chance you could do this in PHP?

  • 11 months later...
Guest am632
Posted

Hi, sorry to reply to such an old post but would it be possible to turn this into a batch file? I'm trying to learn as much as i can about phone unlocking but the only script im familiar with it autoit, and if i could see this as a working batch file it would help me understand how it works.

thnks

  • 2 weeks later...
Guest redhawkuk
Posted

Batch files doesn't have many options for manipulating numbers and strings so it wouldn't be possible.

While on the subject of script languages I've created a nck generator using mIRC script language. :)

/unlock {

if ($1 = $null) { echo -e IMEI is required | return }

if ($len($1) != 15) { echo -e IMEI not valid size | return }

var %nck

var %hash = $md5($1)

var %loop = 0

while (%loop < 16) {

var %n = $calc($replace($mid(%hash,$calc(%loop + 1),1),a,10,b,11,c,12,d,13,e,14,f,15) * 16)

%n = %n + $calc($replace($mid(%hash,$calc(%loop + 2),1),a,10,b,11,c,12,d,13,e,14,f,15))

%n = %n + $calc($replace($mid(%hash,$calc(%loop + 17),1),a,10,b,11,c,12,d,13,e,14,f,15) * 16)

%n = %n + $calc($replace($mid(%hash,$calc(%loop + 18),1),a,10,b,11,c,12,d,13,e,14,f,15))

%nck = %nck $+ $left($calc(($and(%n , 255)) * 9 / 255),1)

%loop = %loop + 2

}

echo -e IMEI = $1 $+ , NCK = %nck

}

Richard S.

Guest redhawkuk
Posted (edited)

The algorithm works something like this:

-convert IMEI number into md5 hash this generates 16 bytes written in hexadecimal.

-take the first 8 bytes and individually add them with the remaining sequence of 8 bytes.

-apply bitwise AND 255 to each result and then * 9 / 255 to generate your 8 byte NCK code.

Richard S.

Edited by redhawkuk

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.