Skip to content

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.

Notifications You must be signed in to change notification settings

Presktok/Access_shield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

image# ACCESS SHIELD: Enhanced Webcam Security Authentication System

Project Title: Webcam Security Authentication System

Overview

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.

Key Features

  • 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.

GUI Enhancements

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.

Current GUI Snapshot

![Login Screen]-Uploading image.png…

Libraries Used

  • 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.

Code Breakdown

Constants

  • CORRECT_USERNAME and CORRECT_PASSWORD: Store the correct login credentials (currently hardcoded for simplicity).
  • lock_cursor_flag: A boolean flag to manage the cursor locking mechanism.

Functions

  • authenticate(): Validates user credentials. On success, it unlocks the cursor and terminates the application. On failure, it locks the cursor and triggers capture_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 the lock_cursor_flag.

GUI Setup

  • 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.

Main Loop

The root.mainloop() function ensures the GUI remains active and responsive to user interactions.

Usage

  1. Run the script using Python.
  2. Enter the correct username and password to gain access.
  3. Incorrect credentials will activate the cursor lock and capture a photo of the user.

Installation

To run this application, ensure you have the following libraries installed:

pip install opencv-python
pip install pyautogui
pip install pillow

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages