shlhom
Protection library for Python tools - with server-side time verification and AES-GCM encrypted cache.
مكتبة Python لحماية الأدوات - بتحقق زمني من السيرفر وتشفير AES-GCM للكاش.
Why shlhom?
You want to protect your Python tool with an expiry date - but users always find ways to bypass local checks:
- Changing the system clock
- Editing the source code
- Monkey-patching functions
- Copying the tool to another machine
shlhom solves this by sending a verification request to a remote server that you control.
Features
| Feature | Description |
|---|---|
| Server Verification | Every check sends a request to your server |
| Time Tamper Detection | Detects if the system clock is off by more than 5 minutes |
| AES-GCM Cache | Local encrypted cache (12h) bound to device |
| Anti-Tamper | Detects if shlhom.py is modified |
| Fallback Mode | Works offline using encrypted cache |
| Zero Config | No set_config, no API keys, no user input |
Installation
pip install shlhom
Quick Start
Just one line at the top of your tool:
import shlhom
shlhom.check("2027-06-09")
# your code here
print("Tool is running")
That is it. No configuration, no keys.
How It Works
- When you call check(), shlhom runs local integrity checks
- Sends a POST /check_device request to the server
- Server compares your local time with real time:
- Drift over 5 minutes: reject (tampering detected)
- Date after expiry: reject (expired)
- Otherwise: OK
- If server is unreachable, shlhom falls back to encrypted cache (12 hours)
API Reference
check(expiry_date, exit_on_fail=True, show_info=True)
Main verification function.
shlhom.check("2027-06-09")
Parameters:
- expiry_date (str): Date in YYYY-MM-DD format
- exit_on_fail (bool): Call sys.exit(1) on failure (default True)
- show_info (bool): Print status messages (default True)
lock(expiry_date, **kwargs)
Alias for check().
shlhom.lock("2027-06-09")
get_device_id()
Returns a 32-character device fingerprint.
device = shlhom.get_device_id()
print(device) # 5b4625d8d3bfbf4ea50ef92df9bd09be
get_real_time()
Returns the real timestamp from a public time source.
ts = shlhom.get_real_time()
print(ts) # 1790182086.0
verify_server(expiry_date)
Directly contacts the server (bypasses local checks).
result = shlhom.verify_server("2027-06-09")
print(result)
Use Cases
1. Tool with Expiry Date
import shlhom
shlhom.check("2027-06-09")
# your tool
2. Silent Check
import shlhom
shlhom.check("2027-06-09", show_info=False)
3. Graceful Failure
import shlhom
if shlhom.check("2027-06-09", exit_on_fail=False):
print("Access granted")
else:
print("Access denied")
Security
| Attack | Protection |
|---|---|
| Changing system clock | Server detects drift over 5 min |
| Editing shlhom.py | Anti-Tamper detects modification |
| Copying cache to another device | Cache is bound to device fingerprint |
| Monkey-patching functions | Integrity check on every call |
| Modifying cache | AES-GCM authentication fails |
| Brute-forcing cache | AES-256 - infeasible |
Requirements
- Python 3.7 or higher
- requests 2.25.0 or higher
- pycryptodome 3.10.0 or higher
License
MIT (c) shlhom
Support
- Telegram: @Fp_h9
- Email: adojod1231@gmail.com
Made with care for developers who want to protect their work.
Release files for shlhom 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shlhom-3.0.1.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shlhom-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / shlhom-3.0.1.tar.gz
| Download URL | shlhom-3.0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93095e40126df3bc7585e6b7eaffdc52d24fe0bd8829b5855fc18cbc01e0aad7
|
|
BLAKE2b-256 checksum How to use checksums |
248738024de75351562c2624e05c84f5a029904c1d084be12244b7f6b7d8dc31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / shlhom-3.0.1-py3-none-any.whl
| Download URL | shlhom-3.0.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa05eac0098c21ffdc4f037825f0d39e9e0aff6384e38f75e1e33ed139339c02
|
|
BLAKE2b-256 checksum How to use checksums |
57a86e1e47dc09752470cb4f4284b30ffb514f37fe74a3101f833bd42633019e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|