Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Pattern Cracker

A Python tool that cracks Android pattern lock hashes by brute-forcing all possible pattern combinations and comparing their SHA1 hashes.

Features

  • 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

Requirements

No external Python packages required.

Installation

git clone https://github.com/mi5t4n/AndroidPatternCracker.git
cd AndroidPatternCracker

Quick Start

Crack a pattern file:

python3 android_pattern_cracker.py --mode crack --file Pattern_Files/gesture_0.key

Crack using hash directly:

python3 android_pattern_cracker.py --mode crack --hash 70d61edf47d85aaf53e089eafc74de0094754cc6

Demo

Android Pattern Cracker Demo

Detailed Usage

Usage: 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

How Android Pattern Works

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

Getting the Hash File

The SHA1 hash is stored in /data/system/gesture.key. To retrieve it:

  1. Enable developer mode and USB debugging
  2. Connect phone to computer
  3. Use ADB (Android Debug Bridge):
adb pull /data/system/gesture.key

Note: Root access required.

Sample Usage

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.

License

MIT License (see LICENSE.txt)

Disclaimer

This tool is for educational purposes only. Unauthorized access to devices is illegal. Use only on devices you own or have permission to test.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages