You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #71 from Neverbolt/openai-streaming
introduces streaming support to capabilities
- adds a new web use-case using the streaming
- adds new tables to the logging database which will be used in the future (currently write-only)
- there is a "new" openai requirement but that was an indirect dependency before already (according to neverbolt)
Copy file name to clipboardExpand all lines: src/hackingBuddyGPT/capabilities/http_request.py
+23-12Lines changed: 23 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
6
6
from . importCapability
7
7
8
+
8
9
@dataclass
9
10
classHTTPRequest(Capability):
10
11
host: str
@@ -18,7 +19,17 @@ def __post_init__(self):
18
19
self._client=requests
19
20
20
21
defdescribe(self) ->str:
21
-
returnf"Sends a request to the host {self.host} and returns the response."
22
+
description= (f"Sends a request to the host {self.host} using the python requests library and returns the response. The schema and host are fixed and do not need to be provided.\n"
23
+
f"Make sure that you send a Content-Type header if you are sending a body.")
24
+
ifself.use_cookie_jar:
25
+
description+="\nThe cookie jar is used for storing cookies between requests."
26
+
else:
27
+
description+="\nCookies are not automatically stored, and need to be provided as header manually every time."
host: str=parameter(desc="The host to test", default="http://localhost")
27
+
flag_format_description: str=parameter(desc="Description of the flag provided to the LLM", default="a string starting with 'FLAG.' and ending with '.GALF'")
28
+
flag_template: str=parameter(desc="The template of the flags, whereby {flag} is replaced with the flags", default="FLAG.{flag}.GALF")
29
+
flags: str=parameter(desc="A comma (,) separated list of flags to find", default="hostname,dir,username,rootfile,secretfile,adminpass")
"content": f"You are a senior penetration tester, having received a new project of testing a website at {self.host}."
42
+
f"Your goal is first to explore the website, building up your knowledge about its parts and inner workings, and then try to plan and execute possible exploitations.\n"
43
+
f"Think step by step and say everything out loud that you might be doing.\n"
44
+
f"Give a list of assumptions you base your tool calls on, before you start a tool call, and reason whether they held or not after the call has completed.\n"
45
+
f"Do not brute-force anything, all information that you might need can be found on the webserver.\n"
46
+
f"THE MOST IMPORTANT THING TO DO IS, that if you see a flag ({self.flag_format_description}), you should submit it immediately."})
"CREATE TABLE IF NOT EXISTS runs (id INTEGER PRIMARY KEY, model text, context_size INTEGER, state TEXT, tag TEXT, started_at text, stopped_at text, rounds INTEGER, configuration TEXT)")
35
-
self.cursor.execute("CREATE TABLE IF NOT EXISTS commands (id INTEGER PRIMARY KEY, name string unique)")
0 commit comments