5,600,053 Members 42,522 Now Online
XDA Developers Android and Mobile Development Forum

[S4][Hack][Root] SIM Unlock for FREE

Tip us?
 
ascot17
Old
(Last edited by ascot17; 6th November 2012 at 11:42 AM.) Reason: Added note about CM10 ROMs
#1  
ascot17's Avatar
Senior Member - OP
Thanks Meter 416
Posts: 522
Join Date: Dec 2006

 
DONATE TO ME
Default [S4][Hack][Root] SIM Unlock for FREE

Background:

The HTC Sensation has a sim unlock code on /dev/block/mmcblk0p6.
This was found and exploited months ago by Sensation users.
For the One S, HTC have decided to get a bit sneaky. The code still exists on the same block but they have encrypted the actual SIM unlock code by adding a key generated from the phone’s IMEI number.
This method uses the IMEI number to calculate the key which can then be subtracted to give a working SIM unlock code.

Thanks to contributions from various users, we now have 3 different methods of obtaining your SIM unlock code.
All are tested and confirmed to work on all versions of the HTC One S.

Method 1 (details below) requires no downloads and takes about 5 minutes.
Method 2 uses the first step of method 1 and then a small executable program on a Windows PC to do the calculation.
Method 3 requires the download of a Bash Script but fully automates the procedure.

Note 1: All methods require Root and only work at present for the S4 version.

Note 2: It is possible that the 'strings' command referred to in the text will only work if you have Busybox installed. If you are already using a custom ROM, you will probably have this. If you are on a rooted Stock ROM and cannot execute the strings command, try installing Busybox first.
Any feedback on this issue would be welcomed in the thread.

Note 3: CM10 based ROMS will normally return the correct values for UN_Lock_code, but fail to unlock when a new SIM card is inserted. If you have this problem, revert to a Sense-based ROM (e.g Trickdroid, Venom) for the unlock process. You may return to a CM10 base after the phone is unlocked.

Methods 2 and 3 can be found in Post 2.

METHOD 1

To find your SIM UNLOCK CODE you need:

1) Root
2) Android Terminal Emulator (free from the market)
3) Your IMEI number (dial *#06# on your dialler)

There are 4 steps to the process:

1) Obtain your UN_lock_code from your phone
2) Calculate the key from your IMEI number
3) Subtract (2) from (1)
4) Unlock your phone

Step 1

Obtain your UN_lock_code from your phone as follows:

Open the Terminal Emulator app and type:

su [enter]
strings -n 8 /dev/block/mmcblk0p6 [enter]

It will output several lines of data (including your IMEI number)
One of the lines will be [eg] UN_Lock_code=063312345

Make a note of this number (This is NOT your SIM unlock code)!

Step 2

Make a key from your IMEI number:

a) Write down the last 7 digits of your IMEI number in this format: 1234 567

b) Reverse the 2 blocks: 567 1234

c) Add a 4th digit X: 567 X 1234 where:

X = the sum of the first 3 digits (If the sum is 2 digits, write only the 2nd digit)

[5 + 6 + 7 = 18 in the example above so X = 8]

[if the sum is 3, X = 3]
[if the sum is 17, X = 7]
[if the sum is 25, X = 5] etc.

Using the above IMEI number we get:

567 8 1234 (= the key)

Step 3

Perform a simple sum.

UN_Lock_code [step 1] – key [step 2] = SIM UNLOCK CODE

e.g. 063312345 - 56781234 = 6 531 111

This needs to be an 8-digit number, so add a zero at the beginning if necessary

YOUR SIM UNLOCK CODE IS: 0653 1111

Step 4

Unlock your phone

a) Remove your SIM card (no need to turn off the phone)
b) Insert alternate SIM card
c) When prompted, enter SIM UNLOCK CODE obtained from step 3
d) Reboot when instructed
Device: HTC One S SIM Unlocked for free!
Facepalm S-OFF
ROM: Viper 3.1.2
Radio: 1.20
Recovery: TWRP 2.6.3.0
The Following 231 Users Say Thank You to ascot17 For This Useful Post: [ Click to Expand ]
 
ascot17
Old
(Last edited by ascot17; 11th August 2012 at 05:16 PM.) Reason: Added Bash Script method
#2  
ascot17's Avatar
Senior Member - OP
Thanks Meter 416
Posts: 522
Join Date: Dec 2006

 
DONATE TO ME
Please hit the thanks button!


METHOD 2 - Semi Automatic

Windows PC.

For this method follow step (1) from the above post to obtain your UN_Lock code

You can then download this app which will automate the calculation process.



