You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/tmc/misc/haranalyzer

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tmc/misc/haranalyzer

v0.0.0-20250610033740-47096ee65a06
Source
Go
Version published
Created
Source

HAR Analyzer

HAR Analyzer is a powerful command-line tool for analyzing HTTP Archive (HAR) files with advanced filtering capabilities. It allows you to process large HAR files, apply complex filters, and generate insightful summaries of network activity.

Features

  • Parse and analyze large HAR files
  • Advanced filtering options (URL, HTTP method, status code, response time, response size, content type)
  • Custom query language for complex filtering
  • Sort entries by time, size, status code, or URL
  • Chunk-based analysis with configurable chunk size
  • Multiple output formats (text, JSON, CSV)
  • Optional AI-powered analysis using the Anthropic API

Installation

  • Ensure you have Go 1.20 or later installed on your system.
  • Clone this repository:
    git clone https://github.com/tmc/haranalyzer.git
    
  • Change to the project directory:
    cd haranalyzer
    
  • Build the project:
    go build
    

Usage

haranalyzer [flags]

Flags

  • -i, --input string: Input HAR file (required)
  • -o, --output string: Output format (text, json, csv) (default "text")
  • -s, --sort string: Sort entries by (time, size, status, url) (default "time")
  • -c, --chunk int: Chunk size for analysis (default 100)
  • -q, --query string: Query string for filtering
  • -a, --ai: Perform AI analysis
  • --anthropic-key string: Anthropic API key

Examples

  • Basic usage:

    ./haranalyzer -i example.har
    
  • Use JSON output and sort by response size:

    ./haranalyzer -i example.har -o json -s size
    
  • Apply a complex filter:

    ./haranalyzer -i example.har -q "method:GET AND status:200-299 AND time>1000"
    
  • Perform AI analysis (requires Anthropic API key):

    ./haranalyzer -i example.har -a --anthropic-key YOUR_API_KEY
    

Query Language

The query language allows you to create complex filters using the following syntax:

  • key:value: Exact match (e.g., method:GET)
  • key:value1-value2: Range match (e.g., status:200-299)
  • key>value or key<value: Greater than or less than (e.g., time>1000)
  • key~value: Contains match (e.g., url~example.com)
  • key/regex/: Regular expression match (e.g., `url/^https://api./)

You can combine multiple conditions using AND and OR operators.

Example complex query:

method:GET AND status:200-299 AND time>1000 AND (url~example.com OR url/^https:\/\/api\./)

This query filters for GET requests with status codes between 200 and 299, response times greater than 1000ms, and URLs that either contain "example.com" or match the regex ^https:\/\/api\..

License

This project is licensed under the MIT License. See the LICENSE file for details.

FAQs

Package last updated on 10 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts