Giter VIP home page Giter VIP logo

elmsec / lockigest Goto Github PK

View Code? Open in Web Editor NEW
88.0 3.0 7.0 18 KB

πŸ” Lockigest – Why would you have to enter a password to unlock your screen countless times a day? Lockigest is a simple idea that solves this. It will lock your screen only if a predefined pattern is not followed within a certain time.

Home Page: https://elma.dev/work/lockigest/

License: GNU General Public License v3.0

Shell 100.00%
security linux security-tools screen-locker terminal bash

lockigest's Introduction

πŸ” Lockigest

Lockigest is a very primitive, manipulative security software that sets a trap instead of locking your device screen immediately to protect it from strangers.

Read more:

Configuration

These two lines of code are enough to set up your Lockigest:

...
wait_time=120
countdown=5
...

The first one is the time, in seconds, that must pass before starting protection mode (setting a trap).

The second variable is a countdown that will be trigged when protection mode is activated. Locks the screen when it reaches zero. If the user moves the cursor to the predefined area, this countdown stops and disables the protection mode.

Run

./lockigest.sh 

Soon I will add a systemd service unit to run Lockigest in the background at startup.

lockigest's People

Contributors

elmsec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lockigest's Issues

Code modification (porting to Windows)

Hello. The code is good, and I thought that it could also be ported to the Windows platform. Here is the code I created using OpenAI, it would be great to have protection not only on Linux systems.

As a modification, I added a function that tracks the keyboard (let's say we play the game exclusively on the keyboard). This allows you to reduce the number of unnecessary actions.

I didn’t create my own repository/code (I’m new to this environment, I have no idea how or what’s going on here)
so I think you should have this in your repository.

import time
import pyautogui
from plyer import notification
import threading
from pynput import keyboard
program_name = "Lockigest"
wait_time = 25
countdown = 25
X, Y = 0, 0
PML_X, PML_Y = 0, 0
counter = 0
protection = 0
keyboard_active = True
mouse_active = True
key_count = 0

PML_keyboard = 0


def toggle_protection(status):
    global protection
    protection = status
    if status == 1:
        print("\t Protection mode was activated.")
    else:
        print("\t Protection mode was deactivated.")

def lock_screen():
    # Lock the screen (this is platform-dependent)
    import ctypes
    ctypes.windll.user32.LockWorkStation()

def on_press(key):
    
    global keyboard_active, key_count
    keyboard_active = True
    key_count += 1

def monitor_mouse():
    global X, Y, PML_X, PML_Y, counter, protection, keyboard_active, mouse_active, key_count, PML_keyboard
    while True:
        time.sleep(0.2)
        X, Y = pyautogui.position()
        
        if mouse_active or keyboard_active:
            mouse_active = False
            keyboard_active = False
            counter = 0
            continue

        if  (X != PML_X or Y != PML_Y) or (key_count != PML_keyboard):
            PML_X, PML_Y = X, Y
            PML_keyboard = key_count
            counter   = 0
            if protection == 1:
                while counter != countdown:
                    time.sleep(0.2)
                    X, Y = pyautogui.position()
                    counter += 1
                    print(f"({counter}/{countdown})\t Move your cursor to the specified area.")
                    if ((Y == 0)):
                        toggle_protection(0)
                        key_count = 0
                        break
                if protection == 1:
                    print("\t\t The device was locked.")
                    toggle_protection(0)
                    key_count = 0
                    lock_screen()
        else:
            counter += 1
            keyboard_active = False
            print(f"({counter}/{wait_time})\t The cursor is inactive. X: {X} Y: {Y}")
            
            if counter >= wait_time and protection == 0:
                toggle_protection(1)

def start_key_listener():
    with keyboard.Listener(on_press=on_press) as listener:
        listener.join()
if __name__ == "__main__":
    key_listener_thread = threading.Thread(target=start_key_listener, daemon=True)
    key_listener_thread.start()
    monitor_mouse()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.