Enter your UN_Lock code and the last 7 digits of your IMEI number and press the 'OK' button.
Your SIM Unlock code will be shown in the bottom box.


METHOD 3 - Fully Automatic

a) Download this Bash Script
b) Extract the zip
c) Move the unlock.sh to /system/ (it will not run from the sdcard due to Android restrictions)
d) Open terminal and run:

su <enter>
/system/unlock.sh <enter>

(Or execute the .sh file directly from root explorer)

The SIM Unlock code will be shown in the terminal and also saved to /sdcard/sim_unlock_code.txt

Credits

This is not all my own work!
Several people have contributed to this thread. If you appreciate their work, please hit the thanks button in their posts as well.

Method 1

Thank you to jh787 for this post. He was the first guy to compare the UN_Lock_code to his real (paid-for) sim unlock code.
I just tweaked the idea to find the mysterious X (and provided this guide).
Thanks also to jh787, mycomputerisjunk, rh387 and eneka who provided me with their actual unlock codes.
This allowed me to work out how to calculate the key and validate the method.

Method 2

Many thanks to Josnaro for the code and Wel1973 for the translation (this post).

Method 3

Bash script courtesy of WCCobra in this post
Device: HTC One S SIM Unlocked for free!
Facepalm S-OFF
ROM: Viper 3.1.2
Radio: 1.20
Recovery: TWRP 2.6.3.0
The Following 87 Users Say Thank You to ascot17 For This Useful Post: [ Click to Expand ]
 
encho
Old
#3  
Senior Member
Thanks Meter 153
Posts: 588
Join Date: Jul 2010
Do I have to go back to stock for this?

Sent from my HTC One S using xda premium
The Following 2 Users Say Thank You to encho For This Useful Post: [ Click to Expand ]
 
ascot17
Old
#4  
ascot17's Avatar
Senior Member - OP
Thanks Meter 416
Posts: 522
Join Date: Dec 2006

 
DONATE TO ME
Quote:
Originally Posted by encho View Post
Do I have to go back to stock for this?
No need - no
Device: HTC One S SIM Unlocked for free!
Facepalm S-OFF
ROM: Viper 3.1.2
Radio: 1.20
Recovery: TWRP 2.6.3.0
The Following 2 Users Say Thank You to ascot17 For This Useful Post: [ Click to Expand ]
 
rawtek
Old
#5  
Member
Thanks Meter 26
Posts: 83
Join Date: Oct 2008
Location: Miami
Will report back..
The Following User Says Thank You to rawtek For This Useful Post: [ Click to Expand ]
 
iHarkunwar
Old
(Last edited by iHarkunwar; 6th June 2012 at 01:29 PM.)
#6  
iHarkunwar's Avatar
Senior Member
Thanks Meter 83
Posts: 366
Join Date: Mar 2012
Location: Amritsar

 
DONATE TO ME
Will Be Really Thankful To You If You Do This Properly.
I am Getting a HTC One S From Canada and I would Need to Unlock It After I Get It
Thanks In Advance !!
Also Pressed It !!

I wrote an Easy Guide On My Blog
http://www.freshnewsarea.com/?p=1411
Nexus 4 16 GB
HTC Inspire 4G - Latest Android 4.2 Codefirex Jelly Bean Nightly
Nexus 7 32 GB - Latest 4.2.1 based Modaco ROM
Support me on my blog - uGeeKy and Fresh News Area - 15 year old guy always ready to help
Don't forget to press the THANKS button
The Following User Says Thank You to iHarkunwar For This Useful Post: [ Click to Expand ]
 
ahmadroid
Old
#7  
ahmadroid's Avatar
Junior Member
Thanks Meter 5
Posts: 16
Join Date: Jan 2010
Location: Kansas city

 
DONATE TO ME
I want to try it so please guide me

Sent from my HTC VLE_U using xda premium
The Following User Says Thank You to ahmadroid For This Useful Post: [ Click to Expand ]
 
dajones123
Old
#8  
Senior Member
Thanks Meter 5
Posts: 111
Join Date: Aug 2009
Reading the first post would start, I've sent my details hope it works

Sent from my HTC One S using Tapatalk 2
 
juanporrero
Old
#9  
Junior Member
Thanks Meter 2
Posts: 23
Join Date: Sep 2010
You want try the same process of Htc Sensation?
 
Toṭ̣̣
Old
#10  
Account currently disabled
Thanks Meter 131
Posts: 896
Join Date: Oct 2011
Location: Palermo
Quote:
Originally Posted by ahmadroid View Post
I want to try it so please guide me

Sent from my HTC VLE_U using xda premium
Read the op!

The Following User Says Thank You to Toṭ̣̣ For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes