# ACCESS SHIELD: Enhanced Webcam Security Authentication System
This Python application provides a robust security authentication system with a modern graphical user interface (GUI). It is designed to enhance security by capturing a photo of unauthorized users and locking the mouse cursor if incorrect credentials are entered, preventing further interaction.
The application leverages the power of:
- OpenCV: For seamless webcam access and image capture.
- Tkinter: For creating an intuitive and responsive GUI.
- PyAutoGUI: For precise control over the mouse cursor, enabling the locking mechanism.
- Pillow (PIL): For efficient handling and display of background images.
- User Authentication: Secure username and password validation.
- Unauthorized Access Capture: Automatic webcam photo capture on failed login attempts.
- Cursor Locking Mechanism: Prevents user interaction upon incorrect credential entry, enhancing security.
- Fullscreen Interface: An immersive GUI experience with a customizable background image.
- Graceful Exit: Allows users to quit the application via a confirmation dialog.
The login interface has been professionally refined to provide a better user experience:
- Clear Title: A prominent "Login" title for immediate recognition.
- Styled Login Box: A visually appealing black frame with a distinct ridge border.
- Enhanced Input Fields: Username and password entry fields feature a sunken relief and borders for clarity.
- Prominent Login Button: A blue-themed "Login" button with white text, raised relief, and a border for improved visibility and interactivity.
![Login Screen]-Uploading image.png…
- OpenCV (cv2): For capturing images from the webcam.
- Tkinter: Python's standard library for creating GUIs.
- Threading: To execute background tasks without impeding GUI responsiveness.
- PyAutoGUI: For programmatic control of the mouse cursor.
- PIL (Pillow): For handling and displaying images within the GUI.
CORRECT_USERNAMEandCORRECT_PASSWORD: Store the correct login credentials (currently hardcoded for simplicity).lock_cursor_flag: A boolean flag to manage the cursor locking mechanism.
authenticate(): Validates user credentials. On success, it unlocks the cursor and terminates the application. On failure, it locks the cursor and triggerscapture_photo().capture_photo(): Initializes the webcam, captures a photo after a brief delay, and saves it as "unauthorized_access.jpg". Includes robust error handling for webcam access.lock_cursor(): Secures the cursor at the screen's center, running in a separate thread to maintain GUI responsiveness.unlock_cursor(): Releases the cursor by resetting thelock_cursor_flag.
- Initializes a fullscreen Tkinter window titled "Shield."
- Implements a protocol to prevent unauthorized application closure, requiring a confirmation for exit.
- Loads and scales a background image to fit the screen.
- Constructs a central, styled login box containing input fields for username and password, and a login button.
The root.mainloop() function ensures the GUI remains active and responsive to user interactions.
- Run the script using Python.
- Enter the correct username and password to gain access.
- Incorrect credentials will activate the cursor lock and capture a photo of the user.
To run this application, ensure you have the following libraries installed:
pip install opencv-python
pip install pyautogui
pip install pillowThis project is licensed under the MIT License - see the LICENSE file for details.