mirror of
https://github.com/weyne85/PentestGPT.git
synced 2025-10-29 16:58:59 +00:00
feat: 🎸 add logging feature for report generation
This commit is contained in:
@@ -43,6 +43,7 @@ class pentestGPT:
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
self.log_dir = "logs"
|
||||
self.chatGPTAgent = ChatGPT(ChatGPTConfig())
|
||||
self.chatGPT4Agent = ChatGPT(ChatGPTConfig(model="gpt-4"))
|
||||
self.prompts = PentestGPTPrompt
|
||||
@@ -379,8 +380,11 @@ class pentestGPT:
|
||||
# TODO.
|
||||
# log the session.
|
||||
## save self.history into a txt file based on timestamp
|
||||
log_name = "pentestGPT_log_" + dt.now().strftime("%Y%m%d_%H%M%S") + ".json"
|
||||
with open(log_name, "w") as f:
|
||||
timestamp = time.time()
|
||||
log_name = "pentestGPT_log_" + str(timestamp) + ".txt"
|
||||
# save it in the logs folder
|
||||
log_path = os.path.join(self.log_dir, log_name)
|
||||
with open(log_path, "w") as f:
|
||||
json.dump(self.history, f)
|
||||
|
||||
# clear the sessions
|
||||
|
||||
Reference in New Issue
Block a user