Skip to content

Commit

Permalink
Because the project is now a fork in another repo, update docs and pr…
Browse files Browse the repository at this point in the history
…oject name
  • Loading branch information
sam-bee committed Apr 14, 2024
1 parent b2c6bd7 commit 38d1240
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 30 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

HackerOne API Client in Go.

Current supports the entire [Hackers API](https://api.hackerone.com/getting-started-hacker-api/#getting-started-hacker-api). Support for the _Customers_ API may be added in future if there is any demand.

Please see the [documentation](https://pkg.go.dev/github.com/liamg/hackerone) for further information.
This project is a fork of [liamg/hackerone](https://github.com/liamg/hackerone/). It adds the functionality to search through the Structured
Scope objects in the API. This addition allows you to automate the process of bug bounty target scanning, and large-scale automated security
testing. See the [sam-bee/security-hackerone-target-retrieval](https://github.com/sam-bee/security-hackerone-target-retrieval) project for real world usage.

## Usage Example

Expand Down
2 changes: 1 addition & 1 deletion _examples/reports/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/liamg/hackerone"
"github.com/sam-bee/security-hackerone-api-client"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions entry.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package hackerone

import (
"github.com/liamg/hackerone/pkg/client"
"github.com/liamg/hackerone/pkg/hackers"
"github.com/sam-bee/security-hackerone-api-client/pkg/client"
"github.com/sam-bee/security-hackerone-api-client/pkg/hackers"
)

type API struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/liamg/hackerone
module github.com/sam-bee/security-hackerone-api-client

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"time"

"github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"

"github.com/avast/retry-go"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/hackers/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package hackers

import (
"github.com/liamg/hackerone/pkg/client"
"github.com/sam-bee/security-hackerone-api-client/pkg/client"
)

type API struct {
Expand Down
8 changes: 4 additions & 4 deletions pkg/hackers/earnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"context"
"fmt"

api2 "github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
)

type getEarningsResponse struct {
Data []api2.Earning `json:"data"`
Links api2.Links `json:"links"`
Data []api.Earning `json:"data"`
Links api.Links `json:"links"`
}

// GetEarnings returns a list of earnings made by the hacker. If there are further pages, nextPage will be >0.
func (a *API) GetEarnings(ctx context.Context, pageOptions *api2.PageOptions) (earnings []api2.Earning, nextPage int, err error) {
func (a *API) GetEarnings(ctx context.Context, pageOptions *api.PageOptions) (earnings []api.Earning, nextPage int, err error) {
var response getEarningsResponse
path := fmt.Sprintf(
"/hackers/payments/earnings?page[number]=%d&page[size]=%d",
Expand Down
8 changes: 4 additions & 4 deletions pkg/hackers/payouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"context"
"fmt"

api2 "github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
)

type getPayoutsResponse struct {
Data []api2.Payout `json:"data"`
Links api2.Links `json:"links"`
Data []api.Payout `json:"data"`
Links api.Links `json:"links"`
}

// GetPayouts returns a list of payouts received by the hacker. If there are further pages, nextPage will be >0.
func (a *API) GetPayouts(ctx context.Context, pageOptions *api2.PageOptions) (payouts []api2.Payout, nextPage int, err error) {
func (a *API) GetPayouts(ctx context.Context, pageOptions *api.PageOptions) (payouts []api.Payout, nextPage int, err error) {
var response getPayoutsResponse
path := fmt.Sprintf(
"/hackers/payments/payouts?page[number]=%d&page[size]=%d",
Expand Down
2 changes: 1 addition & 1 deletion pkg/hackers/programs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
)

type getProgramsResponse struct {
Expand Down
18 changes: 9 additions & 9 deletions pkg/hackers/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import (
"context"
"fmt"

api2 "github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
)

type getReportResponse struct {
Report api2.Report `json:"data"`
Report api.Report `json:"data"`
}

type getReportsResponse struct {
Reports []api2.Report `json:"data"`
Links api2.Links `json:"links"`
Reports []api.Report `json:"data"`
Links api.Links `json:"links"`
}

type createReportRequest struct {
Data api2.CreateReportInput `json:"data"`
Data api.CreateReportInput `json:"data"`
}

type createReportResponse struct {
Data api2.Report `json:"data"`
Data api.Report `json:"data"`
}

// GetReport returns the report for the given id.
func (a *API) GetReport(ctx context.Context, id int) (*api2.Report, error) {
func (a *API) GetReport(ctx context.Context, id int) (*api.Report, error) {
var response getReportResponse
path := fmt.Sprintf("/hackers/reports/%d", id)
if err := a.client.Get(ctx, path, &response); err != nil {
Expand All @@ -35,7 +35,7 @@ func (a *API) GetReport(ctx context.Context, id int) (*api2.Report, error) {
}

// GetReports returns a list of reports made by the hacker. If there are further pages, nextPage will be >0.
func (a *API) GetReports(ctx context.Context, pageOptions *api2.PageOptions) (reports []api2.Report, nextPage int, err error) {
func (a *API) GetReports(ctx context.Context, pageOptions *api.PageOptions) (reports []api.Report, nextPage int, err error) {
var response getReportsResponse
path := fmt.Sprintf(
"/hackers/me/reports?page[number]=%d&page[size]=%d",
Expand All @@ -52,7 +52,7 @@ func (a *API) GetReports(ctx context.Context, pageOptions *api2.PageOptions) (re
}

// CreateReport creates a new report. See https://api.hackerone.com/hacker-resources/#reports-create-report
func (a *API) CreateReport(ctx context.Context, report *api2.CreateReportInput) (*api2.Report, error) {
func (a *API) CreateReport(ctx context.Context, report *api.CreateReportInput) (*api.Report, error) {
if report == nil {
return nil, fmt.Errorf("report input cannot be nil")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/hackers/structuredscopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/liamg/hackerone/pkg/api"
"github.com/sam-bee/security-hackerone-api-client/pkg/api"
)

type getStructuredScopesResponse struct {
Expand Down

0 comments on commit 38d1240

Please sign in to comment.