Monday, January 23, 2012

Code Wars: PHP vs Ruby vs Python – Who Reigns Supreme




Sunday, January 22, 2012

春節快樂~

春節快樂, 恭喜發財, 紅包拿來!

新的一年的目標:
1, 5個Android的APP放到market上
2, 讀6本小說
3, 改進我弱弱的英文.
4, 不能說的秘密 >.<

Sunday, January 15, 2012

Crack android screen lock and "factory data reset" lock

After you set a screen lock on your android phone, whether “pattern lock” or "password lock". You will be required to type password or draw a pattern to login your phone, or make a “factory data reset” the phone.

Sometimes, you might forget the password, especially you drew a strange pattern lock... lol....
Here's a simple solutions to remove the lock: enter bootloader mode -> reset the phone. But this behavior will also remove your pictures, docs in your phone. You could pull the SD card out, but some phones owns a internal storage only, such as Galaxy S, Galaxy Nexus. And not all information you'd like to copy out is located on the SD card.
So, in some cases, you have to break the screen lock! You must save your data.

If your "ADB Debug" is ON, you have the chance to do it!


Don't know programming? Get the APK and instructions here:
http://blog.thisisfeifan.com/2012/05/screen-unlock-apk-coming.html




# Tech. Detail
Actually very simple code I used to crack the screen lock and "factory reset lock".

1, crack android screen lock
requirement:
- ADB debug enabled
core code is just in 3 lines!
   1: KeyguardManager keyguardManager = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);  
   2: KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("");  
   3: keyguardLock.disableKeyguard();

Don’t forget add permission in <AndroidManifest.xml>

   1: <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission> 

reference:
http://developer.android.com/reference/android/app/KeyguardManager.KeyguardLock.html

public void disableKeyguard ()

Since: API Level 1
Disable the keyguard from showing. If the keyguard is currently showing, hide it.

So, the screen lock is so easy to skip, your private content is not safety while the ADB debugging is ON. you guys should know there's a famous guy "Edison Chen" in Hong Kong ha (http://en.wikipedia.org/wiki/Edison_Chen).





 
2, crack "factory data reset" lock
You can make a factory reset in Bootloader mode too.
requirement:
- ADB debug enabled
- Android 2.2 and above
there’s a new class “DevicePolicyManager” since Android 2.2

   1: mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
   2: mDeviceAdminSample = new ComponentName(this, XXXXX.class);
   3:  
   4: Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
   5: intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminSample);
   6: intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
   7:         "Additional text explaining why this needs to be added.");
   8: startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN);

and you should have permission in “Androidmanifest.xml”

   1: android:permission="android.permission.BIND_DEVICE_ADMIN"

reference:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html
http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html

OK, you guys saw that , after invoked a "Device Policy", you can simply skip the "factory data reset" lock ha. useless lock....



Sunday, January 1, 2012