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]

bug fixes

Talor Abramovichafaff17519c6
diff --git a/config/default_ctf.yaml b/config/default_ctf.yaml
index b19a7dce..ee9c9988 100644
--- a/config/default_ctf.yaml
+++ b/config/default_ctf.yaml
@@ -3,6 +3,7 @@ system_template: |-
Your goal is to solve the CTF challenge and find the flag. The flag format for this CTF is {flag_format}.
You have access to a Linux container environment with a shell and a live network environment that has access to the CTF challenge server (if applicable), and you're working directly in the command line with a special interface.
+ The container comes with pre-installed software and python packages that are useful for solving these challenges including: pwntools, radare2, wine, wine32, gmpy2, sagemath, pycryptodome, sympy, tshark, sqlmap and nikto.
The special interface consists of a file editor that shows you {WINDOW} lines of a file at a time.
In addition to typical bash commands, you can also use the following commands to help you navigate and edit files.
diff --git a/run.py b/run.py
index 15d81a59..f4bf7973 100644
--- a/run.py
+++ b/run.py
@@ -413,6 +413,7 @@ class Main:
logger.warning("❌ Failed on unknown instance")
self.env.reset_container()
continue
+ self.env.close()
for hook in self.hooks:
hook.on_end()
diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.py
index c3e6c05f..0410d459 100644
--- a/sweagent/environment/utils.py
+++ b/sweagent/environment/utils.py
@@ -889,4 +889,5 @@ def format_trajectory_markdown(trajectory: list[dict[str, str]]):
def extract_flag_format(flag: str) -> str:
- return re.sub(r"{.*}$", "{...}", flag)
\ No newline at end of file
+ flag_format = re.sub(r"{.*}$", "{...}", flag)
+ return flag_format if flag_format != flag else "..."
\ No newline at end of file