Remove CTF_IN_DOCKER env. variable

Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
This commit is contained in:
Víctor Mayoral Vilches 2025-01-10 09:22:31 +00:00
parent 0abbfa1fd8
commit ab68a2f0ef
5 changed files with 6 additions and 18 deletions

View File

@ -1,2 +1 @@
OPENAI_API_KEY=
CTF_IN_DOCKER=

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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",