Skip to content

fgravato/LookoutWebActivityGO

Repository files navigation

Lookout TUI - Terminal UI for Lookout Web Activity Feed

A modern, interactive terminal user interface (TUI) for querying and browsing Lookout's Web Access Feed API, built with Go and Bubble Tea.

Features

  • Real-time Event Browsing: View web access events in an interactive terminal interface
  • Multiple Time Windows: Quick access to 1h, 12h, 24h, and 48h time ranges
  • Live Search: Filter events by URL, device GUID, region, IP address, or event ID
  • Event Details: View detailed information about each event
  • Keyboard Navigation: Intuitive controls for power users
  • Token Management: Automatic OAuth2 token refresh
  • Beautiful UI: Styled with Lip Gloss for a modern look

Prerequisites

  • Go 1.21 or higher
  • Valid Lookout API credentials (Application Key and/or Web Activity Key)

Installation

  1. Clone the repository:

    cd lookout-tui
  2. Install dependencies:

    go mod download
  3. Build the application:

    go build -o lookout-tui ./cmd/tui

Configuration

Create a .env file in the project root:

# Lookout API Configuration
APPLICATION_KEY=your_application_key_here
WEB_ACTIVITY_KEY=your_web_activity_key_here

Or set environment variables:

export APPLICATION_KEY="your_application_key_here"
export WEB_ACTIVITY_KEY="your_web_activity_key_here"

Usage

Start the TUI

./lookout-tui

Keyboard Controls

  • ↑/j - Navigate up through events
  • ↓/k - Navigate down through events
  • 1-4 - Switch time windows (1h, 12h, 24h, 48h)
  • / - Focus search input
  • Enter - Apply search filter / Show event details
  • Esc - Clear search / Close event details
  • r - Reload events from API
  • q/Ctrl+C - Quit application

Features

  1. Time Window Selection: Press 1-4 to quickly switch between time ranges
  2. Search: Press / to focus the search input, type your query, and press Enter to filter
  3. Event Details: Press Enter on any event to view detailed information
  4. Auto-refresh: Press r to manually reload events from the API

Development

Project Structure

lookout-tui/
├── cmd/
│   ├── cli/          # Simple CLI tool for testing
│   └── tui/          # Main TUI application
├── internal/
│   ├── api/          # Lookout API client
│   └── ui/           # Bubble Tea TUI components
└── go.mod

Building

Build the TUI:

go build -o bin/tui ./cmd/tui

Build the CLI tool:

go build -o bin/cli ./cmd/cli

Running

Run the TUI:

./bin/tui

Run the CLI (with optional JSON output):

./bin/cli
./bin/cli --json

API Client

The project includes a robust API client with:

  • OAuth2 Token Management: Automatic token refresh using application keys
  • Retry Logic: Exponential backoff for failed requests
  • Error Handling: Graceful handling of API errors and token expiration
  • Timeout Configuration: Configurable request timeouts

Using the API Client

import "github.com/fgravato/lookout-tui/internal/api"

client, err := api.NewClient(api.Config{
    ApplicationKey: "your_key",
    WebActivityKey: "your_web_activity_key",
    Timeout:        60 * time.Second,
})

resp, err := client.FetchWebAccessEvents(startTime)

Dependencies

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

Support

For issues related to:

  • Lookout API: Contact your Lookout SE representative
  • This Tool: Open an issue on GitHub

Acknowledgments

Built with:

  • Charmbracelet tools for beautiful terminal UIs
  • Lookout's Web Access Feed API
  • The Go community

About

A beautiful terminal UI for browsing Lookout Web Activity events in real-time. Built with Go and Bubble Tea.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors