tgrok is a lightweight, terminal-based AI client for interacting with the Grok 3 API, designed for minimal resource usage. It supports command-line prompts, piped input, and a simple interactive mode, making it ideal for cybersecurity professionals and developers who need quick access to AI-driven insights. Developed under the MITRE-Cyber-Security-CVE-Database organization, tgrok is optimized for environments where low memory usage is critical, such as in vulnerability analysis workflows.
- Lightweight: Minimal dependencies and no heavy UI frameworks, ensuring low RAM usage.
- Flexible Input: Supports command-line prompts, piped input, and interactive mode.
- Quiet Mode: Optional flag to disable loading animations for scripting.
- Error Handling: Robust error messages for API, input, and network issues.
- MIT License: Open-source and free to use, modify, and distribute.
-
Clone the repository:
git clone https://github.com/MITRE-Cyber-Security-CVE-Database/tgrok.git cd tgrok -
Install dependencies:
go mod tidy
-
Build the binary:
go build -o tgrok
-
(Optional) Install globally:
sudo mv tgrok /usr/local/bin/
tgrok "What is the capital of France?"echo "Explain gravity" | tgroktgrokEnter prompts at the You> prompt, and press Ctrl+C or type exit to quit.
-h, --help: Show help message-v, --version: Show version (1.0.0)-q, --quiet: Disable loading animation-key string: Grok 3 API key (or setAI_API_KEY)-provider string: AI provider (default: grok, or setAI_PROVIDER)
tgrok -q "Define AI"Set these for convenience:
export AI_API_KEY="your-api-key"
export AI_PROVIDER="grok"The tool uses a placeholder API endpoint (https://api.x.ai/v1/grok). To use tgrok, obtain an API key and endpoint from xAI API. Update the Url field in main.go or pass the correct endpoint via a configuration if needed.
Note: The response parsing in helper.go assumes a JSON response with a response field. Adjust the parsing logic based on the actual API specification.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature). - Commit changes (
git commit -m "Add your feature"). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
Please follow the Code of Conduct and ensure your code adheres to the project's style guidelines.
This project is licensed under the MIT License.
For issues or questions, open an issue on the GitHub repository or contact the MITRE-Cyber-Security-CVE-Database team.
- Built with Go and fatih/color.
- Inspired by the need for lightweight tools in cybersecurity workflows, aligned with MITRE’s mission to advance vulnerability management.
Copyright © 2025 GulfOfAmerica