Skip to content

Commit eab5276

Browse files
committed
Merge branch 'dev'
2 parents 64f9fc4 + 2d33751 commit eab5276

30 files changed

+1561
-258
lines changed

.github/dependabot.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ updates:
1515
commit-message:
1616
prefix: "chore"
1717
include: "scope"
18+
labels:
19+
- "Type: Maintenance"
1820

1921
# Maintain dependencies for go modules
2022
- package-ecosystem: "gomod"
@@ -25,6 +27,8 @@ updates:
2527
commit-message:
2628
prefix: "chore"
2729
include: "scope"
30+
labels:
31+
- "Type: Maintenance"
2832

2933
# Maintain dependencies for docker
3034
- package-ecosystem: "docker"
@@ -34,4 +38,6 @@ updates:
3438
target-branch: "dev"
3539
commit-message:
3640
prefix: "chore"
37-
include: "scope"
41+
include: "scope"
42+
labels:
43+
- "Type: Maintenance"

.github/workflows/build-test.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ on:
33
pull_request:
44
workflow_dispatch:
55

6-
76
jobs:
87
build:
98
name: Test Builds
109
runs-on: ubuntu-latest
1110
steps:
1211
- name: Set up Go
13-
uses: actions/setup-go@v3
12+
uses: actions/setup-go@v4
1413
with:
15-
go-version: 1.18
14+
go-version: 1.19
1615

1716
- name: Check out code
1817
uses: actions/checkout@v3

.github/workflows/dockerhub-push.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
- name: Get Github tag
1818
id: meta
1919
run: |
20-
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/notify/releases/latest" | jq -r .tag_name)"
20+
curl --silent "https://api.github.com/repos/projectdiscovery/notify/releases/latest" | jq -r .tag_name | xargs -I {} echo TAG={} >> $GITHUB_OUTPUT
21+
2122
- name: Set up QEMU
2223
uses: docker/setup-qemu-action@v2
2324

@@ -31,7 +32,7 @@ jobs:
3132
password: ${{ secrets.DOCKER_TOKEN }}
3233

3334
- name: Build and push
34-
uses: docker/build-push-action@v3
35+
uses: docker/build-push-action@v4
3536
with:
3637
context: .
3738
platforms: linux/amd64,linux/arm64,linux/arm

.github/workflows/lint-test.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: 🙏🏻 Lint Test
22
on:
3-
push:
43
pull_request:
54
workflow_dispatch:
65

@@ -9,10 +8,16 @@ jobs:
98
name: Lint Test
109
runs-on: ubuntu-latest
1110
steps:
11+
- name: Set up Go
12+
uses: actions/setup-go@v4
13+
with:
14+
go-version: 1.19
15+
1216
- name: Checkout code
1317
uses: actions/checkout@v3
18+
1419
- name: Run golangci-lint
15-
uses: golangci/golangci-lint-action@v3.2.0
20+
uses: golangci/golangci-lint-action@v3.4.0
1621
with:
1722
version: latest
1823
args: --timeout 5m

.github/workflows/release-binary.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🎉 Release Binary
2+
23
on:
3-
create:
4+
push:
45
tags:
56
- v*
67
workflow_dispatch:
@@ -15,16 +16,18 @@ jobs:
1516
fetch-depth: 0
1617

1718
- name: "Set up Go"
18-
uses: actions/setup-go@v3
19+
uses: actions/setup-go@v4
1920
with:
20-
go-version: 1.18
21+
go-version: 1.19
2122

2223
- name: "Create release on GitHub"
23-
uses: goreleaser/goreleaser-action@v3
24+
uses: goreleaser/goreleaser-action@v4
2425
with:
2526
args: "release --rm-dist"
2627
version: latest
2728
workdir: .
2829
env:
2930
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30-
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
31+
SLACK_WEBHOOK: "${{ secrets.RELEASE_SLACK_WEBHOOK }}"
32+
DISCORD_WEBHOOK_ID: "${{ secrets.DISCORD_WEBHOOK_ID }}"
33+
DISCORD_WEBHOOK_TOKEN: "${{ secrets.DISCORD_WEBHOOK_TOKEN }}"

