diff --git a/cai/tools/others/others.py b/cai/tools/others/others.py index ccdcee68..e69de29b 100644 --- a/cai/tools/others/others.py +++ b/cai/tools/others/others.py @@ -1,74 +0,0 @@ - - -def pwd_command(path: str, args: str = "") -> str: - """ - Retrieve the current working directory. - - Returns: - str: The absolute path of the current working directory - """ - global ctf - command = f'pwd' - return run_ctf(ctf, command) - -def strings_command(args: str, file_path: str) -> str: - """ - Extract printable strings from a binary file. - - Args: - args: Additional arguments to pass to the strings command - file_path: Path to the binary file to extract strings from - - Returns: - str: The output of running the strings command - """ - global ctf - command = f'strings {file_path} ' - return run_ctf(ctf, command) - - -def nmap_command(ip_address: str, args: str = "") -> str: - """ - Scan a network host for open ports and services. - - Args: - ip_address: The IP address or hostname of the target to scan - args: Additional arguments to pass to the nmap command - - Returns: - str: The output of running the nmap command - """ - global ctf - command = f'nmap {ip_address} {args}' - return run_ctf(ctf, command) - - -def netcat_command(ip_address: str, port: str, args: str = "") -> str: - """ - Connect to a network host via a specific port. - """ - global ctf - command = f'nc {ip_address} {port} {args}' - return run_ctf(ctf, command) - -def decode64(input_data: str, args: str = "") -> str: - """ - Decode a base64-encoded string. - - Args: - input_data: The base64-encoded string to decode - args: Additional arguments (not used in this function) - - Returns: - str: The decoded string - """ - import base64 - try: - decoded_bytes = base64.b64decode(input_data) - decoded_str = decoded_bytes.decode('utf-8') - return decoded_str - except Exception as e: - print(color(f"Error decoding base64 data: {e}", fg="red")) - return f"Error decoding base64 data: {str(e)}" - - diff --git a/cai/tools/reconnaissance/Crypto.py b/cai/tools/reconnaissance/Crypto.py deleted file mode 100644 index a4b78f98..00000000 --- a/cai/tools/reconnaissance/Crypto.py +++ /dev/null @@ -1,5 +0,0 @@ -# URLDecodeTool -# HexDumpTool -# Base64DecodeTool -# ROT13DecodeTool -# BinaryAnalysisTool diff --git a/cai/tools/reconnaissance/crypto_tools.py b/cai/tools/reconnaissance/crypto_tools.py new file mode 100644 index 00000000..0a366584 --- /dev/null +++ b/cai/tools/reconnaissance/crypto_tools.py @@ -0,0 +1,46 @@ +# """ +# Here are crypto tools +# """ +# # import base64 +# from cai.tools.common import run_command +# # URLDecodeTool +# # HexDumpTool +# # Base64DecodeTool +# # ROT13DecodeTool +# # BinaryAnalysisTool + + +# def strings_command(file_path: str, ctf=None) -> str: +# """ +# Extract printable strings from a binary file. + +# Args: +# args: Additional arguments to pass to the strings command +# file_path: Path to the binary file to extract strings from + +# Returns: +# str: The output of running the strings command +# """ +# command = f'strings {file_path} ' +# return run_command(ctf, command) + + +# def decode64(input_data: str) -> str: +# """ +# Decode a base64-encoded string. + +# Args: +# input_data: The base64-encoded string to decode +# args: Additional arguments (not used in this function) + +# Returns: +# str: The decoded string +# """ + +# try: +# decoded_bytes = base64.b64decode(input_data) +# decoded_str = decoded_bytes.decode('utf-8') +# return decoded_str +# except UnicodeDecodeError as e: +# print(f"Error decoding bytes to string: {e}") +# return f"Error decoding bytes to string: {str(e)}" diff --git a/cai/tools/reconnaissance/filesystem.py b/cai/tools/reconnaissance/filesystem.py index f904f8fe..98dc8e70 100644 --- a/cai/tools/reconnaissance/filesystem.py +++ b/cai/tools/reconnaissance/filesystem.py @@ -34,11 +34,22 @@ def cat_file(file_path: str, args: str = "", ctf=None) -> str: command = f'cat {args} {file_path} ' return run_command(command, ctf=ctf) -#FileSearchTool -#ListDirTool -#TextSearchTool -#FileAnalysisTool -#StringExtractionTool -#ReadFileTool -#FilePermissionsTool -#FileCompressionTool +# FileSearchTool +# ListDirTool +# TextSearchTool +# FileAnalysisTool +# StringExtractionTool +# ReadFileTool +# FilePermissionsTool +# FileCompressionTool + + +def pwd_command(ctf=None) -> str: + """ + Retrieve the current working directory. + + Returns: + str: The absolute path of the current working directory + """ + command = 'pwd' + return run_command(command, ctf=ctf) diff --git a/cai/tools/reconnaissance/filesystem_info.py b/cai/tools/reconnaissance/filesystem_info.py deleted file mode 100644 index e07ebe99..00000000 --- a/cai/tools/reconnaissance/filesystem_info.py +++ /dev/null @@ -1,3 +0,0 @@ -#ProcessListTool -#EnvironmentVariablesTool -#SystemInformationTool diff --git a/cai/tools/reconnaissance/generic_linux_command.py b/cai/tools/reconnaissance/generic_linux_command.py index d70cf272..e69de29b 100644 --- a/cai/tools/reconnaissance/generic_linux_command.py +++ b/cai/tools/reconnaissance/generic_linux_command.py @@ -1 +0,0 @@ -#GenericLinuxCommandTool \ No newline at end of file diff --git a/cai/tools/reconnaissance/netcat.py b/cai/tools/reconnaissance/netcat.py index 7279bda0..639e8520 100644 --- a/cai/tools/reconnaissance/netcat.py +++ b/cai/tools/reconnaissance/netcat.py @@ -1,8 +1,11 @@ -from cai.tools.common import run_command """ -Here are the netcat tools. + Here are the tools for netcat command """ -def netcat(args: str, host: str, port: int, data: str = '', ctf=None) -> str: +from cai.tools.common import run_command # pylint: disable=import-error + + +def netcat(host: str, port: int, data: str = '', + args: str = '', ctf=None) -> str: """ A simple netcat tool to connect to a specified host and port. Args: diff --git a/cai/tools/reconnaissance/system_info.py b/cai/tools/reconnaissance/system_info.py new file mode 100644 index 00000000..be418115 --- /dev/null +++ b/cai/tools/reconnaissance/system_info.py @@ -0,0 +1,3 @@ +# ProcessListTool +# EnvironmentVariablesTool +# SystemInformationTool