diff --git a/src/cai/tools/reconnaissance/filesystem.py b/src/cai/tools/reconnaissance/filesystem.py index 8f9f4c98..b85c1648 100644 --- a/src/cai/tools/reconnaissance/filesystem.py +++ b/src/cai/tools/reconnaissance/filesystem.py @@ -9,7 +9,7 @@ from cai.sdk.agents import function_tool def list_dir(path: str, args: str = "", ctf=None) -> str: """ List the contents of a directory. - by def . + Args: path: The directory path to list contents from args: Additional arguments to pass to the ls command @@ -17,7 +17,7 @@ def list_dir(path: str, args: str = "", ctf=None) -> str: Returns: str: The output of running the ls command """ - command = f'ls {path} {args}' + command = f'ls {args} "{path}"' return run_command(command, ctf=ctf) @function_tool @@ -26,13 +26,13 @@ def cat_file(file_path: str, args: str = "", ctf=None) -> str: Display the contents of a file. Args: - args: Additional arguments to pass to the cat command file_path: Path to the file to display contents of + args: Additional arguments to pass to the cat command Returns: str: The output of running the cat command """ - command = f'cat {args} {file_path} ' + command = f'cat {args} "{file_path}"' return run_command(command, ctf=ctf) @@ -60,6 +60,13 @@ def pwd_command(ctf=None) -> str: def find_file(file_path: str, args: str = "", ctf=None) -> str: """ Find a file in the filesystem. + + Args: + file_path: The search path or pattern to find files + args: Additional arguments to pass to the find command + + Returns: + str: The output of running the find command """ - command = f'find {file_path} {args}' + command = f'find {args} "{file_path}"' return run_command(command, ctf=ctf)