RyanJarv / h1

Golang SDK for the HackerOne API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HackerOne API Client Library

This is a work in progress and this readme was generated by ChatGPT.

This library provides a simple interface to interact with the HackerOne API. It allows you to retrieve details about programs and their associated weaknesses.

Features

  • Authenticate using your HackerOne username and token.
  • Retrieve program details.
  • Retrieve program weaknesses.

Installation

Ensure you have Go installed and set up on your machine. You can install this package by running:

go get github.com/ryanjarv/h1

Usage

Initialize the Client

To create a new HackerOne client, you need to provide your username. The token is optional; if not provided, it will be read from ~/.config/h1_token.

package main

import (
    "github.com/ryanjarv/h1"
    "log"
)

func main() {
    h1Client := h1.NewHackerone(&h1.NewHackeroneInput{
        Username: "your-username",
        Token:    "your-token", // optional
    })

    program := h1Client.Program("program-id")

    details, err := program.GetDetail()
    if err != nil {
        log.Fatalf("Error getting program details: %v", err)
    }
    log.Printf("Program details: %+v", details)

    weaknesses, err := program.GetWeaknesses()
    if err != nil {
        log.Fatalf("Error getting program weaknesses: %v", err)
    }
    log.Printf("Program weaknesses: %+v", weaknesses)
}

Functions

NewHackerone

Creates a new HackerOne client.

func NewHackerone(input *NewHackeroneInput) *Hackerone

Program

Returns a new Program object to interact with a specific program.

func (h1 *Hackerone) Program(id string) *Program

GetDetail

Retrieves details about a specific program.

func (h1 *Program) GetDetail() (*h1Types.ProgramDetail, error)

GetWeaknesses

Retrieves weaknesses of a specific program.

func (h1 *Program) GetWeaknesses() (*h1Types.Weaknesses, error)

Configuration

Authentication Token

The authentication token can be stored in ~/.config/h1_token. If the token is not provided when initializing the client, it will be read from this file.

About

Golang SDK for the HackerOne API


Languages

Language:Go 100.0%