A Python tool that cracks Android pattern lock hashes by brute-forcing all possible pattern combinations and comparing their SHA1 hashes.
- Brute-force cracking of Android pattern lock hashes
- Pattern generation with SHA1 hashes for all possible combinations
- Support for pattern lengths 4-9 (default: all lengths)
- Verbose output showing all tested patterns
- File output for cracked patterns and generated databases
- Python 3 — Download Python 3
- ADB (Android Debug Bridge) — Download Android SDK Platform Tools
No external Python packages required.
git clone https://github.com/mi5t4n/AndroidPatternCracker.git
cd AndroidPatternCrackerCrack a pattern file:
python3 android_pattern_cracker.py --mode crack --file Pattern_Files/gesture_0.keyCrack using hash directly:
python3 android_pattern_cracker.py --mode crack --hash 70d61edf47d85aaf53e089eafc74de0094754cc6Usage: android_pattern_cracker.py [-h] --mode {crack,generate}
[--length {4,5,6,7,8,9}] [--file FILE]
[--hash HASH] [--write WRITE] [--verbose]
Options:
--mode {crack,generate}: Required. Select operation mode--length {4,5,6,7,8,9}: Pattern length (default: all lengths 4-9)--file FILE: Path to gesture.key file--hash HASH: SHA1 hash of the pattern--write WRITE: Output file (default: 'output')--verbose: Show all tested patterns
The Android pattern lock uses a 3x3 grid of dots (0-8). Users draw a sequence connecting at least 4 dots. The pattern is stored as a SHA1 hash of the byte sequence.
Grid layout:
0 | 1 | 2
3 | 4 | 5
6 | 7 | 8
Example: Pattern 0→4→8→5→2 becomes bytes \x00\x04\x08\x05\x02 → SHA1 hash 70d61edf47d85aaf53e089eafc74de0094754cc6
The SHA1 hash is stored in /data/system/gesture.key. To retrieve it:
- Enable developer mode and USB debugging
- Connect phone to computer
- Use ADB (Android Debug Bridge):
adb pull /data/system/gesture.keyNote: Root access required.
pc@user:~/AndroidPatternCracker$ ./android_pattern_cracker.py --mode crack --file Pattern_Files/gesture_0.key
[+] Opening pattern file (Pattern_Files/gesture_0.key) to read.
[+] Pattern = 70d61edf47d85aaf53e089eafc74de0094754cc6
[+] Closed pattern file (Pattern_Files/gesture_0.key)
[+] Searching patterns of size = 3
[+] Finished searching patterns of size = 3
[+] Searching patterns of size = 4
[+] Finished searching patterns of size = 4
[+] Searching patterns of size = 5
[!] Sucessfully cracked !!! The pattern is 04852
[!] Pattern and Hex of the pattern are written to file successfully.MIT License (see LICENSE.txt)
This tool is for educational purposes only. Unauthorized access to devices is illegal. Use only on devices you own or have permission to test.
