Skip to content

Conversation

@Qsan1
Copy link
Contributor

@Qsan1 Qsan1 commented Apr 14, 2025

Added usecase rag . The base architecture is the same as Privesc, but it has several optional extensions:

  • compressed history: If enabled, instead of including all commands and their respective output in the prompt, it removes all outputs except the most recent one.
  • Structure via Prompt: If enabled, an initial set of command recommendations is included in the query_next_command prompt.
  • Analyze: If enabled, the LLM will be prompted after each iteration and is asked to analyze the most recent output. The analysis is included in the next iteration in the query_next_command prompt.
  • RAG: If enabled, after each iteration the LLM is prompted and asked to generate a search query for a vector store. The search query is then used to retrieve relevant documents from the vector store and the information is included in the prompt for the Analyze component (Only works if Analyze is enabled).
  • Chain of Thought (CoT): If enabled, CoT is used to generate the next command.

@andreashappe
Copy link
Member

Thank you for your update... this looks good already. Could you also link your README.md from the project's mein readme.md? If you want to, you can also add documentation to docs.hackingbuddy (separate repository).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.

Files not reviewed (2)
  • .env.example: Language not supported
  • src/hackingBuddyGPT/usecases/rag/rag_storage/.gitignore: Language not supported
Comments suppressed due to low confidence (1)

src/hackingBuddyGPT/utils/openai/openai_llm.py:67

  • The exception message is missing a closing parenthesis. Consider updating it to: raise Exception(f"Error from OpenAI Gateway ({response.status_code})")
raise Exception(f"Error from OpenAI Gateway ({response.status_code}")

print("Received 408 Status Code, trying again.")
return self.get_response(prompt, azure_retry = azure_retry + 1)
else:
raise Exception(f"Error from Gateway ({response.status_code}")
Copy link

Copilot AI Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception message is missing a closing parenthesis. Consider updating it to: raise Exception(f"Error from Gateway ({response.status_code})")

Suggested change
raise Exception(f"Error from Gateway ({response.status_code}")
raise Exception(f"Error from Gateway ({response.status_code})")

Copilot uses AI. Check for mistakes.
This usecase is an extension of `usecase/privesc`.

## Setup
### Depdendencies
Copy link

Copilot AI Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'Depdendencies' is misspelled. It should be corrected to 'Dependencies'.

Suggested change
### Depdendencies
### Dependencies

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
The code for the vector store setup can be found in `rag_utility.py`. Currently the vectore store uses two sources: `GTFObins` and `hacktricks`. To use RAG, download the markdown files and place them in `rag_storage/GTFObinMarkdownfiles` (`rag_storage/hacktricksMarkdownFiles`). You can download the markdown files either from the respective github repository ([GTFObin](https://github.com/GTFOBins/GTFOBins.github.io/tree/master), [hacktricks](https://github.com/HackTricks-wiki/hacktricks/tree/master/src/linux-hardening/privilege-escalation)) or scrape them from their website ([GTFObin](https://gtfobins.github.io/), [hacktricks](https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html)).

Copy link

Copilot AI Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'vectore' is misspelled. It should be corrected to 'vector'.

Suggested change
The code for the vector store setup can be found in `rag_utility.py`. Currently the vectore store uses two sources: `GTFObins` and `hacktricks`. To use RAG, download the markdown files and place them in `rag_storage/GTFObinMarkdownfiles` (`rag_storage/hacktricksMarkdownFiles`). You can download the markdown files either from the respective github repository ([GTFObin](https://github.com/GTFOBins/GTFOBins.github.io/tree/master), [hacktricks](https://github.com/HackTricks-wiki/hacktricks/tree/master/src/linux-hardening/privilege-escalation)) or scrape them from their website ([GTFObin](https://gtfobins.github.io/), [hacktricks](https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html)).
The code for the vector store setup can be found in `rag_utility.py`. Currently the vector store uses two sources: `GTFObins` and `hacktricks`. To use RAG, download the markdown files and place them in `rag_storage/GTFObinMarkdownfiles` (`rag_storage/hacktricksMarkdownFiles`). You can download the markdown files either from the respective github repository ([GTFObin](https://github.com/GTFOBins/GTFOBins.github.io/tree/master), [hacktricks](https://github.com/HackTricks-wiki/hacktricks/tree/master/src/linux-hardening/privilege-escalation)) or scrape them from their website ([GTFObin](https://gtfobins.github.io/), [hacktricks](https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html)).

Copilot uses AI. Check for mistakes.
@andreashappe andreashappe merged commit 0cf164b into ipa-lab:development Apr 14, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants