A tool for analyzing and brute-forcing HID 1K cards
Project description
HID1KBrute
RFID Card Analysis Toolkit
A comprehensive Python toolkit for analyzing RFID/HID card data and generating badge patterns. This toolkit consists of two main components: an RFID Card Analyzer for discovering facility codes and card number patterns, and a Badge Designer for generating hex data from known patterns.
Features
RFID Card Analyzer (py1kbrute)
- Pattern Discovery: Automatically discovers facility codes (FC) and card number (CN) patterns from hex data
- Multiple Card Analysis: Analyze multiple cards simultaneously to find consistent patterns
- Real-world Format Detection: Matches against known HID card formats with confidence scoring
- Interactive Mode: Browse and explore discovered patterns interactively
- Flexible Input: Support for command-line arguments or JSON file input
- Comprehensive Output: Detailed analysis with bit positions, window offsets, and pattern confidence
Badge Designer (py1encoder)
- Pattern-based Generation: Generate hex data using predefined or custom patterns
- HID Format Support: Built-in support for common HID formats (26-bit, 34-bit, 35-bit, etc.)
- Batch Generation: Generate multiple badges with sequential card numbers
- Custom Patterns: Create and test custom bit patterns
- Hex Padding: Configurable hex output padding for different reader requirements
- Interactive Design: Step-by-step badge creation with validation
Installation
- Clone the repository:
pip install hid1kbrute
- Ensure you have Python 3.6+ installed:
python3 --version
- No additional dependencies required - uses only Python standard library!
Quick Start
Analyzing Cards
Single Card Analysis:
py1kbrute -c 27bafc0864 12334
Multiple Cards:
py1kbrute -c 27bafc0864 12345 -c 1a2b3c4d5e 12345
With Known Facility Code:
py1kbrute --known-fc 1234 -c 27bafc0864 44444
Generating Badges
Interactive Mode:
py1kencoder -i
Generate Single Badge:
py1kencoder --pattern hid_26bit --fc 123 --cn 45678
Generate Badge Range:
py1kencoder --pattern hid_26bit --fc 123 --cn-range 1000 1010
Usage Examples
1. Discover Facility Code from Unknown Cards
# Analyze multiple cards to find the facility code
py1kbrute \
-c 27bafc0864 12345 "Alice's Card" \
-c 1a2b3c4d5e 12345 "Bob's Card" \
-c 3f4e5d6c7b 67890 "Charlie's Card"
2. Load Cards from JSON File
Create a cards.json file:
[
{
"hex_data": "27bafc0864",
"known_cn": 12243,
"name": "Alice's Card"
},
{
"hex_data": "1a2b3c4d5e",
"known_cn": 12345,
"name": "Bob's Card"
}
]
Then analyze:
py1kbrute --file cards.json
3. Generate Badges for New Employees
# Generate a range of badges for new employees
py1kencoder\
--pattern hid_26bit \
--fc 1234 \
--cn-range 50000 50010 \
--hex-padding 10
4. Interactive Pattern Discovery
# Start interactive mode for detailed analysis
py1kbrute -c 27bafc0864 12345 --no-interactive
5. Custom Pattern Creation
# Create badges with custom patterns
py1kencoder -i
# Then select option 2 for custom pattern creation
Command Line Options
RFID Analyzer (py1kbrute.py)
| Option | Description |
|---|---|
-c, --card |
Add card: HEX_DATA KNOWN_CN [NAME] |
-f, --file |
Load cards from JSON file |
--known-fc |
Search for specific facility code |
--min-bits |
Minimum bit window (default: 32) |
--max-bits |
Maximum bit window (default: 35) |
--max-candidates |
Maximum candidates to show (default: 5) |
--no-interactive |
Show all details immediately |
--no-color |
Disable colored output |
Badge Designer (py1kencoder.py)
| Option | Description |
|---|---|
-i, --interactive |
Interactive mode |
--fc |
Facility code |
--cn |
Card number |
--cn-range |
Card number range: START END |
--pattern |
Pattern name |
--list-patterns |
List available patterns |
--hex-padding |
Hex digits to pad to |
--show-binary |
Show binary representation |
--no-color |
Disable colored output |
Built-in Patterns
The Badge Designer includes these built-in patterns:
- HID 26-bit Standard: FC=8bits, CN=16bits
- HID 34-bit iCLASS: FC=10bits, CN=20bits
- HID 35-bit Corporate: FC=12bits, CN=20bits
Understanding the Output
Analyzer Output
When analyzing cards, you'll see:
FC 1234 - All Permutations
============================================================
Summary: 3 matches, 3 cards, 1 patterns
Matched Format: 26-bit Standard (+50 confidence)
Pattern #1:
Window: 26 bits at offset 5
FC: 8 bits at pos 1
CN: 16 bits at pos 9
Reversed: False
Cards: 3
Alice's Card: FC=10011001, CN=0111111010101011
Bob's Card: FC=10011001, CN=0011000000111001
Charlie's Card: FC=10011001, CN=1010010001101010
Badge Designer Output
When generating badges:
Generated badge:
FC=123, CN=45678, HEX=06F2372E0
Binary: FC=01111011, CN=1011001001001110
Common Issues
- No patterns found: Try expanding bit window range with
--min-bitsand--max-bits - Multiple candidates: Use
--known-fcto filter results - Hex padding issues: Ensure padding value accommodates your data length
Debug Tips
- Use
--show-binaryto see bit-level representations - Try
--no-interactivefor full output - Check that card numbers are correct in input data
Use Cases
- Security Research: Analyze badge systems and understand encoding
- Badge Administration: Generate new badges for existing systems
- System Migration: Understand old badge formats for new system setup
- Penetration Testing: Generate test badges for security assessments
- Badge Cloning: Understand card structure for duplication
Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
License
The MIT License (MIT)
Copyright © CmdPirx
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Disclaimer
This toolkit is intended for educational, research, and legitimate security testing purposes only. Users are responsible for ensuring compliance with all applicable laws and regulations. The authors assume no responsibility for misuse of this software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hid1kbrute-0.1.2.tar.gz.
File metadata
- Download URL: hid1kbrute-0.1.2.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a08c3bdc98e2c61b25ca4717d9f1dde079862db7593b8682db4ecda3b87179ea
|
|
| MD5 |
0a0aef59f500b20578837acbf3e48b61
|
|
| BLAKE2b-256 |
c9dbb7bbbfcc23ab0fd6c5f46eb45133e14f48eb757b3d757bd2a91e822eb731
|
File details
Details for the file hid1kbrute-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hid1kbrute-0.1.2-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e60c609bb94f85fa75608d92617640397473bb97907b9c0ef197448a99e90376
|
|
| MD5 |
2b99e86147699f2075c73f6851160970
|
|
| BLAKE2b-256 |
203e07c8dc51f51a2bfe256e79f444831176f8cf621b7b57b70594912af9cf31
|