Kali Linux Command Assistant is an intelligent, interactive tool designed to help users navigate and utilize Kali Linux commands more effectively. This project leverages natural language processing and a vector database to provide accurate, context-aware command suggestions and explanations for Kali Linux users.
- Natural language interface for querying Kali Linux commands
- Intelligent command suggestion based on user input
- Detailed explanations and usage examples for Kali Linux commands
- Vector database for efficient storage and retrieval of command information
- Option to execute suggested commands directly from the interface
- Python 3.8+
- LangChain for natural language processing
- OpenAI's GPT-4o-mini for language model
- PostgreSQL with pgvector extension for vector storage
- Transformers library for tokenization
Before you begin, ensure you have met the following requirements:
- Python 3.8 or higher
- PostgreSQL 12 or higher with pgvector extension installed
- OpenAI API key
-
Clone the repository:
git clone https://github.com/yourusername/kali-linux-command-assistant.git cd kali-linux-command-assistant
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up your environment variables: Create a
.env
file in the project root and add the following:OPENAI_API_KEY=your_openai_api_key_here
-
Initialize the database:
docker run --name pgvector-container -e POSTGRES_USER=langchain -e POSTGRES_PASSWORD=langchain -e POSTGRES_DB=langchain -p 6024:5432 -d pgvector/pgvector:pg16
You can connect to the database using the psql command-line tool:
psql -h localhost -p 6024 -U langchain -d langchain
You'll be prompted for the password (which should be "langchain" based on your Docker setup).Once inside the pgvector database:
CREATE EXTENSION vector
Verify that the Docker container's logs don't show any errors:
docker logs pgvector-container
If all else fails, you might want to recreate the Docker container:
docker stop pgvector-container docker rm pgvector-container docker run --name pgvector-container -e POSTGRES_USER=langchain -e POSTGRES_PASSWORD=langchain -e POSTGRES_DB=langchain -p 6024:5432 -d pgvector/pgvector:pg16
To start the Kali Linux Command Assistant, run:
python main.py
Follow the on-screen prompts to interact with the assistant. You can ask questions about Kali Linux commands, and the assistant will provide relevant suggestions and explanations.
Example interaction:
Welcome to Kali Linux Command Assistant! Type 'exit' to quit.
Ask a Kali Linux command question: How do I scan for open ports on a network?
Generated Command(s):
To scan for open ports on a network using Kali Linux, you can use the nmap command. Here's an example:
nmap -sS -O 192.168.1.0/24
This command will perform a SYN scan (-sS) and try to detect the operating system (-O) of all hosts in the 192.168.1.0/24 network range.
Do you want to execute this command? (y/n): n
Ask a Kali Linux command question: exit
Goodbye!
Contributions to the Kali Linux Command Assistant are welcome. Please follow these steps to contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Make your changes
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Create a new Pull Request
- OpenAI for providing the GPT-4 model
- The LangChain community for their excellent framework
- The Kali Linux team for their comprehensive command documentation
If you have any questions or feedback, please open an issue on the GitHub repository.