
Security News
New CNA Scorecard Tool Ranks CVE Data Quality Across the Ecosystem
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
1.6.4 - A Python library for managing user sessions with password protection, expiration, and persistent storage. Ideal for web applications and CLI tools. Supports session locking, unlocking, and time-based expiration. Compatible with Flask and Django. Includes a command-line interface for easy session management. Features include session creation, deletion, listing, and restoration. Provides secure session handling with hashing and encryption.
# Session Manager
Een krachtige en uitbreidbare Python-module voor het beheren, beveiligen en opslaan van sessies in JSON, CSV, SQLite of PostgreSQL formaten. Ideaal voor toepassingen die tijdelijke of beveiligde gebruikerssessies vereisen.
---
## 📦 Inhoud
- [Beschrijving](#beschrijving)
- [Installatie](#installatie)
- [Gebruik](#gebruik)
- [SessionManager](#sessionmanager)
- [SessionStoring](#sessionstoring)
- [Bestandsopslag](#bestandsopslag)
- [Voorbeelden](#voorbeelden)
- [Structuur van een sessie](#structuur-van-een-sessie)
- [Berichten en logging](#berichten-en-logging)
- [Extensies](#extensies)
---
## 📘 Beschrijving
De `SessionManager` beheert gebruikerssessies met functies zoals:
- Automatisch verlopen van sessies
- Wachtwoordbeveiligde sessies
- Exporteren en importeren naar JSON, CSV, SQLite of PostgreSQL
- Sessies ontgrendelen / vergrendelen
- Logging van fouten en successen
De `SessionStoring` klasse biedt methodes om sessies op te slaan of te laden in diverse formaten.
---
## 🛠️ Installatie
Installeer afhankelijkheden met pip:
```bash
pip install psycopg2
Zorg ervoor dat de volgende modules beschikbaar zijn in je project:
pysessionmanager.codes
voor SessionMessages
security.py
met:
generate_session_id()
hash_password()
verify_password()
utils.py
met:
get_default_unick_name()
manager = SessionManager("my_app", protect=True, auto_renew=True)
session_id = manager.create(
unick_name="user1",
duration_seconds=3600,
value="some data",
password="secure123"
)
manager.lock(session_id, "newpassword")
manager.unlock("user1", "newpassword")
session_data = manager.get(session_id)
active, removed, protected = manager.get_all()
store = SessionStoring()
store.store_sessions_json(manager.sessions, "backup.json")
loaded = store.load_sessions_csv("sessions.csv")
store.store_sessions_json(manager.sessions, "data.json")
store.store_sessions_csv(manager.sessions, "data.csv")
store.store_sessions_sqlite("sessions.db", manager.sessions)
store.store_sessions_postgresql(sessions=manager.sessions, conn_string="dbname=test user=postgres")
{
"session_id_123": {
"unick_name": "john_doe",
"start_time": "2025-06-12T12:00:00",
"end_time": "2025-06-12T13:00:00",
"protected": true,
"password": "<hashed_password>",
"value": "extra data"
}
}
De module gebruikt SessionMessages
voor gestandaardiseerde fout- en succesmeldingen, en logging
om informatie te loggen.
Voorbeeld logstructuur:
manager.logs = {
"errors": ["Fout bij sessie"],
"successful": ["Sessie succesvol aangemaakt"],
"debug": ["IS_ACTIVE -- session_id"]
}
manager = SessionManager("test_app")
session_id = manager.create(unick_name="anon")
manager = SessionManager("secure_app", protect=True)
session_id = manager.create(unick_name="admin", password="supersecret")
session_id = manager.get_with_unick_name("admin")
value = manager.get_value(session_id)
remaining = manager.get_time_remaining(session_id)
elapsed = manager.time_passed(session_id)
MIT License © 2025 – Ontwikkeld door [Ahmad Al Dibo]
FAQs
1.6.4 - A Python library for managing user sessions with password protection, expiration, and persistent storage. Ideal for web applications and CLI tools. Supports session locking, unlocking, and time-based expiration. Compatible with Flask and Django. Includes a command-line interface for easy session management. Features include session creation, deletion, listing, and restoration. Provides secure session handling with hashing and encryption.
We found that pysessionmanager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.