Skip to content

Commit

Permalink
Updated plan test
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninoLorenzo committed Jun 29, 2024
1 parent c51e7e7 commit 8b63688
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
Binary file modified test/tests/__pycache__/test_plan.cpython-311-pytest-8.2.2.pyc
Binary file not shown.
22 changes: 11 additions & 11 deletions test/tests/plan_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
"nmap -O example.com"
]
},
{
"content": [
"To do a port scan and version scan on 192.168.1.252, I'll use the following command:\n\n",
"`nmap -p 1-1024 -sV 192.168.1.252`\n\n",
"This command will perform a quick port scan (nmap -p 1-1024) to identify all open ports from 1 to 1024 on the target IP address, and then do a version scan (nmap -sV) to detect the operating system and any services running on those open ports.\n\n",
"Would you like me to run this command for you?\n"
],
"commands": [
"nmap -p 1-1024 -sV 192.168.1.252"
]
},
{
"content": [
"**Plan for Reconnaissance Phase:**\n\n",
Expand All @@ -47,16 +58,5 @@
"nmap --script sshvuln 154.142.1.1",
"nmap --script ftp-vuln 154.142.1.1"
]
},
{
"content": [
"To do a port scan and version scan on 192.168.1.252, I'll use the following command:\n\n",
"`nmap -p 1-1024 -sV 192.168.1.252`\n\n",
"This command will perform a quick port scan (nmap -p 1-1024) to identify all open ports from 1 to 1024 on the target IP address, and then do a version scan (nmap -sV) to detect the operating system and any services running on those open ports.\n\n",
"Would you like me to run this command for you?\n"
],
"commands": [
"nmap -p 1-1024 -sV 192.168.1.252"
]
}
]
13 changes: 4 additions & 9 deletions test/tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class TestPlan(unittest.TestCase):
# print(f'Output:\n{task_overview.output}')

def test_from_response(self):
"""Tests the conversion from natural language plan produced
by the llm to tasks, so tests the efficiency of the prompt."""
agent = Agent(model='llama3')
with open('plan_tests.json', 'r', encoding='utf-8') as fp:
test_cases = json.load(fp)
Expand All @@ -39,7 +41,8 @@ def test_from_response(self):
self.assertEquals(
len(commands),
len(expected_commands),
f"commands {len(commands)} != expected {len(expected_commands)}"
f"Found {len(commands)} commands, expected {len(expected_commands)}\n"
f"Commands:\n{commands}\nExpected:\n{expected_commands}"
)
self.assertEquals(
commands,
Expand All @@ -48,13 +51,5 @@ def test_from_response(self):
)



# def test_should_timeout(self):
# pass

# def test_multi_step_task(self):
# pass


if __name__ == "__main__":
unittest.main()

0 comments on commit 8b63688

Please sign in to comment.