Skip to content

Commit

Permalink
Deleting SSH lurking
Browse files Browse the repository at this point in the history
  • Loading branch information
n3rada committed Apr 26, 2024
1 parent 28d53d4 commit 74c87c8
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions toboggan/src/operating_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ def _handle_os_specific_cases(self) -> None:
self.__analyse_weak_file_permissions()
self.__analyse_readable_files_other_users()
self.__analyse_no_owners_files()
self.__analyse_ssh_misconfiguration()

# Private methods
def __analyse_readable_files_other_users(self) -> None:
Expand Down Expand Up @@ -338,38 +337,6 @@ def __analyse_readable_files_other_users(self) -> None:
else:
print("[Toboggan] No readable files found in other user's directories.")

def __analyse_ssh_misconfiguration(self) -> None:
"""
Analyzes SSH misconfigurations on the system by searching for SSH keys and configurations.
"""
# Streamlined and refined command
command = """
find / -type f \( -name 'ssh_host_*_key*' -o -name 'sshd_config' -o -name 'ssh_config' \) 2>/dev/null
"""

# Execute the command
ssh_search_result = self._execute(command=command).strip()

if ssh_search_result:
print("[Toboggan] SSH key(s) and configuration(s) have been found:")

# Organize files by their parent directories
directory_map = {}
for file_path in ssh_search_result.split("\n"):
directory, file_name = file_path.rsplit("/", 1)
if directory in directory_map:
directory_map[directory].append(file_name)
else:
directory_map[directory] = [file_name]

# Print the organized list
for directory, files in sorted(directory_map.items()):
print(f"\t{directory}")
for file_name in sorted(files):
print(f"\t\t- {file_name}")
else:
print("[Toboggan] No SSH keys or configurations have been found.")

def __analyse_path_variable(self) -> None:
raw_path = self._execute(command="/bin/echo $PATH").strip()
print(f"[Toboggan] Binary and script searching order (PATH):")
Expand Down

0 comments on commit 74c87c8

Please sign in to comment.