From 1635c68adef572f8e4d9405c964e953ea81b1fb1 Mon Sep 17 00:00:00 2001 From: Sebastian Lenzlinger <74497638+sebaschi@users.noreply.github.com> Date: Thu, 8 Jun 2023 13:26:49 +0200 Subject: [PATCH] Add platform check (must be Linux). --- src/keylogger_detector.py | 4 +++- src/utils.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/keylogger_detector.py b/src/keylogger_detector.py index 0d6de50..26aac6f 100755 --- a/src/keylogger_detector.py +++ b/src/keylogger_detector.py @@ -3,6 +3,7 @@ import sys from config import CONFIG_FILE, load_config, save_config from utils import ( + check_platform, check_root, check_packages, get_keyboard_device_files, @@ -113,8 +114,9 @@ def detect_keyloggers(): # 1. Setup and initialization ############################ debug(True, str(sys.argv)) # Set manually to debug if args are being read + check_platform() + global auto_kill_option, verbose_option, safe_option - global CONFIG_FILE set_input_options() if verbose_option: print('[Verbose] Input options set') diff --git a/src/utils.py b/src/utils.py index 65db448..acd94e8 100755 --- a/src/utils.py +++ b/src/utils.py @@ -3,6 +3,20 @@ import subprocess # for executing shell commands import signal # for sending signals to processes import sys # for exit + + + +def check_platform(): + """ + Check if platform is Linux. + + Raises: + SystemExit: If the platform isn not LInux. + """ + if sys.platform != 'linux': + print("[-] This script only works on Linux.") + + def check_root(): """ Check if script is run as root(sudo).