Skip to content

Commit d3e4d89

Browse files
committed
Merge branch 'add-headers' of github.com:edoardottt/pphack into add-headers
2 parents 76d0e7f + 9d21298 commit d3e4d89

13 files changed

Lines changed: 258 additions & 18 deletions

File tree

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
categories:
6+
- title: 🎉 New Features
7+
labels:
8+
- "Type: Enhancement"
9+
- title: 🐞 Bug Fixes
10+
labels:
11+
- "Type: Bug"
12+
- title: 🔨 Maintenance
13+
labels:
14+
- "Type: Maintenance"
15+
- title: Other Changes
16+
labels:
17+
- "*"

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: golangci/golangci-lint-action@v3
2525
with:
2626
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27-
version: v1.61.0
27+
version: v1.61
2828
args: --timeout=5m
2929

3030
# Optional: working directory, useful for monorepos
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 🎉 Release Binary
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: "Check out code"
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
18+
- name: "Set up Go"
19+
uses: actions/setup-go@v4
20+
with:
21+
go-version: 1.23.x
22+
23+
- name: "Create release on GitHub"
24+
timeout-minutes: 10
25+
uses: goreleaser/goreleaser-action@v4
26+
with:
27+
args: "release --clean"
28+
version: latest
29+
workdir: .
30+
env:
31+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/release-test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 🔨 Release Test
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.go'
7+
- '**.mod'
8+
workflow_dispatch:
9+
10+
jobs:
11+
release-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: "Check out code"
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: 1.23.x
23+
24+
- name: release test
25+
uses: goreleaser/goreleaser-action@v4
26+
with:
27+
args: "release --clean --snapshot"
28+
version: latest

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ linters:
3333
- staticcheck
3434
- stylecheck
3535
- testpackage
36-
- typecheck
3736
- unconvert
3837
- unparam
3938
- unused

.goreleaser.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
release:
2+
header: |
3+
## pphack {{ .Tag }} 🥳
4+
*The Most Advanced Client-Side Prototype Pollution Scanner*
5+
6+
footer: |
7+
If you encounter a problem, just open an [issue](https://github.com/edoardottt/pphack/issues)
8+
9+
before:
10+
hooks:
11+
- go mod tidy
12+
13+
builds:
14+
- env:
15+
- CGO_ENABLED=0
16+
goos:
17+
- linux
18+
- windows
19+
- darwin
20+
goarch:
21+
- amd64
22+
- 386
23+
- arm
24+
- arm64
25+
ignore:
26+
- goos: darwin
27+
goarch: '386'
28+
- goos: windows
29+
goarch: 'arm'
30+
- goos: windows
31+
goarch: 'arm64'
32+
binary: '{{ .ProjectName }}'
33+
main: ./cmd/pphack/
34+
35+
archives:
36+
- format: zip
37+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}'
38+
39+
checksum:
40+
algorithm: sha256
41+

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Install 📡
4545
go install github.com/edoardottt/pphack/cmd/pphack@latest
4646
```
4747

48+
pphack relies on [`chromedp`](https://github.com/chromedp/chromedp), so you need a Chrome or Chromium browser.
49+
4850
Get Started 🎉
4951
----------
5052

@@ -75,6 +77,7 @@ OUTPUT:
7577
-o, -output string File to write output results
7678
-v, -verbose Verbose output
7779
-s, -silent Silent output. Print only results
80+
-j, -json JSON output
7881
```
7982

8083
Examples 💡
@@ -124,4 +127,4 @@ License 📝
124127
-------
125128

126129
This repository is under [MIT License](https://github.com/edoardottt/pphack/blob/main/LICENSE).
127-
[edoardoottavianelli.it](https://www.edoardoottavianelli.it) to contact me.
130+
[edoardottt.com](https://edoardottt.com/) to contact me.

pkg/input/flags.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type Options struct {
4141
RateLimit int
4242
Silent bool
4343
Verbose bool
44+
JSON bool
4445
}
4546

4647
func (options *Options) configureOutput() {
@@ -89,6 +90,7 @@ func ParseOptions() *Options {
8990
flagSet.StringVarP(&options.FileOutput, "output", "o", "", `File to write output results`),
9091
flagSet.BoolVarP(&options.Verbose, "verbose", "v", false, `Verbose output`),
9192
flagSet.BoolVarP(&options.Silent, "silent", "s", false, `Silent output. Print only results`),
93+
flagSet.BoolVarP(&options.JSON, "json", "j", false, `JSON output`),
9294
)
9395

9496
if help() || noArgs() {

pkg/output/banner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import "github.com/projectdiscovery/gologger"
1111
var printed = false
1212

1313
const (
14-
Version = "v0.1.0"
14+
Version = "v0.0.5"
1515
banner = ` __ __
1616
____ ____ / /_ ____ ______/ /__
1717
/ __ \/ __ \/ __ \/ __ ` + "`" + `/ ___/ //_/

pkg/output/json.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
pphack - The Most Advanced Client-Side Prototype Pollution Scanner
3+
4+
This repository is under MIT License https://github.com/edoardottt/pphack/blob/main/LICENSE
5+
*/
6+
7+
package output
8+
9+
import "encoding/json"
10+
11+
// JSONData.
12+
type JSONData struct {
13+
URL string `json:"URL,omitempty"`
14+
JSEvaluation string `json:"JSEvaluation,omitempty"`
15+
Error string `json:"Error,omitempty"`
16+
}
17+
18+
// FormatJSON returns the input as JSON string.
19+
func FormatJSON(url, jsEval, e string) ([]byte, error) {
20+
input := &JSONData{
21+
URL: url,
22+
JSEvaluation: jsEval,
23+
Error: e,
24+
}
25+
26+
jsonOutput, err := json.Marshal(input)
27+
if err != nil {
28+
return nil, err
29+
}
30+
31+
return jsonOutput, nil
32+
}

0 commit comments

Comments
 (0)