.goreleaser.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ announce:
3737
enabled: true
3838
channel: '#release'
3939
username: GoReleaser
40-
message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}'
40+
message_template: 'New Release: {{ .ProjectName }} {{.Tag}} is published! Check it out at {{ .ReleaseURL }}'
41+
42+
discord:
43+
enabled: true
44+
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'

Dockerfile

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
FROM golang:1.19.2-alpine as build-env
2-
RUN go install -v github.com/projectdiscovery/notify/cmd/notify@latest
1+
# Base
2+
FROM golang:1.20.3-alpine AS builder
3+
RUN apk add --no-cache build-base
4+
WORKDIR /app
5+
COPY . /app
6+
RUN go mod download
7+
RUN go build ./cmd/notify
38

4-
FROM alpine:latest
5-
COPY --from=build-env /go/bin/notify /usr/local/bin/notify
9+
# Release
10+
FROM alpine:3.17.3
11+
RUN apk -U upgrade --no-cache \
12+
&& apk add --no-cache bind-tools ca-certificates
13+
COPY --from=builder /app/notify /usr/local/bin/
614

7-
ENTRYPOINT ["notify"]
15+
ENTRYPOINT ["notify"]

README.md

+39-18
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,25 @@ notify -h
5252

5353
This will display help for the tool. Here are all the switches it supports.
5454

55-
| Flag | Description | Example |
56-
|--------------------|----------------------------------------------------|---------------------------------------|
57-
| `-bulk` | enable bulk processing | `notify -bulk` |
58-
| `-char-limit` | max character limit per message (default 4000) | `notify -cl 2000` |
59-
| `-config` | notify configuration file | `notify -config config.yaml` |
60-
| `-data` | input file to send for notify | `notify -i test.txt` |
61-
| `-delay` | delay in seconds between each notification | `notify -d 2` |
62-
| `-id` | id to send the notification to (optional) | `notify -id recon,scans` |
63-
| `-msg-format` | add custom formatting to message | `notify -mf Hey {{data}}` |
64-
| `-no-color` | disable colors in output | `notify -nc` |
65-
| `-provider-config` | provider config path | `notify -pc provider.yaml` |
66-
| `-provider` | provider to send the notification to (optional) | `notify -p slack,telegram` |
67-
| `-proxy` | http proxy to use with notify | `notify -proxy http://127.0.0.1:8080` |
68-
| `-rate-limit` | maximum number of HTTP requests to send per second | `notify -rl 1` |
69-
| `-silent` | enable silent mode | `notify -silent` |
70-
| `-verbose` | enable verbose mode | `notify -verbose` |
71-
| `-version` | display version | `notify -version` |
72-
55+
| Flag | Description | Example |
56+
|-------------------------|----------------------------------------------------|---------------------------------------|
57+
| `-bulk` | enable bulk processing | `notify -bulk` |
58+
| `-char-limit` | max character limit per message (default 4000) | `notify -cl 2000` |
59+
| `-config` | notify configuration file | `notify -config config.yaml` |
60+
| `-data` | input file to send for notify | `notify -i test.txt` |
61+
| `-delay` | delay in seconds between each notification | `notify -d 2` |
62+
| `-id` | id to send the notification to (optional) | `notify -id recon,scans` |
63+
| `-msg-format` | add custom formatting to message | `notify -mf Hey {{data}}` |
64+
| `-no-color` | disable colors in output | `notify -nc` |
65+
| `-provider-config` | provider config path | `notify -pc provider.yaml` |
66+
| `-provider` | provider to send the notification to (optional) | `notify -p slack,telegram` |
67+
| `-proxy` | http proxy to use with notify | `notify -proxy http://127.0.0.1:8080` |
68+
| `-rate-limit` | maximum number of HTTP requests to send per second | `notify -rl 1` |
69+
| `-silent` | enable silent mode | `notify -silent` |
70+
| `-verbose` | enable verbose mode | `notify -verbose` |
71+
| `-version` | display version | `notify -version` |
72+
| `-update` | updates to latest version | `notify -update` |
73+
| `-disable-update-check` | disables automatic update check | `notify -duc` |
7374

