gopwned

package module
v0.0.0-...-f6937ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

goPwned

Go Report Card GoDoc Build Status Coverage Status

A golang library for HaveIBeenPwned REST API - https://haveibeenpwned.com/

Installation

go get https://github.com/mavjs/goPwned

Usage

Breaches
Getting all breaches for an account
Get all breaches for an account across all domains.
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.GetBreachesForAccount("foo@bar.com"))
}
Get all breaches for an account across a particular domain.
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.GetBreachesForAccount("foo@bar.com", "adobe.com"))
}
Getting all breached sites in the system
Get all the details of each breach in the system
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.AllBreaches())
}
Get all the details of breached site
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.AllBreaches("adobe.com"))
}
Getting a single breached site in the system
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.GetSingleBreachedSite("adobe"))
}
Getting all data classes in the system
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.GetAllDataClasses())
}
Pastes
Getting all pastes for an account
import (
    "github.com/mavjs/goPwned"
    )

func main() {
    fmt.Println(gopwned.GetAllPastesForAccount("foo@bar.com"))
}

License

MIT

Documentation

Overview

Package gopwned implements the REST api of haveibeenpwned.com for easy querying

Index

Constants

View Source
const (
	Version     = "0.1"
	UserAgent   = "gopwned-api-client-" + Version
	MediaTypeV2 = "application/vnd.haveibeenpwned.v2+json"
	Endpoint    = "https://haveibeenpwned.com/api/v2/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Breach

type Breach struct {
	Name         string       `json:"Name,omitempty"`
	Title        string       `json:"Title,omitempty"`
	Domain       string       `json:"Domain,omitempty"`
	BreachDate   string       `json:"BreachDate,omitempty"`
	AddedDate    string       `json:"AddedDate,omitempty"`
	PwnCount     int          `json:"PwnCount,omitempty"`
	Description  string       `json:"Description,omitempty"`
	DataClasses  *DataClasses `json:"DataClasses,omitempty"`
	IsVerified   bool         `json:"IsVerified,omitempty"`
	IsFabricated bool         `json:"IsFabricated,omitempty"`
	IsSensitive  bool         `json:"IsSensitive,omitempty"`
	IsRetired    bool         `json:"IsRetired,omitempty"`
	IsSpamList   bool         `json:"IsSpamList,omitempty"`
	LogoType     string       `json:"LogoType,omitempty"`
}

func GetAllBreachedSites

func GetAllBreachedSites(domain string) ([]*Breach, error)

func GetAllBreachesForAccount

func GetAllBreachesForAccount(email, domain, truncateResponse string) ([]*Breach, error)

func GetBreachedSite

func GetBreachedSite(site string) ([]*Breach, error)

type Client

type Client struct {
	UserAgent string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *http.Client) (*Client, error)

func (*Client) GetAllBreachedSites

func (c *Client) GetAllBreachedSites(domain string) ([]*Breach, error)

func (*Client) GetAllBreachesForAccount

func (c *Client) GetAllBreachesForAccount(email, domain, truncateResponse string) ([]*Breach, error)

func (*Client) GetAllPastesForAccount

func (c *Client) GetAllPastesForAccount(account string) ([]*Paste, error)

func (*Client) GetBreachedSite

func (c *Client) GetBreachedSite(site string) ([]*Breach, error)

func (*Client) GetDataClasses

func (c *Client) GetDataClasses() (*DataClasses, error)

type DataClasses

type DataClasses []string

func GetDataClasses

func GetDataClasses() (*DataClasses, error)

type Paste

type Paste struct {
	Source     string `json:"Source,omitempty"`
	ID         string `json:"Id,omitempty"`
	Title      string `json:"Title,omitempty"`
	Date       string `json:"Date,omitempty"`
	EmailCount int    `json:"EmailCount,omitempty"`
}

func GetAllPastesForAccount

func GetAllPastesForAccount(account string) ([]*Paste, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址