Add platform check (must be Linux).

This commit is contained in:
Sebastian Lenzlinger 2023-06-08 13:26:49 +02:00
parent 94cb159a49
commit 1635c68ade
2 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import sys import sys
from config import CONFIG_FILE, load_config, save_config from config import CONFIG_FILE, load_config, save_config
from utils import ( from utils import (
check_platform,
check_root, check_root,
check_packages, check_packages,
get_keyboard_device_files, get_keyboard_device_files,
@ -113,8 +114,9 @@ def detect_keyloggers():
# 1. Setup and initialization # 1. Setup and initialization
############################ ############################
debug(True, str(sys.argv)) # Set manually to debug if args are being read 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 auto_kill_option, verbose_option, safe_option
global CONFIG_FILE
set_input_options() set_input_options()
if verbose_option: if verbose_option:
print('[Verbose] Input options set') print('[Verbose] Input options set')

View File

@ -3,6 +3,20 @@ import subprocess # for executing shell commands
import signal # for sending signals to processes import signal # for sending signals to processes
import sys # for exit 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(): def check_root():
""" """
Check if script is run as root(sudo). Check if script is run as root(sudo).