Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Change: Require --ctf flag to run in enigma mode (#769)

Kilian Lieret9aaab5d4b577
diff --git a/docs/installation/docker.md b/docs/installation/docker.md
index 98f1993d..e713c929 100644
--- a/docs/installation/docker.md
+++ b/docs/installation/docker.md
@@ -32,6 +32,7 @@ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/keys.cfg:/app/keys.cfg \
sweagent/swe-agent-run:latest \
python run.py --image_name=sweagent/enigma:latest \
+ --ctf \
--model_name gpt4 \
--data_path /path/to/challenge.json \
--repo_path /path/to/repo \
diff --git a/docs/usage/enigma.md b/docs/usage/enigma.md
index f69bbc35..932a32ba 100644
--- a/docs/usage/enigma.md
+++ b/docs/usage/enigma.md
@@ -29,6 +29,7 @@ We will run the following command,
```bash
python run.py \
--model_name gpt4 \
+ --ctf \
--image_name sweagent/enigma:latest \
--data_path ../LLM_CTF_Database/2018/CSAW-Finals/misc/leaked_flag/challenge.json \
--repo_path ../LLM_CTF_Database/2018/CSAW-Finals/misc/leaked_flag \
diff --git a/run.py b/run.py
index c43d355d..f1f9d6b4 100644
--- a/run.py
+++ b/run.py
@@ -108,6 +108,8 @@ class ScriptArguments(FlattenedAccess, FrozenSerializable):
raise_exceptions: bool = False
# Dump the entire config to the log
print_config: bool = True
+ # Run the agent in CTF mode (SWE-agent: EnIGMA)
+ ctf: bool = False
@property
def run_name(self) -> str:
@@ -515,6 +517,7 @@ def get_args(args=None) -> ScriptArguments:
config_file=CONFIG_DIR / "default.yaml",
),
actions=ActionsArguments(open_pr=False, skip_if_commits_reference_issue=True),
+ ctf=False,
)
# Nicer yaml dumping of multiline strings
diff --git a/tests/test_replay_ctf.py b/tests/test_replay_ctf.py
index 10989774..53c46b68 100644
--- a/tests/test_replay_ctf.py
+++ b/tests/test_replay_ctf.py
@@ -40,6 +40,7 @@ def test_ctf_traj_replay(test_ctf_trajectories_path, traj_rel_path, ctf_data_pat
"config/default_ctf.yaml",
"--raise_exceptions",
"--noprint_config",
+ "--ctf",
]
args, remaining_args = get_args(args)
main(**vars(args), forward_args=remaining_args)