diff --git a/src/kernel_detector.py b/src/kernel_detector.py index e01663b..f40a49d 100644 --- a/src/kernel_detector.py +++ b/src/kernel_detector.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import subprocess import time import multiprocessing @@ -136,43 +138,42 @@ def detect_logger(module): # #============================================================================================================== -def run_kernel_detection(): - whitelist = get_whitelist("whitelist.txt") +whitelist = get_whitelist("whitelist.txt") - lsmod_output = list_modules("lsmod"); +lsmod_output = list_modules("lsmod"); - sus_modules = compare_mods(whitelist, lsmod_output) +sus_modules = compare_mods(whitelist, lsmod_output) - sus_modules = tidy_up(sus_modules) +sus_modules = tidy_up(sus_modules) - sus_modules = unload_mod(sus_modules) - time.sleep(1) +sus_modules = unload_mod(sus_modules) +time.sleep(1) - sus_modules = getpath(sus_modules) - print(sus_modules) - if len(sus_modules) == 0: - print("nothing to do") - print("ALL CLEAN") - - - - suspects = [] - for module in sus_modules: - suspects.append(detect_logger(module)) - time.sleep(1) +sus_modules = getpath(sus_modules) +print(sus_modules) +if len(sus_modules) == 0: + print("nothing to do") + print("ALL CLEAN") + + + +suspects = [] +for module in sus_modules: + suspects.append(detect_logger(module)) + time.sleep(1) - print("Following modules are logging your keystrokes: ") - for i in range(len(suspects)): - print( f"[{i}] {suspects[i]}") - print("Enter the number of the module you want to remove: ") - user_input = input().split() - for j in user_input: - to_remove = suspects[int(j)] - subprocess.Popen(['sudo','rmmod', to_remove]) - print(f"Removed {to_remove}") - print("Finished") +print("Following modules are logging your keystrokes: ") +for i in range(len(suspects)): + print( f"[{i}] {suspects[i]}") +print("Enter the number of the module you want to remove: ") +user_input = input().split() +for j in user_input: + to_remove = suspects[int(j)] + subprocess.Popen(['sudo','rmmod', to_remove]) + print(f"Removed {to_remove}") +print("Finished") diff --git a/src/keylogger_detector.py b/src/keylogger_detector.py index 439a881..591fa30 100755 --- a/src/keylogger_detector.py +++ b/src/keylogger_detector.py @@ -41,7 +41,7 @@ def print_help(): print(' -w, --add-white-list\t\t\tActivate prompt to add program names to the whitelist') #For some reason this line gets messed up in display print(' -b, --add-black-list\t\t\tAutomatically add program names chosen to kill to the blacklist') print(' -d, --debug\t\t\tDebug mode. Print debug statements') - print(' -k, --kernel-detection\t\t\tRun the kernel keylogger detector, too') + print(' -k, --kernel-detection\t\t\tRun the kernel keylogger detector, too. CURRENTLY NOT IMPLEMENTED TO DIRECTLY RUN KERNEL DETECTOR.') def set_input_options(): """ @@ -294,10 +294,7 @@ def detect_keyloggers(): debug(debug_option, 'Kernel detection option: ' + str(kernel_detection_option)) - if kernel_detection_option: - print("[Info] Starting kernel detection") - run_kernel_detection() - +; if __name__ == '__main__': detect_keyloggers()