This project is a Python-based user security system that allows users to securely store and manage personal information. The system encrypts user details, creates unique usernames, and stores them in a JSON file. Additionally, it ensures that no duplicate user data is stored.
The program collects personal information such as:
- Name
- Age
- Gender
- Grade
- Major
- Social account
If a user tries to create an account with an existing username, the system will automatically generate a unique username by appending a counter to the base username.
User information is encrypted for privacy, including social account usernames.
The information is securely stored in a JSON file (user_security_info.json
) for later retrieval and updates.
The system prevents storing duplicate information. If the same user details are entered, an error message is returned.
The system now uses SHA-256 for encryption, providing a higher level of security for user data.
- Added validation for user inputs such as name (only alphabetic characters) and age (must be between 0 and 120).
- Improved regex pattern to validate social account URLs more accurately.
- Delete User: Added functionality to delete user data securely.
- Search User: Users can now be searched based on keywords in their encrypted information.
- Update User: Improved user information update functionality with timestamp tracking.
- Added a backup feature to create a backup of the user data in a separate JSON file (
user_security_info_backup.json
).
- Implemented a logging mechanism to track all activities and errors, stored in
security.log
.
- Added unit tests to ensure the system's reliability and correctness. Tests cover encryption, input validation, and social account validation.
- Clone the repository or download the Python file.
- Ensure Python 3.x is installed on your system.
- You do not need to install any external libraries for this project, as it only uses the built-in
json
,datetime
, andre
libraries.
-
Run the Script: Execute the Python script in your terminal or preferred Python IDE.
-
Input User Information:
- The system will prompt you to enter personal details such as:
- Name
- Age
- Gender
- Grade
- Major
- Social Account
- The system will prompt you to enter personal details such as:
-
Unique Username Creation:
- You will be prompted to enter a desired username.
- If the username already exists, the system will automatically append a number (e.g.,
username_1
,username_2
, ...) to create a unique username.
-
Data Encryption:
- All personal information (including social account usernames) will be encrypted for security purposes before being stored.
-
Data Storage:
- Your encrypted user information will be stored in
user_security_info.json
. - The program checks for existing data, preventing duplicate entries.
- Your encrypted user information will be stored in
-
Error Handling:
- If the same user information is entered more than once, an error will be displayed indicating that the information already exists.
When you run the script, the following prompts will appear:
Enter your name: John Doe
Enter your age: 25
Enter your gender: Male
Enter your grade: A
Enter your major: Computer Science
Enter your social account: Facebook:www.facebook.com/johndoe
Enter a desired username: johndoe
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes with a descriptive message.
- Push your branch to your forked repository.
- Submit a pull request to the main repository.
Please ensure that your code adheres to the existing code style and includes relevant tests.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software, provided that you include the original license file in your distribution.
For more details, see the LICENSE file.