7475
# Notify Installation
7576

@@ -133,6 +134,8 @@ smtp:
133134
134135
smtp_format: "{{data}}"
135136
subject: "Email subject"
137+
smtp_html: false
138+
smtp_disable_starttls: false
136139

137140
googlechat:
138141
- id: "gc"
@@ -154,6 +157,24 @@ custom:
154157
custom_headers:
155158
Content-Type: application/json
156159
X-Api-Key: XXXXX
160+
161+
custom:
162+
- id: webhookJson
163+
custom_webhook_url: http://host/api/webhook
164+
custom_method: GET
165+
custom_format: '{"text":{{dataJsonString}} }'
166+
custom_headers:
167+
Content-Type: application/json
168+
X-Api-Key: XXXXX
169+
170+
custom:
171+
- id: webhook
172+
custom_webhook_url: http://host/api/webhook
173+
custom_method: GET
174+
custom_sprig: '{"text":"{{ .url }}"}'
175+
custom_headers:
176+
Content-Type: application/json
177+
X-Api-Key: XXXXX
157178
```
158179
159180
# Running Notify

cmd/integration-test/integration.go

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77

88
"github.com/logrusorgru/aurora"
9+
910
"github.com/projectdiscovery/notify/internal/testutils"
1011
)
1112

cmd/integration-test/providers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func run(provider string) error {
2020
return errIncorrectResultsCount(results)
2121
}
2222
for _, r := range results {
23-
if !strings.Contains(r, provider) {
23+
if !strings.Contains(strings.ToLower(r), strings.ToLower(provider)) {
2424
return fmt.Errorf("incorrect result %s", results[0])
2525
}
2626
}

cmd/notify/notify.go

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ func readConfig() {
6464
set.BoolVar(&options.Version, "version", false, "display version")
6565
set.BoolVarP(&options.NoColor, "no-color", "nc", false, "disable colors in output")
6666
set.StringVar(&options.Proxy, "proxy", "", "HTTP Proxy to use with notify")
67+
set.CallbackVarP(runner.GetUpdateCallback(), "update", "up", "update notify to latest version")
68+
set.BoolVarP(&options.DisableUpdateCheck, "disable-update-check", "duc", false, "disable automatic notify update check")
6769

6870
_ = set.Parse()
6971

go.mod

+60-20
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,80 @@
11
module github.com/projectdiscovery/notify
22

3-
go 1.17
3+
go 1.19
44

55
require (
6+
github.com/Masterminds/sprig v2.22.0+incompatible
67
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
7-
github.com/containrrr/shoutrrr v0.6.1
8+
github.com/containrrr/shoutrrr v0.7.1
89
github.com/json-iterator/go v1.1.12
910
github.com/logrusorgru/aurora v2.0.3+incompatible
1011
github.com/oriser/regroup v0.0.0-20210730155327-fca8d7531263
1112
github.com/pkg/errors v0.9.1
12-
github.com/projectdiscovery/fileutil v0.0.0-20220705195237-01becc2a8963
13-
github.com/projectdiscovery/goflags v0.1.0
14-
github.com/projectdiscovery/gologger v1.1.4
15-
github.com/projectdiscovery/sliceutil v0.0.0-20220625085859-c3a4ecb669f4
16-
go.uber.org/multierr v1.8.0
13+
github.com/projectdiscovery/goflags v0.1.8
14+
github.com/projectdiscovery/gologger v1.1.10
15+
github.com/projectdiscovery/utils v0.0.32
16+
go.uber.org/multierr v1.11.0
1717
go.uber.org/ratelimit v0.2.0
18-
gopkg.in/yaml.v2 v2.4.0
18+
gopkg.in/yaml.v3 v3.0.1
1919
)
2020

2121
require (
22+
aead.dev/minisign v0.2.0 // indirect
23+
github.com/Masterminds/goutils v1.1.1 // indirect
24+
github.com/Masterminds/semver v1.5.0 // indirect
25+
github.com/Masterminds/semver/v3 v3.2.1 // indirect
26+
github.com/VividCortex/ewma v1.2.0 // indirect
27+
github.com/alecthomas/chroma v0.10.0 // indirect
2228
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
23-
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
29+
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
30+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
2431
github.com/aymerick/douceur v0.2.0 // indirect
32+
github.com/charmbracelet/glamour v0.6.0 // indirect
33+
github.com/cheggaaa/pb/v3 v3.1.2 // indirect
2534
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
26-
github.com/fatih/color v1.10.0 // indirect
35+
github.com/dlclark/regexp2 v1.10.0 // indirect
36+
github.com/dsnet/compress v0.0.1 // indirect
37+
github.com/fatih/color v1.15.0 // indirect
38+
github.com/golang/protobuf v1.5.3 // indirect
39+
github.com/golang/snappy v0.0.4 // indirect
40+
github.com/google/go-github/v30 v30.1.0 // indirect
41+
github.com/google/go-querystring v1.1.0 // indirect
42+
github.com/google/uuid v1.3.0 // indirect
2743
github.com/gorilla/css v1.0.0 // indirect
28-
github.com/mattn/go-colorable v0.1.8 // indirect
29-
github.com/mattn/go-isatty v0.0.12 // indirect
30-
github.com/microcosm-cc/bluemonday v1.0.20 // indirect
44+
github.com/huandu/xstrings v1.4.0 // indirect
45+
github.com/imdario/mergo v0.3.15 // indirect
46+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
47+
github.com/mattn/go-colorable v0.1.13 // indirect
48+
github.com/mattn/go-isatty v0.0.18 // indirect
49+
github.com/mattn/go-runewidth v0.0.14 // indirect
50+
github.com/mholt/archiver v3.1.1+incompatible // indirect
51+
github.com/microcosm-cc/bluemonday v1.0.23 // indirect
52+
github.com/miekg/dns v1.1.54 // indirect
53+
github.com/minio/selfupdate v0.6.0 // indirect
54+
github.com/mitchellh/copystructure v1.2.0 // indirect
55+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
3156
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3257
github.com/modern-go/reflect2 v1.0.2 // indirect
33-
github.com/projectdiscovery/stringsutil v0.0.1 // indirect
34-
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
35-
go.uber.org/atomic v1.7.0 // indirect
36-
golang.org/x/net v0.7.0 // indirect
37-
golang.org/x/sys v0.5.0 // indirect
38-
google.golang.org/protobuf v1.25.0 // indirect
39-
gopkg.in/yaml.v3 v3.0.1 // indirect
58+
github.com/muesli/reflow v0.3.0 // indirect
59+
github.com/muesli/termenv v0.15.1 // indirect
60+
github.com/nwaples/rardecode v1.1.3 // indirect
61+
github.com/olekukonko/tablewriter v0.0.5 // indirect
62+
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
63+
github.com/projectdiscovery/blackrock v0.0.1 // indirect
64+
github.com/rivo/uniseg v0.4.4 // indirect
65+
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
66+
github.com/ulikunitz/xz v0.5.11 // indirect
67+
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
68+
github.com/yuin/goldmark v1.5.4 // indirect
69+
github.com/yuin/goldmark-emoji v1.0.1 // indirect
70+
golang.org/x/crypto v0.9.0 // indirect
71+
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
72+
golang.org/x/mod v0.10.0 // indirect
73+
golang.org/x/net v0.10.0 // indirect
74+
golang.org/x/oauth2 v0.8.0 // indirect
75+
golang.org/x/sys v0.8.0 // indirect
76+
golang.org/x/tools v0.9.1 // indirect
77+
google.golang.org/appengine v1.6.7 // indirect
78+
google.golang.org/protobuf v1.30.0 // indirect
79+
gopkg.in/djherbis/times.v1 v1.3.0 // indirect
4080
)

0 commit comments

Comments
 (0)