Skip to content

MITRE-Cyber-Security-CVE-Database/tgrok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tgrok

Go License

Overview

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.

Features

  • 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.

Installation

Prerequisites

  • Go 1.21 or later
  • A valid Grok 3 API key (obtain from xAI API)

Build from Source

  1. Clone the repository:

    git clone https://github.com/MITRE-Cyber-Security-CVE-Database/tgrok.git
    cd tgrok
  2. Install dependencies:

    go mod tidy
  3. Build the binary:

    go build -o tgrok
  4. (Optional) Install globally:

    sudo mv tgrok /usr/local/bin/

Usage

Command-Line Prompt

tgrok "What is the capital of France?"

Piped Input

echo "Explain gravity" | tgrok

Interactive Mode

tgrok

Enter prompts at the You> prompt, and press Ctrl+C or type exit to quit.

Flags

  • -h, --help: Show help message
  • -v, --version: Show version (1.0.0)
  • -q, --quiet: Disable loading animation
  • -key string: Grok 3 API key (or set AI_API_KEY)
  • -provider string: AI provider (default: grok, or set AI_PROVIDER)

Example with Quiet Mode

tgrok -q "Define AI"

Environment Variables

Set these for convenience:

export AI_API_KEY="your-api-key"
export AI_PROVIDER="grok"

API Configuration

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.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-feature).
  3. Commit changes (git commit -m "Add your feature").
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request.

Please follow the Code of Conduct and ensure your code adheres to the project's style guidelines.

License

This project is licensed under the MIT License.

Contact

For issues or questions, open an issue on the GitHub repository or contact the MITRE-Cyber-Security-CVE-Database team.

Acknowledgments

  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages