A Python module that executes a callback script if a password is not entered within a specified time interval
Project description
Failsafe
A Python module that executes a callback script if a password is not entered within a specified time interval. This security feature acts as a failsafe mechanism to protect sensitive systems and data.
Features
- Configurable timeout period
- Thread-based asynchronous execution
- Customizable callback script
- Password verification system
- Logging functionality
Requirements
- Python 3.6 or higher
- No external dependencies required
Files
failsafe.py: Core module implementing the failsafe timer functionalityexample.py: Example implementation showing how to use the failsafe modulecallback_script.py: Example callback script that logs failsafe trigger events
Installation
No installation required. Simply copy the files to your project directory.
Usage
- Import the FailSafe class:
from failsafe import FailSafe
- Create a failsafe timer instance:
timer = FailSafe(timeout_seconds=300, callback_script='your_callback_script.py')
- Start the failsafe timer:
timer.start()
- Update the timer when correct password is entered:
timer.update_password_time()
- Stop the failsafe timer when done:
timer.stop()
Example
from failsafe import FailSafe
# Create failsafe timer with 5 minutes timeout
timer = FailSafe(timeout_seconds=300, callback_script='callback_script.py')
timer.start()
# Get password input
password = input("Enter password: ")
if password == "correct_password":
timer.update_password_time()
Callback Script
The failsafe callback script is executed when the password timeout occurs. You can customize the callback script to perform various security actions such as:
- System logout
- Screen lock
- Send security notifications
- Log security events
- Execute emergency security measures
Example failsafe callback script:
from datetime import datetime
def main():
log_file = "failsafe_timeout.log"
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
with open(log_file, "a") as f:
f.write(f"[{current_time}] Failsafe callback script executed due to password timeout.\n")
if __name__ == "__main__":
main()
Security Considerations
- Implement proper password validation in your application
- Secure the failsafe callback script to prevent unauthorized access
- Consider encrypting sensitive data in logs
- Implement appropriate error handling
- Use secure methods for password storage and verification
- Regularly test the failsafe mechanism to ensure it works as expected
Contributing
Feel free to submit issues and enhancement requests to improve the failsafe mechanism.
License
This project is open source and available under the MIT License.
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 failsafe-0.1.0.tar.gz.
File metadata
- Download URL: failsafe-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
743807e9e84df8dcb7b9f7bb89228b2e10a075c347b023e007d791b9c6cf824a
|
|
| MD5 |
a7b231ed8acad819318d437d25d8a359
|
|
| BLAKE2b-256 |
84e5861a28b10ed1057fc0673c9a52f6ba0ce7a03a7238bc089e1831f24786cc
|
File details
Details for the file failsafe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: failsafe-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edec511bcf6862de13f947f6660f3e7b5e12e163887f6c51c7670ff0d1056fd5
|
|
| MD5 |
d07620bef5e809f62bd1817140ebb6b5
|
|
| BLAKE2b-256 |
c9942810e0c76adca160fa44ef800e0d9ebc7421cec25521b1c062b20641655b
|