diff --git a/.env.example b/.env.example index 9f656e6b..e570b8b5 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1 @@ OPENAI_API_KEY= -CTF_IN_DOCKER= \ No newline at end of file diff --git a/README.md b/README.md index fb7e1525..49474e4e 100644 --- a/README.md +++ b/README.md @@ -361,7 +361,3 @@ CAI is developed by [Alias Robotics](https://aliasrobotics.com) and funded as pa - [ ] Tracing - [ ] Graph/flow and other abstractions - [ ] Plan/router - -### ENV Vars - -CTF_IN_DOCKER="True" diff --git a/cai/core.py b/cai/core.py index 50f7c1c6..f041bf8b 100644 --- a/cai/core.py +++ b/cai/core.py @@ -14,7 +14,6 @@ import copy import json from collections import defaultdict from typing import List -import os # Package/library imports from openai import OpenAI # pylint: disable=import-error @@ -192,8 +191,6 @@ class CAI: args[__CTX_VARS_NAME__] = context_variables if self.ctf: args["ctf"] = self.ctf - else: - os.environ["CTF_IN_DOCKER"] = "false" raw_result = function_map[name](**args) result: Result = self.handle_function_result(raw_result, debug) diff --git a/cai/tools/common.py b/cai/tools/common.py index 5a5f01e9..3885cf28 100644 --- a/cai/tools/common.py +++ b/cai/tools/common.py @@ -1,11 +1,8 @@ -"""Basic utilities for executing commands inside and outside virtual -containers. It's important to note that for proper functioning, the -CTF_IN_DOCKER environment variable must be configured, and commands can -only be executed through CTF instances with pentestperf within the code. -See examples/cybersecurity/1_arch_short_picoctf_static_flag.py for an -example.""" +""" +Basic utilities for executing commands inside or outside of virtual +containers. +""" -import os import subprocess # nosec B404 from wasabi import color # pylint: disable=import-error @@ -47,8 +44,8 @@ def _run_attacker_machine(command, stdout=True): def run_command(command, ctf=None, stdout=True): """ Run command either in CTF container or - on local attacker machine based on CTF_IN_DOCKER flag + on the local attacker machine """ - if os.getenv("CTF_IN_DOCKER", "false").lower() == "true" and ctf: + if ctf: return _run_ctf(ctf, command, stdout) return _run_attacker_machine(command, stdout) diff --git a/examples/cybersecurity/1_arch_short_picoctf_static_flag.py b/examples/cybersecurity/1_arch_short_picoctf_static_flag.py index 6bc6d32e..f08c9908 100644 --- a/examples/cybersecurity/1_arch_short_picoctf_static_flag.py +++ b/examples/cybersecurity/1_arch_short_picoctf_static_flag.py @@ -9,7 +9,6 @@ from wasabi import color import os # 2. Init the CTF environment -os.environ["CTF_IN_DOCKER"] = "true" ctf = ptt.ctf( "picoctf_static_flag", subnet="192.168.9.0/24",