From 0d9edde2ef33babfa553caa80f6bf7aab7fc74ce Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Sat, 21 Nov 2020 00:54:20 +0100 Subject: [PATCH 01/72] updating go modules --- go.mod | 4 ++-- go.sum | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index f6b1562..20aab2a 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/projectdiscovery/collaborator v0.0.1 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 - golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582 // indirect + golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect - golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48 // indirect + golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect ) diff --git a/go.sum b/go.sum index 9460a9a..bf26e56 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582 h1:0WDrJ1E7UolDk1KhTXxxw3Fc8qtk5x7dHP431KHEJls= golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582/go.mod h1:tCqSYrHVcf3i63Co2FzBkTCo2gdF6Zak62921dSfraU= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -42,7 +44,10 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48 h1:AYCWBZhgIw6XobZ5CibNJr0Rc4ZofGGKvWa1vcx2IGk= golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From ae53e0c9029c18a43c953c32336736893df23374 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Sat, 21 Nov 2020 19:08:13 +0100 Subject: [PATCH 02/72] adding email notification --- go.mod | 4 --- go.sum | 29 +++---------------- internal/runner/config.go | 7 +++++ internal/runner/options.go | 27 +++++++++++++++++ internal/runner/runner.go | 4 +++ notify.go | 15 +++++++++- options.go | 7 ++++- smtp.go | 59 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 121 insertions(+), 31 deletions(-) create mode 100644 smtp.go diff --git a/go.mod b/go.mod index 20aab2a..d59f9b3 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,7 @@ go 1.14 require ( github.com/Shopify/yaml v2.1.0+incompatible github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/logrusorgru/aurora v2.0.3+incompatible // indirect github.com/projectdiscovery/collaborator v0.0.1 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 - golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect - golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect - golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect ) diff --git a/go.sum b/go.sum index bf26e56..8bb0952 100644 --- a/go.sum +++ b/go.sum @@ -2,15 +2,12 @@ github.com/Shopify/yaml v2.1.0+incompatible h1:Y7Wj6eQo5Byeaxb2M9FiPdKBQ3ooLsRIE github.com/Shopify/yaml v2.1.0+incompatible/go.mod h1:Mrsv1G5Osez+VdHYcSI2zfaUzPu4lCdO9cW8R2lHPEc= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= -github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/projectdiscovery/collaborator v0.0.1 h1:dbQ5BCL/a3c+BB9cGtrGgiLs23+EfSzoaTzX/pxqiTI= github.com/projectdiscovery/collaborator v0.0.1/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= @@ -19,42 +16,24 @@ github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLY github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582 h1:0WDrJ1E7UolDk1KhTXxxw3Fc8qtk5x7dHP431KHEJls= -golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582/go.mod h1:tCqSYrHVcf3i63Co2FzBkTCo2gdF6Zak62921dSfraU= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48 h1:AYCWBZhgIw6XobZ5CibNJr0Rc4ZofGGKvWa1vcx2IGk= -golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201113234701-d7a72108b828/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/runner/config.go b/internal/runner/config.go index dbf10c5..4e82da2 100644 --- a/internal/runner/config.go +++ b/internal/runner/config.go @@ -5,6 +5,7 @@ import ( "path" "github.com/Shopify/yaml" + "github.com/projectdiscovery/notify" ) // ConfigDefaultFilename containing configuration @@ -31,10 +32,16 @@ type ConfigFile struct { TelegramChatID string `yaml:"telegram_chat_id,omitempty"` Telegram bool `yaml:"telegram,omitempty"` + // SMTP + SMTPProviders []notify.SMTPProvider `yaml:"smtp_providers,omitempty"` + SMTPCC []string `yaml:"smtp_cc,omitempty"` + SMTP bool `yaml:"smtp,omitempty"` + Interval int `yaml:"interval,omitempty"` HTTPMessage string `yaml:"http_message,omitempty"` DNSMessage string `yaml:"dns_message,omitempty"` CLIMessage string `yaml:"cli_message,omitempty"` + SMTPMessage string `yaml:"smtp_message,omitempty"` } // GetConfigDirectory from the system diff --git a/internal/runner/options.go b/internal/runner/options.go index 74abbe3..0b5aa0f 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -8,6 +8,7 @@ import ( "os" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/notify" ) // Options of the internal runner @@ -25,6 +26,9 @@ type Options struct { TelegramAPIKey string TelegramChatID string Telegram bool + SMTP bool + SMTPProviders []notify.SMTPProvider + SMTPCC []string Verbose bool NoColor bool Silent bool @@ -33,6 +37,7 @@ type Options struct { HTTPMessage string DNSMessage string CLIMessage string + SMTPMessage string } // ParseConfigFileOrOptions combining all settings @@ -59,6 +64,7 @@ func ParseConfigFileOrOptions() *Options { flag.StringVar(&options.HTTPMessage, "message-http", defaultHTTPMessage, "HTTP Message") flag.StringVar(&options.DNSMessage, "message-dns", defaultDNSMessage, "DNS Message") flag.StringVar(&options.CLIMessage, "message-cli", defaultCLIMessage, "CLI Message") + flag.StringVar(&options.SMTPMessage, "message-smtp", defaultSMTPMessage, "SMTP Message") flag.Parse() @@ -132,6 +138,14 @@ func (options *Options) writeDefaultConfig() { dummyConfig.TelegramAPIKey = "123456879" dummyConfig.TelegramChatID = "123" dummyConfig.Telegram = true + dummyConfig.SMTPProviders = append(dummyConfig.SMTPProviders, notify.SMTPProvider{ + AuthenticationType: "basic", + Server: "smtp.server.something:25", + Username: "myusername@oremail.address", + Password: "mysecretpassword", + }) + dummyConfig.SMTPCC = append(dummyConfig.SMTPCC, "receiver@email.address") + dummyConfig.SMTP = true dummyConfig.Interval = 2 dummyConfig.HTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n" + "```\n" + @@ -143,6 +157,7 @@ func (options *Options) writeDefaultConfig() { "{{request}}\n" + "```" dummyConfig.CLIMessage = "{{data}}" + dummyConfig.SMTPMessage = "{{data}}" err = dummyConfig.MarshalWrite(configFile) if err != nil { @@ -225,6 +240,15 @@ func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) if configFile.Telegram { options.Telegram = configFile.Telegram } + if len(configFile.SMTPProviders) > 0 { + options.SMTPProviders = configFile.SMTPProviders + } + if len(configFile.SMTPCC) > 0 { + options.SMTPCC = configFile.SMTPCC + } + if configFile.SMTP { + options.SMTP = configFile.SMTP + } if configFile.HTTPMessage != "" { options.HTTPMessage = configFile.HTTPMessage } @@ -234,6 +258,9 @@ func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) if configFile.CLIMessage != "" { options.CLIMessage = configFile.CLIMessage } + if configFile.SMTPMessage != "" { + options.SMTPMessage = configFile.SMTPMessage + } if configFile.Interval > 0 { options.Interval = configFile.Interval } diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d85fe76..ed7ef05 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -17,6 +17,7 @@ const ( defaultHTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n```\n{{request}}\n{{response}}```" defaultDNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n```{{request}}```" defaultCLIMessage = "{{data}}" + defaultSMTPMessage = "{{data}}" ) // Runner contains the internal logic of the program @@ -42,6 +43,9 @@ func NewRunner(options *Options) (*Runner, error) { TelegramAPIKey: options.TelegramAPIKey, TelegramChatID: options.TelegramChatID, Telegram: options.Telegram, + SMTP: options.SMTP, + SMTPProviders: options.SMTPProviders, + SMTPCC: options.SMTPCC, }) if err != nil { return nil, err diff --git a/notify.go b/notify.go index deff75e..0cbcd9e 100644 --- a/notify.go +++ b/notify.go @@ -12,6 +12,7 @@ type Notify struct { slackClient *SlackClient discordClient *DiscordClient telegramClient *TelegramClient + smtpClient *SMTPClient } // New notify instance @@ -44,7 +45,12 @@ func NewWithOptions(options *Options) (*Notify, error) { apiKEY: options.TelegramAPIKey, chatID: options.TelegramChatID, } - return &Notify{options: options, slackClient: SlackClient, discordClient: discordClient, telegramClient: telegramClient}, nil + smtpClient := &SMTPClient{ + Providers: options.SMTPProviders, + CC: options.SMTPCC, + } + + return &Notify{options: options, slackClient: SlackClient, discordClient: discordClient, telegramClient: telegramClient, smtpClient: smtpClient}, nil } // SendNotification to registered webhooks @@ -72,5 +78,12 @@ func (n *Notify) SendNotification(message string) error { } } + if n.options.SMTP { + err := n.smtpClient.SendInfo(message) + if err != nil { + return err + } + } + return nil } diff --git a/options.go b/options.go index 2d442bd..0364200 100644 --- a/options.go +++ b/options.go @@ -1,6 +1,6 @@ package notify -// Options of internal webhooks +// Options of internal notifications //nolint:maligned // used once type Options struct { // Slack @@ -19,4 +19,9 @@ type Options struct { TelegramAPIKey string TelegramChatID string Telegram bool + + // SMTP + SMTP bool + SMTPProviders []SMTPProvider + SMTPCC []string } diff --git a/smtp.go b/smtp.go new file mode 100644 index 0000000..9304a8f --- /dev/null +++ b/smtp.go @@ -0,0 +1,59 @@ +package notify + +import ( + "net/smtp" + "time" + + "github.com/projectdiscovery/gologger" +) + +// DefaultTelegraTimeout to conclude operations +const ( + DefaultSMTPTimeout = 10 * time.Second +) + +type AuthenticationType int + +const ( + PlainAuth = iota + 1 + CRAMMD5Auth +) + +type SMTPProvider struct { + Server string `yaml:"smtp_server,omitempty"` + Username string `yaml:"smtp_username,omitempty"` + Password string `yaml:"smtp_password,omitempty"` + AuthenticationType string `yaml:"smtp_authentication_type,omitempty"` +} + +// TelegramClient handling webhooks +type SMTPClient struct { + Providers []SMTPProvider + CC []string + TimeOut time.Duration +} + +// SendInfo to telegram +func (sm *SMTPClient) SendInfo(message string) (err error) { + // Create connection if not done already + for _, provider := range sm.Providers { + var auth smtp.Auth + if provider.AuthenticationType == "basic" { + auth = smtp.PlainAuth("", provider.Username, provider.Password, provider.Server) + } else if provider.AuthenticationType == "crammd5" { + auth = smtp.CRAMMD5Auth(provider.Username, provider.Password) + } else if provider.AuthenticationType == "none" { + auth = nil + } else { + continue + } + + err := smtp.SendMail(provider.Server, auth, provider.Username, sm.CC, []byte(message)) + if err != nil { + gologger.Errorf("%s\n", err) + return err + } + } + + return nil +} From c87ce3ced376e2323ee854609a46c7f9ad398a34 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Sun, 22 Nov 2020 18:36:09 +0100 Subject: [PATCH 03/72] adding smtp interaction support --- go.mod | 2 +- go.sum | 2 ++ internal/runner/config.go | 2 +- internal/runner/options.go | 15 ++++++++++----- internal/runner/runner.go | 22 ++++++++++++++++++---- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index d59f9b3..6b8cc65 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/Shopify/yaml v2.1.0+incompatible github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/projectdiscovery/collaborator v0.0.1 + github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 ) diff --git a/go.sum b/go.sum index 8bb0952..21f4b64 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,8 @@ github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/projectdiscovery/collaborator v0.0.1 h1:dbQ5BCL/a3c+BB9cGtrGgiLs23+EfSzoaTzX/pxqiTI= github.com/projectdiscovery/collaborator v0.0.1/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= +github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed h1:0B4ccP68IL6MNHz99dAFeh0E3AY7fU5wVYwZJVX8ZG4= +github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= diff --git a/internal/runner/config.go b/internal/runner/config.go index 4e82da2..50d720a 100644 --- a/internal/runner/config.go +++ b/internal/runner/config.go @@ -40,8 +40,8 @@ type ConfigFile struct { Interval int `yaml:"interval,omitempty"` HTTPMessage string `yaml:"http_message,omitempty"` DNSMessage string `yaml:"dns_message,omitempty"` - CLIMessage string `yaml:"cli_message,omitempty"` SMTPMessage string `yaml:"smtp_message,omitempty"` + CLIMessage string `yaml:"cli_message,omitempty"` } // GetConfigDirectory from the system diff --git a/internal/runner/options.go b/internal/runner/options.go index 0b5aa0f..04be2ca 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -63,8 +63,8 @@ func ParseConfigFileOrOptions() *Options { flag.IntVar(&options.Interval, "interval", 2, "Polling interval in seconds") flag.StringVar(&options.HTTPMessage, "message-http", defaultHTTPMessage, "HTTP Message") flag.StringVar(&options.DNSMessage, "message-dns", defaultDNSMessage, "DNS Message") - flag.StringVar(&options.CLIMessage, "message-cli", defaultCLIMessage, "CLI Message") flag.StringVar(&options.SMTPMessage, "message-smtp", defaultSMTPMessage, "SMTP Message") + flag.StringVar(&options.CLIMessage, "message-cli", defaultCLIMessage, "CLI Message") flag.Parse() @@ -156,8 +156,13 @@ func (options *Options) writeDefaultConfig() { "```\n" + "{{request}}\n" + "```" + dummyConfig.SMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}.\n" + + "The email details were:\n\n" + + "From:\n{{sender}}\n\n" + + "To:\n{{recipients}}\n\n" + + "Message:\n{{message}}\n\n" + + "SMTP Conversation:\n{{conversation}}" dummyConfig.CLIMessage = "{{data}}" - dummyConfig.SMTPMessage = "{{data}}" err = dummyConfig.MarshalWrite(configFile) if err != nil { @@ -255,12 +260,12 @@ func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) if configFile.DNSMessage != "" { options.DNSMessage = configFile.DNSMessage } - if configFile.CLIMessage != "" { - options.CLIMessage = configFile.CLIMessage - } if configFile.SMTPMessage != "" { options.SMTPMessage = configFile.SMTPMessage } + if configFile.CLIMessage != "" { + options.CLIMessage = configFile.CLIMessage + } if configFile.Interval > 0 { options.Interval = configFile.Interval } diff --git a/internal/runner/runner.go b/internal/runner/runner.go index ed7ef05..b32fac6 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -16,8 +16,8 @@ import ( const ( defaultHTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n```\n{{request}}\n{{response}}```" defaultDNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n```{{request}}```" + defaultSMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}\n\nThe email details were:\n\nFrom:\n{{sender}}\n\nTo:\n{{recipients}}\n\nMessage:\n{{message}}\n\nSMTP Conversation:\n{{conversation}}" defaultCLIMessage = "{{data}}" - defaultSMTPMessage = "{{data}}" ) // Runner contains the internal logic of the program @@ -100,7 +100,8 @@ func (r *Runner) Run() error { var at int64 at, _ = strconv.ParseInt(resp.Time, 10, 64) atTime := time.Unix(0, at*int64(time.Millisecond)) - if resp.Protocol == "http" || resp.Protocol == "https" { + switch resp.Protocol { + case "http", "https": rr := strings.NewReplacer( "{{protocol}}", strings.ToUpper(resp.Protocol), "{{from}}", resp.Client, @@ -114,8 +115,7 @@ func (r *Runner) Run() error { //nolint:errcheck // silent fail r.notifier.SendNotification(msg) - } - if resp.Protocol == "dns" { + case "dns": rr := strings.NewReplacer( "{{type}}", resp.Data.RequestType, "{{domain}} ", resp.Data.SubDomain, @@ -126,6 +126,20 @@ func (r *Runner) Run() error { msg := rr.Replace(r.options.DNSMessage) gologger.Printf(msg) + //nolint:errcheck // silent fail + r.notifier.SendNotification(msg) + case "smtp": + rr := strings.NewReplacer( + "{{from}}", resp.Client, + "{{time}}", atTime.String(), + "{{sender}}", resp.Data.SenderDecoded, + "{{recipients}}", strings.Join(resp.Data.RecipientsDecoded, ","), + "{{message}}", resp.Data.MessageDecoded, + "{{conversation}}", resp.Data.ConversationDecoded, + ) + msg := rr.Replace(r.options.SMTPMessage) + gologger.Printf(msg) + //nolint:errcheck // silent fail r.notifier.SendNotification(msg) } From daf46a8bab1b04e0b3159e976f81c34d003bf82a Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 26 Nov 2020 16:24:07 +0100 Subject: [PATCH 04/72] updating go modules --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6b8cc65..b95d82e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/Shopify/yaml v2.1.0+incompatible github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed + github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 ) diff --git a/go.sum b/go.sum index 21f4b64..54c0ed4 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/projectdiscovery/collaborator v0.0.1 h1:dbQ5BCL/a3c+BB9cGtrGgiLs23+Ef github.com/projectdiscovery/collaborator v0.0.1/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed h1:0B4ccP68IL6MNHz99dAFeh0E3AY7fU5wVYwZJVX8ZG4= github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= +github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= +github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= From 54095ef2b23301092429329834b6cc9774be6be8 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 27 Nov 2020 00:17:02 +0100 Subject: [PATCH 05/72] updating go modules --- cmd/intercept/go.mod | 2 +- cmd/intercept/go.sum | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/cmd/intercept/go.mod b/cmd/intercept/go.mod index 977a5fa..3deb5f8 100644 --- a/cmd/intercept/go.mod +++ b/cmd/intercept/go.mod @@ -3,6 +3,6 @@ module github.com/projectdiscovery/notify/cmd/intercept go 1.14 require ( - github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b + github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/gologger v1.0.1 ) diff --git a/cmd/intercept/go.sum b/cmd/intercept/go.sum index e317038..5853376 100644 --- a/cmd/intercept/go.sum +++ b/cmd/intercept/go.sum @@ -3,36 +3,25 @@ github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/miekg/dns v1.1.34 h1:SgTzfkN+oLoIHF1bgUP+C71mzuDl3AhLApHzCCIAMWM= -github.com/miekg/dns v1.1.34/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= +github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.0-20201106184455-1739c0140e53 h1:jJGYzegxz43KMq4iXY4zfPSflmF+LFyxM2/bYja39kQ= -github.com/projectdiscovery/collaborator v0.0.0-20201106184455-1739c0140e53/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= -github.com/projectdiscovery/collaborator v0.0.0-20201106184551-efd6773a9479 h1:2K1Vg9jh6bX5fBz05y45VGE2K3TgPXOkGu/EevCbrBs= -github.com/projectdiscovery/collaborator v0.0.0-20201106184551-efd6773a9479/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= -github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b h1:hFAaqKrJC1VpmKU2GEoLz9udekOm1so+/Bw/sCOUkzM= -github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= +github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= +github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= -github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= From ab8e3484e95852f8ee4861895ba7c0ec3d4a8bd3 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Sun, 6 Dec 2020 22:46:50 +0100 Subject: [PATCH 06/72] pcap to proxy --- cmd/intercept/go.mod | 4 +++ cmd/intercept/go.sum | 54 +++++++++++++++++++++++++++++-------- cmd/intercept/intercept.go | 55 +++++++++++++++++--------------------- 3 files changed, 72 insertions(+), 41 deletions(-) diff --git a/cmd/intercept/go.mod b/cmd/intercept/go.mod index 977a5fa..d79eac6 100644 --- a/cmd/intercept/go.mod +++ b/cmd/intercept/go.mod @@ -3,6 +3,10 @@ module github.com/projectdiscovery/notify/cmd/intercept go 1.14 require ( + github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b + github.com/projectdiscovery/dsl v0.0.1 github.com/projectdiscovery/gologger v1.0.1 + github.com/projectdiscovery/mapsutil v0.0.1 + github.com/projectdiscovery/proxify v0.0.1 ) diff --git a/cmd/intercept/go.sum b/cmd/intercept/go.sum index e317038..63638ea 100644 --- a/cmd/intercept/go.sum +++ b/cmd/intercept/go.sum @@ -1,42 +1,74 @@ +github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= +github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 h1:Am81SElhR3XCQBunTisljzNkNese2T1FiV8jP79+dqg= +github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.34 h1:SgTzfkN+oLoIHF1bgUP+C71mzuDl3AhLApHzCCIAMWM= github.com/miekg/dns v1.1.34/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.0-20201106184455-1739c0140e53 h1:jJGYzegxz43KMq4iXY4zfPSflmF+LFyxM2/bYja39kQ= -github.com/projectdiscovery/collaborator v0.0.0-20201106184455-1739c0140e53/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= -github.com/projectdiscovery/collaborator v0.0.0-20201106184551-efd6773a9479 h1:2K1Vg9jh6bX5fBz05y45VGE2K3TgPXOkGu/EevCbrBs= -github.com/projectdiscovery/collaborator v0.0.0-20201106184551-efd6773a9479/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= -github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b h1:hFAaqKrJC1VpmKU2GEoLz9udekOm1so+/Bw/sCOUkzM= github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= +github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= +github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= -github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= +github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= +github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= +github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= +github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= +github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/cmd/intercept/intercept.go b/cmd/intercept/intercept.go index 7b2566a..4b9e3ee 100644 --- a/cmd/intercept/intercept.go +++ b/cmd/intercept/intercept.go @@ -2,47 +2,42 @@ package main import ( "flag" - "fmt" + "net/http" "os" - "os/signal" - "syscall" - "time" + "strings" - "github.com/projectdiscovery/collaborator/biid" + "github.com/elazarl/goproxy" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/proxify" ) // Options to handle intercept type Options struct { - InterceptBIIDTimeout int + ListenAddress string } func main() { var options Options - flag.IntVar(&options.InterceptBIIDTimeout, "intercept-biid-timeout", 600, "Automatic BIID intercept Timeout") + flag.StringVar(&options.ListenAddress, "listen-address", ":8888", "Listen Port") - // Setup close handler - go func() { - c := make(chan os.Signal) - signal.Notify(c, os.Interrupt, syscall.SIGTERM) - go func() { - <-c - fmt.Println("\r- Ctrl+C pressed in Terminal") - os.Exit(0) - }() - }() + gologger.Printf("Starting Intercepting Proxy") + proxy := proxify.NewProxy(&proxify.Options{ + ListenAddr: options.ListenAddress, + // Verbose: true, + OnRequestCallback: func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { + if req.Host == "polling.burpcollaborator.net" && strings.HasSuffix(req.URL.Path, "/burpresults") { + interceptedBiid := req.URL.Query().Get("biid") + if interceptedBiid != "" { + gologger.Printf("BIID found: %s", interceptedBiid) + os.Exit(0) + } + } + return req, nil + }, + OnResponseCallback: func(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response { + return resp + }, + }) - if os.Getuid() != 0 { - gologger.Fatalf("The program is not running as root and unable to access raw sockets") - } - gologger.Printf("Attempting to intercept BIID") - // otherwise attempt to retrieve it - interceptedBiid, err := biid.Intercept(time.Duration(options.InterceptBIIDTimeout) * time.Second) - if err != nil { - gologger.Fatalf("%s", err) - } - if interceptedBiid == "" { - gologger.Fatalf("BIID not found") - } - gologger.Printf("BIID found: %s", interceptedBiid) + gologger.Printf("%s", proxy.Run()) } From 1f98071770974bea0b93ac52ab4817ef6c87d731 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 10 Dec 2020 23:51:43 +0100 Subject: [PATCH 07/72] updating yaml package --- go.mod | 2 +- go.sum | 44 +++++++++++++++++++++++++++++++++++++++ internal/runner/config.go | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index b95d82e..f41ecc4 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/projectdiscovery/notify go 1.14 require ( - github.com/Shopify/yaml v2.1.0+incompatible github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index e69de29..8497ab0 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,44 @@ +github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= +github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= +github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= +github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= +github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= +github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= +github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= +github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= +github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/internal/runner/config.go b/internal/runner/config.go index 50d720a..9507ad0 100644 --- a/internal/runner/config.go +++ b/internal/runner/config.go @@ -4,8 +4,8 @@ import ( "os" "path" - "github.com/Shopify/yaml" "github.com/projectdiscovery/notify" + "gopkg.in/yaml.v2" ) // ConfigDefaultFilename containing configuration From 5b09cc660f9cabe728d2054fe98a212ba25e3019 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 10 Dec 2020 23:53:21 +0100 Subject: [PATCH 08/72] wip - go modules --- cmd/intercept/go.sum | 83 -------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 cmd/intercept/go.sum diff --git a/cmd/intercept/go.sum b/cmd/intercept/go.sum deleted file mode 100644 index 3d7d91e..0000000 --- a/cmd/intercept/go.sum +++ /dev/null @@ -1,83 +0,0 @@ -github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= -github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 h1:Am81SElhR3XCQBunTisljzNkNese2T1FiV8jP79+dqg= -github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= -github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -<<<<<<< HEAD -github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.34 h1:SgTzfkN+oLoIHF1bgUP+C71mzuDl3AhLApHzCCIAMWM= -github.com/miekg/dns v1.1.34/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.0-20201107213304-6ecca25af99b/go.mod h1:pT+nfywyhy3cJacTU6PLUbE/uHqabzoN4xp4DcF9qoY= -github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= -github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= -github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= -github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= -github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= -github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= -github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= -github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -======= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= -github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= -github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= -github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= ->>>>>>> dev -github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= -github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 613c1574aedc8009ae95df56974a67c00b3b8afe Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 11 Dec 2020 20:31:46 +0100 Subject: [PATCH 09/72] updating go modules --- cmd/intercept/go.mod | 3 +- cmd/intercept/go.sum | 84 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 cmd/intercept/go.sum diff --git a/cmd/intercept/go.mod b/cmd/intercept/go.mod index 761ccb0..317fabc 100644 --- a/cmd/intercept/go.mod +++ b/cmd/intercept/go.mod @@ -4,9 +4,8 @@ go 1.14 require ( github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 - github.com/projectdiscovery/dsl v0.0.1 github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/mapsutil v0.0.1 - github.com/projectdiscovery/proxify v0.0.1 + github.com/projectdiscovery/proxify v0.0.2 ) diff --git a/cmd/intercept/go.sum b/cmd/intercept/go.sum new file mode 100644 index 0000000..ec2bf27 --- /dev/null +++ b/cmd/intercept/go.sum @@ -0,0 +1,84 @@ +github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= +github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 h1:Am81SElhR3XCQBunTisljzNkNese2T1FiV8jP79+dqg= +github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= +github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= +github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= +github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= +github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= +github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= +github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= +github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= +github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= +github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= +github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= +github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCAL0ezYhFdgw= +github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= +github.com/projectdiscovery/proxify v0.0.2 h1:3+lI75Ct1c1mEE21uCshv0I4rR4HiCx3Gv5QvLvvFlY= +github.com/projectdiscovery/proxify v0.0.2/go.mod h1:ePYf2JN7O9tMkiD+nRakQWmIpLrHu579IrT6MXNtoRo= +github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= +github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= +github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= +github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= +github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= +golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 210582a71d2e25bbd129a75cc1019b9df1bbb402 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 11 Dec 2020 20:38:13 +0100 Subject: [PATCH 10/72] Updating intercept instructions --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ab3771..05349cf 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,11 @@ Installing Intercept - # Intercept BIID -- Run intercept as root `sudo intercept` +- Run intercept `intercept` - Open Burp Suite => Project Options => Misc - Tick `Pull Over HTTP` +- Go to Options => Connections => Upstream Proxy Servers +- Add `localhost:8888` (or the custom intercept listening port) as upstream proxy - Generate **new** collaborator, click on **Poll now**. - Intercept will capture `biid` that can be used with `notify` From 13d53e8af0417009714ce54f0c6cd8ee0f723586 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Tue, 16 Feb 2021 16:53:14 +0100 Subject: [PATCH 11/72] removing redundant go modules --- cmd/intercept/go.mod | 11 ------ cmd/intercept/go.sum | 84 -------------------------------------------- 2 files changed, 95 deletions(-) delete mode 100644 cmd/intercept/go.mod delete mode 100644 cmd/intercept/go.sum diff --git a/cmd/intercept/go.mod b/cmd/intercept/go.mod deleted file mode 100644 index 317fabc..0000000 --- a/cmd/intercept/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/projectdiscovery/notify/cmd/intercept - -go 1.14 - -require ( - github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 - github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/gologger v1.0.1 - github.com/projectdiscovery/mapsutil v0.0.1 - github.com/projectdiscovery/proxify v0.0.2 -) diff --git a/cmd/intercept/go.sum b/cmd/intercept/go.sum deleted file mode 100644 index ec2bf27..0000000 --- a/cmd/intercept/go.sum +++ /dev/null @@ -1,84 +0,0 @@ -github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= -github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272 h1:Am81SElhR3XCQBunTisljzNkNese2T1FiV8jP79+dqg= -github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= -github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= -github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= -github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= -github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= -github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= -github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= -github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= -github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= -github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= -github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCAL0ezYhFdgw= -github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= -github.com/projectdiscovery/proxify v0.0.2 h1:3+lI75Ct1c1mEE21uCshv0I4rR4HiCx3Gv5QvLvvFlY= -github.com/projectdiscovery/proxify v0.0.2/go.mod h1:ePYf2JN7O9tMkiD+nRakQWmIpLrHu579IrT6MXNtoRo= -github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= -github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= -github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= -github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= -github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 458c38fa3563ab0d9c804ea5a1d5adcca2f74817 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Tue, 16 Feb 2021 16:53:46 +0100 Subject: [PATCH 12/72] using unique go modules --- go.mod | 8 ++++-- go.sum | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 87 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index f41ecc4..bfd2e88 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ module github.com/projectdiscovery/notify -go 1.14 +go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d + github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/gologger v1.0.1 + github.com/projectdiscovery/gologger v1.1.3 + github.com/projectdiscovery/proxify v0.0.3 github.com/projectdiscovery/retryablehttp-go v1.0.1 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v2 v2.2.2 ) diff --git a/go.sum b/go.sum index 8497ab0..ac360dd 100644 --- a/go.sum +++ b/go.sum @@ -1,44 +1,119 @@ +github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= +github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMljIftb7WlFtzGANRCnoOhPjtl2ifcs= +github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/miekg/dns v1.1.29 h1:xHBEhR+t5RzcFJjBLJlax2daXOrTYtr9z4WdKEfWFzg= +github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= -github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ= +github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= +github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= +github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= +github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= +github.com/projectdiscovery/gologger v1.1.3 h1:rKWZW2QUigRV1jnlWwWJbJRvz8b+T/+bB5qemDGGBJU= +github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= +github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= +github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= +github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCAL0ezYhFdgw= +github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= +github.com/projectdiscovery/proxify v0.0.3 h1:gxtjEVThIL2DxUz3YgHrs9LE/SqP+t+EJu5Bd1CTg7E= +github.com/projectdiscovery/proxify v0.0.3/go.mod h1:oLRlBIfX3WcvPiXlvF5nac5GIwUbdz4znONBildDvLs= +github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= +github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= +github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= +github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= +golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From 7a7ff7284d9e2d4c156c79296e755e05c898830d Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Tue, 16 Feb 2021 16:54:02 +0100 Subject: [PATCH 13/72] adding intercept binary release --- .goreleaser.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 5b8fad0..a6f9382 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,6 +10,17 @@ builds: - 386 - arm - arm64 + - binary: intercept + main: cmd/intercept/intercept.go + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - 386 + - arm + - arm64 archives: - id: tgz From aa86cc8b513b51b7931c83dc754836ac191da3f4 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Tue, 16 Feb 2021 16:54:17 +0100 Subject: [PATCH 14/72] updating gologger --- cmd/intercept/intercept.go | 6 +++--- cmd/notify/notify.go | 4 ++-- internal/runner/banner.go | 8 ++++---- internal/runner/options.go | 34 ++++++++++++++++++---------------- internal/runner/runner.go | 10 +++++----- smtp.go | 2 +- 6 files changed, 33 insertions(+), 31 deletions(-) diff --git a/cmd/intercept/intercept.go b/cmd/intercept/intercept.go index 4b9e3ee..a198464 100644 --- a/cmd/intercept/intercept.go +++ b/cmd/intercept/intercept.go @@ -20,7 +20,7 @@ func main() { var options Options flag.StringVar(&options.ListenAddress, "listen-address", ":8888", "Listen Port") - gologger.Printf("Starting Intercepting Proxy") + gologger.Print().Msgf("Starting Intercepting Proxy") proxy := proxify.NewProxy(&proxify.Options{ ListenAddr: options.ListenAddress, // Verbose: true, @@ -28,7 +28,7 @@ func main() { if req.Host == "polling.burpcollaborator.net" && strings.HasSuffix(req.URL.Path, "/burpresults") { interceptedBiid := req.URL.Query().Get("biid") if interceptedBiid != "" { - gologger.Printf("BIID found: %s", interceptedBiid) + gologger.Print().Msgf("BIID found: %s", interceptedBiid) os.Exit(0) } } @@ -39,5 +39,5 @@ func main() { }, }) - gologger.Printf("%s", proxy.Run()) + gologger.Print().Msgf("%s", proxy.Run()) } diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 73ea88a..2ea5993 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -15,7 +15,7 @@ func main() { notifyRunner, err := runner.NewRunner(options) if err != nil { - gologger.Fatalf("Could not create runner: %s\n", err) + gologger.Fatal().Msgf("Could not create runner: %s\n", err) } // Setup close handler @@ -32,6 +32,6 @@ func main() { err = notifyRunner.Run() if err != nil { - gologger.Fatalf("Could not run notifier: %s\n", err) + gologger.Fatal().Msgf("Could not run notifier: %s\n", err) } } diff --git a/internal/runner/banner.go b/internal/runner/banner.go index b6c764a..4c67cce 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -17,9 +17,9 @@ const Version = `0.0.2` // showBanner is used to show the banner to the user func showBanner() { - gologger.Printf("%s\n", banner) - gologger.Printf("\t\tprojectdiscovery.io\n\n") + gologger.Print().Msgf("%s\n", banner) + gologger.Print().Msgf("\t\tprojectdiscovery.io\n\n") - gologger.Labelf("Use with caution. You are responsible for your actions\n") - gologger.Labelf("Developers assume no liability and are not responsible for any misuse or damage.\n") + gologger.Print().Msgf("Use with caution. You are responsible for your actions\n") + gologger.Print().Msgf("Developers assume no liability and are not responsible for any misuse or damage.\n") } diff --git a/internal/runner/options.go b/internal/runner/options.go index 04be2ca..0e4e06a 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -8,6 +8,7 @@ import ( "os" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/gologger/levels" "github.com/projectdiscovery/notify" ) @@ -75,14 +76,14 @@ func ParseConfigFileOrOptions() *Options { options.writeDefaultConfig() if options.Version { - gologger.Infof("Current Version: %s\n", Version) + gologger.Info().Msgf("Current Version: %s\n", Version) os.Exit(0) } // If a config file is provided, merge the options defaultConfigPath, err := getDefaultConfigFile() if err != nil { - gologger.Errorf("Program exiting: %s\n", err) + gologger.Error().Msgf("Program exiting: %s\n", err) } options.MergeFromConfig(defaultConfigPath, true) @@ -94,30 +95,31 @@ func ParseConfigFileOrOptions() *Options { func (options *Options) configureOutput() { if options.Verbose { - gologger.MaxLevel = gologger.Verbose - } - if options.NoColor { - gologger.UseColors = false + gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) } + // Not used + // if options.NoColor { + // gologger.UseColors = false + // } if options.Silent { - gologger.MaxLevel = gologger.Silent + gologger.DefaultLogger.SetMaxLevel(levels.LevelSilent) } } func (options *Options) writeDefaultConfig() { configFile, err := getDefaultConfigFile() if err != nil { - gologger.Printf("Could not get default configuration file: %s\n", err) + gologger.Print().Msgf("Could not get default configuration file: %s\n", err) } if fileExists(configFile) { - gologger.Printf("Found existing config file: %s\n", configFile) + gologger.Print().Msgf("Found existing config file: %s\n", configFile) return } // Skip config file creation if run as root to avoid permission issues if os.Getuid() == 0 { - gologger.Printf("Running as root, skipping config file write to avoid permissions issues: %s\n", configFile) + gologger.Print().Msgf("Running as root, skipping config file write to avoid permissions issues: %s\n", configFile) return } @@ -166,20 +168,20 @@ func (options *Options) writeDefaultConfig() { err = dummyConfig.MarshalWrite(configFile) if err != nil { - gologger.Printf("Could not write configuration file to %s: %s\n", configFile, err) + gologger.Print().Msgf("Could not write configuration file to %s: %s\n", configFile, err) return } // turn all lines into comments origFile, err := os.Open(configFile) if err != nil { - gologger.Printf("Could not process temporary file: %s\n", err) + gologger.Print().Msgf("Could not process temporary file: %s\n", err) return } tmpFile, err := ioutil.TempFile("", "") if err != nil { log.Println(err) - gologger.Printf("Could not process temporary file: %s\n", err) + gologger.Print().Msgf("Could not process temporary file: %s\n", err) return } sc := bufio.NewScanner(origFile) @@ -195,7 +197,7 @@ func (options *Options) writeDefaultConfig() { //nolint:errcheck // silent fail os.Rename(tmpFileName, configFile) - gologger.Printf("Configuration file saved to %s\n", configFile) + gologger.Print().Msgf("Configuration file saved to %s\n", configFile) } // MergeFromConfig with existing options @@ -203,10 +205,10 @@ func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) configFile, err := UnmarshalRead(configFileName) if err != nil { if ignoreError { - gologger.Printf("Could not read configuration file %s - ignoring error: %s\n", configFileName, err) + gologger.Print().Msgf("Could not read configuration file %s - ignoring error: %s\n", configFileName, err) return } - gologger.Fatalf("Could not read configuration file %s: %s\n", configFileName, err) + gologger.Print().Msgf("Could not read configuration file %s: %s\n", configFileName, err) } if configFile.BIID != "" { diff --git a/internal/runner/runner.go b/internal/runner/runner.go index b32fac6..86824f5 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -65,7 +65,7 @@ func (r *Runner) Run() error { "{{data}}", msg, ) msg = rr.Replace(r.options.CLIMessage) - gologger.Printf(msg) + gologger.Print().Msgf(msg) //nolint:errcheck // silent fail r.notifier.SendNotification(msg) } @@ -75,7 +75,7 @@ func (r *Runner) Run() error { // otherwise works as long term collaborator poll and notify via webhook // If BIID passed via cli if r.options.BIID != "" { - gologger.Printf("Using BIID: %s", r.options.BIID) + gologger.Print().Msgf("Using BIID: %s", r.options.BIID) r.burpcollab.AddBIID(r.options.BIID) } @@ -111,7 +111,7 @@ func (r *Runner) Run() error { ) msg := rr.Replace(r.options.HTTPMessage) - gologger.Printf(msg) + gologger.Print().Msgf(msg) //nolint:errcheck // silent fail r.notifier.SendNotification(msg) @@ -124,7 +124,7 @@ func (r *Runner) Run() error { "{{request}}", resp.Data.RawRequestDecoded, ) msg := rr.Replace(r.options.DNSMessage) - gologger.Printf(msg) + gologger.Print().Msgf(msg) //nolint:errcheck // silent fail r.notifier.SendNotification(msg) @@ -138,7 +138,7 @@ func (r *Runner) Run() error { "{{conversation}}", resp.Data.ConversationDecoded, ) msg := rr.Replace(r.options.SMTPMessage) - gologger.Printf(msg) + gologger.Print().Msgf(msg) //nolint:errcheck // silent fail r.notifier.SendNotification(msg) diff --git a/smtp.go b/smtp.go index 9304a8f..fd6834d 100644 --- a/smtp.go +++ b/smtp.go @@ -50,7 +50,7 @@ func (sm *SMTPClient) SendInfo(message string) (err error) { err := smtp.SendMail(provider.Server, auth, provider.Username, sm.CC, []byte(message)) if err != nil { - gologger.Errorf("%s\n", err) + gologger.Fatal().Msgf("%s\n", err) return err } } From 52c4683c97712fa63b55c04ef7d0c2780c690238 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Tue, 16 Feb 2021 17:01:50 +0100 Subject: [PATCH 15/72] updating notify/intercept double build+test --- .github/workflows/build.yaml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e7c3f4..997f641 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,27 +6,18 @@ on: pull_request: jobs: - lint: - name: golangci-lint + golangci-lint: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2.2.0 + uses: golangci/golangci-lint-action@v2.4.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.31 args: --timeout 5m - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true build: name: Build runs-on: ubuntu-latest @@ -39,10 +30,18 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Test + - name: Test notify run: go test . working-directory: cmd/notify/ - - name: Build + - name: Build notify run: go build . working-directory: cmd/notify/ + + - name: Test intercept + run: go test . + working-directory: cmd/intercept/ + + - name: Build intercept + run: go build . + working-directory: cmd/intercept/ \ No newline at end of file From 0ef50b0edba6348649a3489dd0e22b2ac041d1aa Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 17 Feb 2021 16:17:52 +0100 Subject: [PATCH 16/72] adding gologger nocolor support --- internal/runner/options.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/runner/options.go b/internal/runner/options.go index 0e4e06a..1b24f1a 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -8,6 +8,7 @@ import ( "os" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/gologger/formatter" "github.com/projectdiscovery/gologger/levels" "github.com/projectdiscovery/notify" ) @@ -97,10 +98,9 @@ func (options *Options) configureOutput() { if options.Verbose { gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) } - // Not used - // if options.NoColor { - // gologger.UseColors = false - // } + if options.NoColor { + gologger.DefaultLogger.SetFormatter(formatter.NewCLI(true)) + } if options.Silent { gologger.DefaultLogger.SetMaxLevel(levels.LevelSilent) } From ce8864494ce101cc07e1263da7728d8f603ec9aa Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 18 Feb 2021 00:16:36 +0100 Subject: [PATCH 17/72] updating proxify to dev branch --- go.mod | 4 +- go.sum | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index bfd2e88..85d1f77 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/gologger v1.1.3 - github.com/projectdiscovery/proxify v0.0.3 + github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryablehttp-go v1.0.1 - gopkg.in/yaml.v2 v2.2.2 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index ac360dd..1d1035a 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,12 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,12 +17,35 @@ github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMlj github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= +github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= @@ -26,21 +54,40 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= +github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/miekg/dns v1.1.29 h1:xHBEhR+t5RzcFJjBLJlax2daXOrTYtr9z4WdKEfWFzg= github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.38 h1:MtIY+fmHUVVgv1AXzmKMWcwdCYxTRPG1EDjpqF4RCEw= +github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -51,6 +98,8 @@ github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= +github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= +github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= github.com/projectdiscovery/gologger v1.1.3 h1:rKWZW2QUigRV1jnlWwWJbJRvz8b+T/+bB5qemDGGBJU= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= @@ -60,12 +109,17 @@ github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCA github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= github.com/projectdiscovery/proxify v0.0.3 h1:gxtjEVThIL2DxUz3YgHrs9LE/SqP+t+EJu5Bd1CTg7E= github.com/projectdiscovery/proxify v0.0.3/go.mod h1:oLRlBIfX3WcvPiXlvF5nac5GIwUbdz4znONBildDvLs= +github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 h1:kVGWhu6pisPOTpDi9T/wBNF//BL3quenLv9oS1CXfQ4= +github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06/go.mod h1:KD3L4uNgvAXHS6JywunTPhiyVGBqLljweugPAPRNj3s= github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= +github.com/projectdiscovery/retryabledns v1.0.6 h1:fz33puVeUKJJ5s2POSlxO4WA4iodW6Yzm/EVNuO/93w= +github.com/projectdiscovery/retryabledns v1.0.6/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -75,41 +129,102 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210217105451-b926d437f341 h1:2/QtM1mL37YmcsT8HaDNHDgTqqFVw+zr8UzMiBVLzYU= +golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -117,3 +232,11 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 8e1909070899950abdae805ad167a0172ec34ee3 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 18 Feb 2021 00:16:49 +0100 Subject: [PATCH 18/72] updated proxify syntax --- cmd/intercept/intercept.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/intercept/intercept.go b/cmd/intercept/intercept.go index a198464..c111828 100644 --- a/cmd/intercept/intercept.go +++ b/cmd/intercept/intercept.go @@ -21,7 +21,7 @@ func main() { flag.StringVar(&options.ListenAddress, "listen-address", ":8888", "Listen Port") gologger.Print().Msgf("Starting Intercepting Proxy") - proxy := proxify.NewProxy(&proxify.Options{ + proxy, err := proxify.NewProxy(&proxify.Options{ ListenAddr: options.ListenAddress, // Verbose: true, OnRequestCallback: func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { @@ -38,6 +38,9 @@ func main() { return resp }, }) + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } gologger.Print().Msgf("%s", proxy.Run()) } From db2e39b73236722f0b4171458319ebdf51f27ec1 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 18 Feb 2021 00:18:49 +0100 Subject: [PATCH 19/72] adding bot --- .github/dependabot.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4d5617f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,34 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: "chore" + include: "scope" + + # Maintain dependencies for go modules + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: "chore" + include: "scope" + + # Maintain dependencies for docker + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: "chore" + include: "scope" From 0d90259deddbba1191a697c9beed2f7ef2081c84 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 3 Mar 2021 20:14:24 +0100 Subject: [PATCH 20/72] adding cache size --- cmd/intercept/intercept.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/intercept/intercept.go b/cmd/intercept/intercept.go index c111828..9eb7ae9 100644 --- a/cmd/intercept/intercept.go +++ b/cmd/intercept/intercept.go @@ -22,8 +22,8 @@ func main() { gologger.Print().Msgf("Starting Intercepting Proxy") proxy, err := proxify.NewProxy(&proxify.Options{ - ListenAddr: options.ListenAddress, - // Verbose: true, + ListenAddr: options.ListenAddress, + CertCacheSize: 256, OnRequestCallback: func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { if req.Host == "polling.burpcollaborator.net" && strings.HasSuffix(req.URL.Path, "/burpresults") { interceptedBiid := req.URL.Query().Get("biid") From bb2d8b04204c111bb980cb2ff6ed18765c73e310 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 3 Mar 2021 20:14:36 +0100 Subject: [PATCH 21/72] deps version bump --- go.mod | 2 +- go.sum | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 85d1f77..749434a 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/gologger v1.1.3 + github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryablehttp-go v1.0.1 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 1d1035a..c79ce51 100644 --- a/go.sum +++ b/go.sum @@ -12,16 +12,17 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/elazarl/goproxy v0.0.0-20201021153353-00ad82a08272/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMljIftb7WlFtzGANRCnoOhPjtl2ifcs= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= +github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e h1:CQn2/8fi3kmpT9BTiHEELgdxAOQNVZc9GoPA4qnQzrs= github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -35,6 +36,7 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -45,6 +47,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -54,9 +57,11 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -77,16 +82,19 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4= github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -96,23 +104,18 @@ github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5 github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= -github.com/projectdiscovery/fastdialer v0.0.2 h1:0VUoHhtUt/HThHUUwbWBxTnFI+tM13RN+TmcybEvbRc= -github.com/projectdiscovery/fastdialer v0.0.2/go.mod h1:wjSQICydWE54N49Lcx9nnh5OmtsRwIcLgiVT3GT2zgA= github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/gologger v1.0.1/go.mod h1:Ok+axMqK53bWNwDSU1nTNwITLYMXMdZtRc8/y1c7sWE= github.com/projectdiscovery/gologger v1.1.3 h1:rKWZW2QUigRV1jnlWwWJbJRvz8b+T/+bB5qemDGGBJU= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= +github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= +github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCAL0ezYhFdgw= github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= -github.com/projectdiscovery/proxify v0.0.3 h1:gxtjEVThIL2DxUz3YgHrs9LE/SqP+t+EJu5Bd1CTg7E= -github.com/projectdiscovery/proxify v0.0.3/go.mod h1:oLRlBIfX3WcvPiXlvF5nac5GIwUbdz4znONBildDvLs= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 h1:kVGWhu6pisPOTpDi9T/wBNF//BL3quenLv9oS1CXfQ4= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06/go.mod h1:KD3L4uNgvAXHS6JywunTPhiyVGBqLljweugPAPRNj3s= -github.com/projectdiscovery/retryabledns v1.0.5 h1:bQivGy5CuqKlwcxRkgA5ENincqIed/BR2sA6t2gdwuI= -github.com/projectdiscovery/retryabledns v1.0.5/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= github.com/projectdiscovery/retryabledns v1.0.6 h1:fz33puVeUKJJ5s2POSlxO4WA4iodW6Yzm/EVNuO/93w= github.com/projectdiscovery/retryabledns v1.0.6/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= @@ -129,6 +132,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= @@ -136,8 +140,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= -golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -158,8 +160,6 @@ golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -168,6 +168,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -191,6 +192,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -204,6 +206,7 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -221,9 +224,11 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -237,6 +242,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 6befea71d06236396eb7f49635a1e1c7213333d8 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 5 Mar 2021 15:04:41 +0100 Subject: [PATCH 22/72] adding goflags --- cmd/notify/notify.go | 45 ++++- doc.go | 2 - go.mod | 2 +- go.sum | 4 + internal/runner/config.go | 112 ----------- internal/runner/options.go | 262 +++----------------------- internal/runner/runner.go | 26 +-- internal/runner/util.go | 23 --- options.go | 27 --- const.go => pkg/engine/const.go | 2 +- discord.go => pkg/engine/discord.go | 2 +- pkg/engine/doc.go | 2 + notify.go => pkg/engine/notify.go | 7 +- slack.go => pkg/engine/slack.go | 2 +- smtp.go => pkg/engine/smtp.go | 5 +- telegram.go => pkg/engine/telegram.go | 2 +- pkg/types/default.go | 8 + pkg/types/types.go | 45 +++++ 18 files changed, 150 insertions(+), 428 deletions(-) delete mode 100644 doc.go delete mode 100644 internal/runner/config.go delete mode 100644 internal/runner/util.go delete mode 100644 options.go rename const.go => pkg/engine/const.go (59%) rename discord.go => pkg/engine/discord.go (99%) create mode 100644 pkg/engine/doc.go rename notify.go => pkg/engine/notify.go (92%) rename slack.go => pkg/engine/slack.go (99%) rename smtp.go => pkg/engine/smtp.go (93%) rename telegram.go => pkg/engine/telegram.go (99%) create mode 100644 pkg/types/default.go create mode 100644 pkg/types/types.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 2ea5993..bb34b68 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -6,12 +6,21 @@ import ( "os/signal" "syscall" + "github.com/projectdiscovery/goflags" "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/internal/runner" + "github.com/projectdiscovery/notify/pkg/types" +) + +var ( + cfgFile string + options = &types.Options{} ) func main() { - options := runner.ParseConfigFileOrOptions() + readConfig() + + runner.ParseOptions(options) notifyRunner, err := runner.NewRunner(options) if err != nil { @@ -35,3 +44,37 @@ func main() { gologger.Fatal().Msgf("Could not run notifier: %s\n", err) } } + +func readConfig() { + set := goflags.New() + set.SetDescription(`Notify is a general notification tool`) + set.StringVar(&cfgFile, "config", "", "Notify configuration file") + set.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") + set.StringVar(&options.SlackWebHookURL, "slack-webhook-url", "", "Slack Webhook URL") + set.StringVar(&options.SlackUsername, "slack-username", "", "Slack Username") + set.StringVar(&options.SlackChannel, "slack-channel", "", "Slack Channel") + set.BoolVar(&options.Slack, "slack", false, "Enable Slack") + set.StringVar(&options.DiscordWebHookURL, "discord-webhook-url", "", "Discord Webhook URL") + set.StringVar(&options.DiscordWebHookUsername, "discord-username", "", "Discord Username") + set.StringVar(&options.DiscordWebHookAvatarURL, "discord-channel", "", "Discord Channel") + set.BoolVar(&options.Discord, "discord", false, "Enable Discord") + set.StringVar(&options.TelegramAPIKey, "telegram-api-key", "", "Telegram API Key") + set.StringVar(&options.TelegramChatID, "telegram-chat-id", "", "Telegram Chat ID") + set.BoolVar(&options.Telegram, "telegram", false, "Enable Telegram") + set.BoolVar(&options.Silent, "silent", false, "Don't print the banner") + set.BoolVar(&options.Version, "version", false, "Show version of notify") + set.BoolVar(&options.Verbose, "v", false, "Show Verbose output") + set.BoolVar(&options.NoColor, "no-color", false, "Don't Use colors in output") + set.IntVar(&options.Interval, "interval", 2, "Polling interval in seconds") + set.StringVar(&options.HTTPMessage, "message-http", types.DefaultHTTPMessage, "HTTP Message") + set.StringVar(&options.DNSMessage, "message-dns", types.DefaultDNSMessage, "DNS Message") + set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") + set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") + _ = set.Parse() + + if cfgFile != "" { + if err := set.MergeConfigFile(cfgFile); err != nil { + gologger.Fatal().Msgf("Could not read config: %s\n", err) + } + } +} diff --git a/doc.go b/doc.go deleted file mode 100644 index 78ba0ac..0000000 --- a/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package notify notifies out of band interactions via webhook -package notify diff --git a/go.mod b/go.mod index 749434a..7fef668 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/projectdiscovery/collaborator v0.0.2 + github.com/projectdiscovery/goflags v0.0.2 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryablehttp-go v1.0.1 - gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index c79ce51..9e3af6c 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpH github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= +github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -106,6 +108,8 @@ github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= +github.com/projectdiscovery/goflags v0.0.2 h1:4vB5+mA41xgW6V1y4YD1A+iI8Kq68iTTny50XuSYKdo= +github.com/projectdiscovery/goflags v0.0.2/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3 h1:rKWZW2QUigRV1jnlWwWJbJRvz8b+T/+bB5qemDGGBJU= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= diff --git a/internal/runner/config.go b/internal/runner/config.go deleted file mode 100644 index 9507ad0..0000000 --- a/internal/runner/config.go +++ /dev/null @@ -1,112 +0,0 @@ -package runner - -import ( - "os" - "path" - - "github.com/projectdiscovery/notify" - "gopkg.in/yaml.v2" -) - -// ConfigDefaultFilename containing configuration -const ConfigDefaultFilename = "notify.conf" - -// ConfigFile structure -//nolint:maligned // used once -type ConfigFile struct { - BIID string `yaml:"burp_biid,omitempty"` - // Slack - SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` - SlackUsername string `yaml:"slack_username,omitempty"` - SlackChannel string `yaml:"slack_channel,omitempty"` - Slack bool `yaml:"slack,omitempty"` - - // Discord - DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` - DiscordWebHookUsername string `yaml:"discord_username,omitempty"` - DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` - Discord bool `yaml:"discord,omitempty"` - - // Telegram - TelegramAPIKey string `yaml:"telegram_apikey,omitempty"` - TelegramChatID string `yaml:"telegram_chat_id,omitempty"` - Telegram bool `yaml:"telegram,omitempty"` - - // SMTP - SMTPProviders []notify.SMTPProvider `yaml:"smtp_providers,omitempty"` - SMTPCC []string `yaml:"smtp_cc,omitempty"` - SMTP bool `yaml:"smtp,omitempty"` - - Interval int `yaml:"interval,omitempty"` - HTTPMessage string `yaml:"http_message,omitempty"` - DNSMessage string `yaml:"dns_message,omitempty"` - SMTPMessage string `yaml:"smtp_message,omitempty"` - CLIMessage string `yaml:"cli_message,omitempty"` -} - -// GetConfigDirectory from the system -func GetConfigDirectory() (string, error) { - var config string - - directory, err := os.UserHomeDir() - if err != nil { - return config, err - } - config = directory + "/.config/notify" - - // Create All directory for notify even if they exist - err = os.MkdirAll(config, os.ModePerm) - if err != nil { - return config, err - } - - return config, nil -} - -// CheckConfigExists in the specified path -func CheckConfigExists(configPath string) bool { - if _, err := os.Stat(configPath); err == nil { - return true - } else if os.IsNotExist(err) { - return false - } - return false -} - -// MarshalWrite to location -func (c *ConfigFile) MarshalWrite(file string) error { - f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE, 0755) - if err != nil { - return err - } - - // Indent the spaces too - enc := yaml.NewEncoder(f) - err = enc.Encode(&c) - - //nolint:errcheck // silent fail - f.Close() - return err -} - -// UnmarshalRead the config file from location -func UnmarshalRead(file string) (ConfigFile, error) { - config := ConfigFile{} - - f, err := os.Open(file) - if err != nil { - return config, err - } - err = yaml.NewDecoder(f).Decode(&config) - //nolint:errcheck // silent fail - f.Close() - return config, err -} - -func getDefaultConfigFile() (string, error) { - directory, err := GetConfigDirectory() - if err != nil { - return "", err - } - return path.Join(directory, ConfigDefaultFilename), nil -} diff --git a/internal/runner/options.go b/internal/runner/options.go index 1b24f1a..df83300 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -1,100 +1,40 @@ package runner import ( - "bufio" - "flag" - "io/ioutil" - "log" + "errors" "os" "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/gologger/formatter" "github.com/projectdiscovery/gologger/levels" - "github.com/projectdiscovery/notify" + "github.com/projectdiscovery/notify/pkg/types" ) -// Options of the internal runner -//nolint:maligned // used once -type Options struct { - BIID string - SlackWebHookURL string - SlackUsername string - SlackChannel string - Slack bool - DiscordWebHookURL string - DiscordWebHookUsername string - DiscordWebHookAvatarURL string - Discord bool - TelegramAPIKey string - TelegramChatID string - Telegram bool - SMTP bool - SMTPProviders []notify.SMTPProvider - SMTPCC []string - Verbose bool - NoColor bool - Silent bool - Version bool - Interval int - HTTPMessage string - DNSMessage string - CLIMessage string - SMTPMessage string -} - -// ParseConfigFileOrOptions combining all settings -func ParseConfigFileOrOptions() *Options { - options := &Options{} - - flag.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") - flag.StringVar(&options.SlackWebHookURL, "slack-webhook-url", "", "Slack Webhook URL") - flag.StringVar(&options.SlackUsername, "slack-username", "", "Slack Username") - flag.StringVar(&options.SlackChannel, "slack-channel", "", "Slack Channel") - flag.BoolVar(&options.Slack, "slack", false, "Enable Slack") - flag.StringVar(&options.DiscordWebHookURL, "discord-webhook-url", "", "Discord Webhook URL") - flag.StringVar(&options.DiscordWebHookUsername, "discord-username", "", "Discord Username") - flag.StringVar(&options.DiscordWebHookAvatarURL, "discord-channel", "", "Discord Channel") - flag.BoolVar(&options.Discord, "discord", false, "Enable Discord") - flag.StringVar(&options.TelegramAPIKey, "telegram-api-key", "", "Telegram API Key") - flag.StringVar(&options.TelegramChatID, "telegram-chat-id", "", "Telegram Chat ID") - flag.BoolVar(&options.Telegram, "telegram", false, "Enable Telegram") - flag.BoolVar(&options.Silent, "silent", false, "Don't print the banner") - flag.BoolVar(&options.Version, "version", false, "Show version of notify") - flag.BoolVar(&options.Verbose, "v", false, "Show Verbose output") - flag.BoolVar(&options.NoColor, "no-color", false, "Don't Use colors in output") - flag.IntVar(&options.Interval, "interval", 2, "Polling interval in seconds") - flag.StringVar(&options.HTTPMessage, "message-http", defaultHTTPMessage, "HTTP Message") - flag.StringVar(&options.DNSMessage, "message-dns", defaultDNSMessage, "DNS Message") - flag.StringVar(&options.SMTPMessage, "message-smtp", defaultSMTPMessage, "SMTP Message") - flag.StringVar(&options.CLIMessage, "message-cli", defaultCLIMessage, "CLI Message") - - flag.Parse() +// ParseOptions parses the command line flags provided by a user +func ParseOptions(options *types.Options) { + // Check if stdin pipe was given + options.Stdin = hasStdin() // Read the inputs and configure the logging - options.configureOutput() + configureOutput(options) - // write default conf file template if it doesn't exist - options.writeDefaultConfig() + // Show the user the banner + showBanner() if options.Version { gologger.Info().Msgf("Current Version: %s\n", Version) os.Exit(0) } - // If a config file is provided, merge the options - defaultConfigPath, err := getDefaultConfigFile() - if err != nil { - gologger.Error().Msgf("Program exiting: %s\n", err) + // Validate the options passed by the user and if any + // invalid options have been used, exit. + if err := validateOptions(options); err != nil { + gologger.Fatal().Msgf("Program exiting: %s\n", err) } - options.MergeFromConfig(defaultConfigPath, true) - - // Show the user the banner - showBanner() - - return options } -func (options *Options) configureOutput() { +// configureOutput configures the output on the screen +func configureOutput(options *types.Options) { if options.Verbose { gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) } @@ -106,169 +46,25 @@ func (options *Options) configureOutput() { } } -func (options *Options) writeDefaultConfig() { - configFile, err := getDefaultConfigFile() - if err != nil { - gologger.Print().Msgf("Could not get default configuration file: %s\n", err) - } - - if fileExists(configFile) { - gologger.Print().Msgf("Found existing config file: %s\n", configFile) - return - } - - // Skip config file creation if run as root to avoid permission issues - if os.Getuid() == 0 { - gologger.Print().Msgf("Running as root, skipping config file write to avoid permissions issues: %s\n", configFile) - return - } - - var dummyConfig ConfigFile - dummyConfig.BIID = "123456798" - dummyConfig.SlackWebHookURL = "https://a.b.c/slack" - //nolint:goconst // test data - dummyConfig.SlackUsername = "test" - //nolint:goconst // test data - dummyConfig.SlackChannel = "test" - dummyConfig.Slack = true - dummyConfig.DiscordWebHookURL = "https://a.b.c/discord" - //nolint:goconst // test data - dummyConfig.DiscordWebHookUsername = "test" - //nolint:goconst // test data - dummyConfig.DiscordWebHookAvatarURL = "test" - dummyConfig.Discord = true - dummyConfig.TelegramAPIKey = "123456879" - dummyConfig.TelegramChatID = "123" - dummyConfig.Telegram = true - dummyConfig.SMTPProviders = append(dummyConfig.SMTPProviders, notify.SMTPProvider{ - AuthenticationType: "basic", - Server: "smtp.server.something:25", - Username: "myusername@oremail.address", - Password: "mysecretpassword", - }) - dummyConfig.SMTPCC = append(dummyConfig.SMTPCC, "receiver@email.address") - dummyConfig.SMTP = true - dummyConfig.Interval = 2 - dummyConfig.HTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n" + - "```\n" + - "{{request}}\n" + - "{{response}}\n" + - "```" - dummyConfig.DNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n" + - "```\n" + - "{{request}}\n" + - "```" - dummyConfig.SMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}.\n" + - "The email details were:\n\n" + - "From:\n{{sender}}\n\n" + - "To:\n{{recipients}}\n\n" + - "Message:\n{{message}}\n\n" + - "SMTP Conversation:\n{{conversation}}" - dummyConfig.CLIMessage = "{{data}}" - - err = dummyConfig.MarshalWrite(configFile) - if err != nil { - gologger.Print().Msgf("Could not write configuration file to %s: %s\n", configFile, err) - return +// validateOptions validates the configuration options passed +func validateOptions(options *types.Options) error { + // Both verbose and silent flags were used + if options.Verbose && options.Silent { + return errors.New("both verbose and silent mode specified") } - // turn all lines into comments - origFile, err := os.Open(configFile) - if err != nil { - gologger.Print().Msgf("Could not process temporary file: %s\n", err) - return - } - tmpFile, err := ioutil.TempFile("", "") - if err != nil { - log.Println(err) - gologger.Print().Msgf("Could not process temporary file: %s\n", err) - return - } - sc := bufio.NewScanner(origFile) - for sc.Scan() { - //nolint:errcheck // silent fail - tmpFile.WriteString("# " + sc.Text() + "\n") - } - //nolint:errcheck // silent fail - origFile.Close() - tmpFileName := tmpFile.Name() - //nolint:errcheck // silent fail - tmpFile.Close() - //nolint:errcheck // silent fail - os.Rename(tmpFileName, configFile) - - gologger.Print().Msgf("Configuration file saved to %s\n", configFile) + return nil } -// MergeFromConfig with existing options -func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) { - configFile, err := UnmarshalRead(configFileName) +// hasStdin returns true if we have stdin input +func hasStdin() bool { + stat, err := os.Stdin.Stat() if err != nil { - if ignoreError { - gologger.Print().Msgf("Could not read configuration file %s - ignoring error: %s\n", configFileName, err) - return - } - gologger.Print().Msgf("Could not read configuration file %s: %s\n", configFileName, err) + return false } - if configFile.BIID != "" { - options.BIID = configFile.BIID - } - if configFile.SlackWebHookURL != "" { - options.SlackWebHookURL = configFile.SlackWebHookURL - } - if configFile.SlackUsername != "" { - options.SlackUsername = configFile.SlackUsername - } - if configFile.SlackChannel != "" { - options.SlackChannel = configFile.SlackChannel - } - if configFile.Slack { - options.Slack = configFile.Slack - } - if configFile.DiscordWebHookURL != "" { - options.DiscordWebHookURL = configFile.DiscordWebHookURL - } - if configFile.DiscordWebHookUsername != "" { - options.DiscordWebHookUsername = configFile.DiscordWebHookUsername - } - if configFile.DiscordWebHookAvatarURL != "" { - options.DiscordWebHookAvatarURL = configFile.DiscordWebHookAvatarURL - } - if configFile.Discord { - options.Discord = configFile.Discord - } - if configFile.TelegramAPIKey != "" { - options.TelegramAPIKey = configFile.TelegramAPIKey - } - if configFile.TelegramChatID != "" { - options.TelegramChatID = configFile.TelegramChatID - } - if configFile.Telegram { - options.Telegram = configFile.Telegram - } - if len(configFile.SMTPProviders) > 0 { - options.SMTPProviders = configFile.SMTPProviders - } - if len(configFile.SMTPCC) > 0 { - options.SMTPCC = configFile.SMTPCC - } - if configFile.SMTP { - options.SMTP = configFile.SMTP - } - if configFile.HTTPMessage != "" { - options.HTTPMessage = configFile.HTTPMessage - } - if configFile.DNSMessage != "" { - options.DNSMessage = configFile.DNSMessage - } - if configFile.SMTPMessage != "" { - options.SMTPMessage = configFile.SMTPMessage - } - if configFile.CLIMessage != "" { - options.CLIMessage = configFile.CLIMessage - } - if configFile.Interval > 0 { - options.Interval = configFile.Interval - } + isPipedFromChrDev := (stat.Mode() & os.ModeCharDevice) == 0 + isPipedFromFIFO := (stat.Mode() & os.ModeNamedPipe) != 0 + + return isPipedFromChrDev || isPipedFromFIFO } diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 86824f5..d5f8eed 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -10,7 +10,8 @@ import ( "github.com/projectdiscovery/collaborator" "github.com/projectdiscovery/gologger" - "github.com/projectdiscovery/notify" + "github.com/projectdiscovery/notify/pkg/engine" + "github.com/projectdiscovery/notify/pkg/types" ) const ( @@ -22,31 +23,16 @@ const ( // Runner contains the internal logic of the program type Runner struct { - options *Options + options *types.Options burpcollab *collaborator.BurpCollaborator - notifier *notify.Notify + notifier *engine.Notify } // NewRunner instance -func NewRunner(options *Options) (*Runner, error) { +func NewRunner(options *types.Options) (*Runner, error) { burpcollab := collaborator.NewBurpCollaborator() - notifier, err := notify.NewWithOptions(¬ify.Options{ - SlackWebHookURL: options.SlackWebHookURL, - SlackUsername: options.SlackUsername, - SlackChannel: options.SlackChannel, - Slack: options.Slack, - DiscordWebHookURL: options.DiscordWebHookURL, - DiscordWebHookUsername: options.DiscordWebHookUsername, - DiscordWebHookAvatarURL: options.DiscordWebHookAvatarURL, - Discord: options.Discord, - TelegramAPIKey: options.TelegramAPIKey, - TelegramChatID: options.TelegramChatID, - Telegram: options.Telegram, - SMTP: options.SMTP, - SMTPProviders: options.SMTPProviders, - SMTPCC: options.SMTPCC, - }) + notifier, err := engine.NewWithOptions(options) if err != nil { return nil, err } diff --git a/internal/runner/util.go b/internal/runner/util.go deleted file mode 100644 index d2912a3..0000000 --- a/internal/runner/util.go +++ /dev/null @@ -1,23 +0,0 @@ -package runner - -import "os" - -func fileExists(filename string) bool { - info, err := os.Stat(filename) - if os.IsNotExist(err) { - return false - } - return !info.IsDir() -} - -func hasStdin() bool { - stat, err := os.Stdin.Stat() - if err != nil { - return false - } - - isPipedFromChrDev := (stat.Mode() & os.ModeCharDevice) == 0 - isPipedFromFIFO := (stat.Mode() & os.ModeNamedPipe) != 0 - - return isPipedFromChrDev || isPipedFromFIFO -} diff --git a/options.go b/options.go deleted file mode 100644 index 0364200..0000000 --- a/options.go +++ /dev/null @@ -1,27 +0,0 @@ -package notify - -// Options of internal notifications -//nolint:maligned // used once -type Options struct { - // Slack - SlackWebHookURL string - SlackUsername string - SlackChannel string - Slack bool - - // Discord - DiscordWebHookURL string - DiscordWebHookUsername string - DiscordWebHookAvatarURL string - Discord bool - - // Telegram - TelegramAPIKey string - TelegramChatID string - Telegram bool - - // SMTP - SMTP bool - SMTPProviders []SMTPProvider - SMTPCC []string -} diff --git a/const.go b/pkg/engine/const.go similarity index 59% rename from const.go rename to pkg/engine/const.go index 436ce2b..c5ceeee 100644 --- a/const.go +++ b/pkg/engine/const.go @@ -1,4 +1,4 @@ -package notify +package engine const ( ok = "ok" diff --git a/discord.go b/pkg/engine/discord.go similarity index 99% rename from discord.go rename to pkg/engine/discord.go index a17ae4d..a6db8d4 100644 --- a/discord.go +++ b/pkg/engine/discord.go @@ -1,4 +1,4 @@ -package notify +package engine // From https://dev.to/arunx2/simple-slack-notification-with-golang-55i2 diff --git a/pkg/engine/doc.go b/pkg/engine/doc.go new file mode 100644 index 0000000..e0075ed --- /dev/null +++ b/pkg/engine/doc.go @@ -0,0 +1,2 @@ +// Package engine notifies out of band interactions via webhook +package engine diff --git a/notify.go b/pkg/engine/notify.go similarity index 92% rename from notify.go rename to pkg/engine/notify.go index 0cbcd9e..3c700e9 100644 --- a/notify.go +++ b/pkg/engine/notify.go @@ -1,13 +1,14 @@ -package notify +package engine import ( "github.com/acarl005/stripansi" + "github.com/projectdiscovery/notify/pkg/types" "github.com/projectdiscovery/retryablehttp-go" ) // Notify handles the notification engine type Notify struct { - options *Options + options *types.Options client *retryablehttp.Client slackClient *SlackClient discordClient *DiscordClient @@ -22,7 +23,7 @@ func New() (*Notify, error) { } // NewWithOptions create a new instance of notify with options -func NewWithOptions(options *Options) (*Notify, error) { +func NewWithOptions(options *types.Options) (*Notify, error) { notifier, err := New() if err != nil { return nil, err diff --git a/slack.go b/pkg/engine/slack.go similarity index 99% rename from slack.go rename to pkg/engine/slack.go index 02bee75..f5c7b3c 100644 --- a/slack.go +++ b/pkg/engine/slack.go @@ -1,4 +1,4 @@ -package notify +package engine // From https://dev.to/arunx2/simple-slack-notification-with-golang-55i2 diff --git a/smtp.go b/pkg/engine/smtp.go similarity index 93% rename from smtp.go rename to pkg/engine/smtp.go index fd6834d..64c1746 100644 --- a/smtp.go +++ b/pkg/engine/smtp.go @@ -1,10 +1,11 @@ -package notify +package engine import ( "net/smtp" "time" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/notify/pkg/types" ) // DefaultTelegraTimeout to conclude operations @@ -28,7 +29,7 @@ type SMTPProvider struct { // TelegramClient handling webhooks type SMTPClient struct { - Providers []SMTPProvider + Providers []types.SMTPProvider CC []string TimeOut time.Duration } diff --git a/telegram.go b/pkg/engine/telegram.go similarity index 99% rename from telegram.go rename to pkg/engine/telegram.go index 2801ba3..8756210 100644 --- a/telegram.go +++ b/pkg/engine/telegram.go @@ -1,4 +1,4 @@ -package notify +package engine import ( "encoding/json" diff --git a/pkg/types/default.go b/pkg/types/default.go new file mode 100644 index 0000000..aa6b083 --- /dev/null +++ b/pkg/types/default.go @@ -0,0 +1,8 @@ +package types + +const ( + DefaultHTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n```\n{{request}}\n{{response}}```" + DefaultDNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n```{{request}}```" + DefaultSMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}\n\nThe email details were:\n\nFrom:\n{{sender}}\n\nTo:\n{{recipients}}\n\nMessage:\n{{message}}\n\nSMTP Conversation:\n{{conversation}}" + DefaultCLIMessage = "{{data}}" +) diff --git a/pkg/types/types.go b/pkg/types/types.go new file mode 100644 index 0000000..1487a1a --- /dev/null +++ b/pkg/types/types.go @@ -0,0 +1,45 @@ +package types + +type Options struct { + BIID string `yaml:"burp_biid,omitempty"` + + // Slack + SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` + SlackUsername string `yaml:"slack_username,omitempty"` + SlackChannel string `yaml:"slack_channel,omitempty"` + Slack bool `yaml:"slack,omitempty"` + + // Discord + DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` + DiscordWebHookUsername string `yaml:"discord_username,omitempty"` + DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` + Discord bool `yaml:"discord,omitempty"` + + // Telegram + TelegramAPIKey string `yaml:"telegram_apikey,omitempty"` + TelegramChatID string `yaml:"telegram_chat_id,omitempty"` + Telegram bool `yaml:"telegram,omitempty"` + + // SMTP + SMTPProviders []SMTPProvider `yaml:"smtp_providers,omitempty"` + SMTPCC []string `yaml:"smtp_cc,omitempty"` + SMTP bool `yaml:"smtp,omitempty"` + + Verbose bool + NoColor bool + Silent bool + Version bool + Interval int `yaml:"interval,omitempty"` + HTTPMessage string `yaml:"http_message,omitempty"` + DNSMessage string `yaml:"dns_message,omitempty"` + CLIMessage string `yaml:"cli_message,omitempty"` + SMTPMessage string `yaml:"smtp_message,omitempty"` + Stdin bool +} + +type SMTPProvider struct { + Server string `yaml:"smtp_server,omitempty"` + Username string `yaml:"smtp_username,omitempty"` + Password string `yaml:"smtp_password,omitempty"` + AuthenticationType string `yaml:"smtp_authentication_type,omitempty"` +} From 7829970be6a97f5fc3131e896a91713f5921b3e3 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 5 Mar 2021 21:34:54 +0100 Subject: [PATCH 23/72] custom implementation => std library --- cmd/notify/notify.go | 1 + go.mod | 2 +- go.sum | 223 +++++++++++++++++++++++++++++++++++++++++ pkg/engine/discord.go | 76 -------------- pkg/engine/notify.go | 84 ++++++++-------- pkg/engine/slack.go | 161 ----------------------------- pkg/engine/smtp.go | 60 ----------- pkg/engine/telegram.go | 75 -------------- pkg/types/types.go | 18 +++- 9 files changed, 282 insertions(+), 418 deletions(-) delete mode 100644 pkg/engine/discord.go delete mode 100644 pkg/engine/slack.go delete mode 100644 pkg/engine/smtp.go delete mode 100644 pkg/engine/telegram.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index bb34b68..3ca25cc 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -47,6 +47,7 @@ func main() { func readConfig() { set := goflags.New() + set.Marshal = true set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") set.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") diff --git a/go.mod b/go.mod index 7fef668..1559cda 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d + github.com/containrrr/shoutrrr v0.4.1 github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/goflags v0.0.2 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 - github.com/projectdiscovery/retryablehttp-go v1.0.1 ) diff --git a/go.sum b/go.sum index 9e3af6c..24de13c 100644 --- a/go.sum +++ b/go.sum @@ -1,19 +1,46 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= +github.com/agnivade/wasmbrowsertest v0.3.1/go.mod h1:zQt6ZTdl338xxRaMW395qccVE2eQm0SjC/SDz0mPWQI= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/chromedp/cdproto v0.0.0-20190614062957-d6d2f92b486d/go.mod h1:S8mB5wY3vV+vRIzf39xDXsw3XKYewW9X6rW2aEmkrSw= +github.com/chromedp/cdproto v0.0.0-20190621002710-8cbd498dd7a0/go.mod h1:S8mB5wY3vV+vRIzf39xDXsw3XKYewW9X6rW2aEmkrSw= +github.com/chromedp/cdproto v0.0.0-20190812224334-39ef923dcb8d/go.mod h1:0YChpVzuLJC5CPr+x3xkHN6Z8KOSXjNbL7qV8Wc4GW0= +github.com/chromedp/cdproto v0.0.0-20190926234355-1b4886c6fad6/go.mod h1:0YChpVzuLJC5CPr+x3xkHN6Z8KOSXjNbL7qV8Wc4GW0= +github.com/chromedp/chromedp v0.3.1-0.20190619195644-fd957a4d2901/go.mod h1:mJdvfrVn594N9tfiPecUidF6W5jPRKHymqHfzbobPsM= +github.com/chromedp/chromedp v0.4.0/go.mod h1:DC3QUn4mJ24dwjcaGQLoZrhm4X/uPHZ6spDbS2uFhm4= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= +github.com/containrrr/shoutrrr v0.4.1 h1:+p5+3Gb5dhzjUf3yriUIK6IeXtElJFFgBUGD9vb9ygE= +github.com/containrrr/shoutrrr v0.4.1/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMljIftb7WlFtzGANRCnoOhPjtl2ifcs= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= @@ -22,15 +49,51 @@ github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e h1:CQn2/8fi3km github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/go-interpreter/wagon v0.5.1-0.20190713202023-55a163980b6c/go.mod h1:5+b/MBYkclRZngKF5s6qrgWxSLgE9F5dFdO1hAueZLc= +github.com/go-interpreter/wagon v0.6.0/go.mod h1:5+b/MBYkclRZngKF5s6qrgWxSLgE9F5dFdO1hAueZLc= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -44,6 +107,7 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pO github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -53,28 +117,80 @@ github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190908185732-236ed259b199/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= +github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jarcoal/httpmock v1.0.4 h1:jp+dy/+nonJE4g4xbVtl9QdrUNbn6/3hDT5R4nDIZnA= +github.com/jarcoal/httpmock v1.0.4/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307/go.mod h1:BjPj+aVjl9FW/cCGiF3nGh5v+9Gd3VCgBQbod/GlMaQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.1.29 h1:xHBEhR+t5RzcFJjBLJlax2daXOrTYtr9z4WdKEfWFzg= github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.38 h1:MtIY+fmHUVVgv1AXzmKMWcwdCYxTRPG1EDjpqF4RCEw= github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -83,13 +199,18 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.6/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4= github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= @@ -98,6 +219,10 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -126,21 +251,72 @@ github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNw github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.7/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16/go.mod h1:iKV5yK9t+J5nG9O3uF6KYdPEz3dyfMyB15MN1rbQ8Qw= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180426230345-b49d69b5da94/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -150,15 +326,21 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -167,42 +349,65 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190306220234-b354f8bf4d9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190618155005-516e3c20635f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190927073244-c990c680b611/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210217105451-b926d437f341 h1:2/QtM1mL37YmcsT8HaDNHDgTqqFVw+zr8UzMiBVLzYU= golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -218,6 +423,7 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -230,23 +436,40 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.55.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gosrc.io/xmpp v0.5.1 h1:Rgrm5s2rt+npGggJH3HakQxQXR8ZZz3+QRzakRQqaq4= +gosrc.io/xmpp v0.5.1/go.mod h1:L3NFMqYOxyLz3JGmgFyWf7r9htE91zVGiK40oW4RwdY= +gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/gotestsum v0.3.5/go.mod h1:Mnf3e5FUzXbkCfynWBGOwLssY7gTQgCHObK9tMpAriY= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +mvdan.cc/sh v2.6.4+incompatible/go.mod h1:IeeQbZq+x2SUGBensq/jge5lLQbS3XT2ktyp3wrt4x8= +nhooyr.io/websocket v1.6.5/go.mod h1:F259lAzPRAH0htX2y3ehpJe09ih1aSHN7udWki1defY= +nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= diff --git a/pkg/engine/discord.go b/pkg/engine/discord.go deleted file mode 100644 index a6db8d4..0000000 --- a/pkg/engine/discord.go +++ /dev/null @@ -1,76 +0,0 @@ -package engine - -// From https://dev.to/arunx2/simple-slack-notification-with-golang-55i2 - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - "time" - - "github.com/projectdiscovery/retryablehttp-go" -) - -// DefaultDiscordTimeout to conclude operations -const DefaultDiscordTimeout = 5 * time.Second - -// DiscordClient handling webhooks -type DiscordClient struct { - client *retryablehttp.Client - WebHookURL string - UserName string - Avatar string - TimeOut time.Duration -} - -// DiscordMessage json structure -type DiscordMessage struct { - Username string `json:"username,omitempty"` - AvatarURL string `json:"avatar_url,omitempty"` - Content string `json:"content,omitempty"` -} - -// SendInfo to discord -func (dc *DiscordClient) SendInfo(message string) (err error) { - return dc.SendDiscordNotification(&DiscordMessage{ - Content: message, - Username: dc.UserName, - AvatarURL: dc.Avatar, - }) -} - -// SendDiscordNotification with json structure -func (dc *DiscordClient) SendDiscordNotification(discordMessage *DiscordMessage) error { - return dc.sendHTTPRequest(discordMessage) -} - -func (dc *DiscordClient) sendHTTPRequest(discordMessage *DiscordMessage) error { - discordBody, err := json.Marshal(discordMessage) - if err != nil { - return err - } - - req, err := retryablehttp.NewRequest(http.MethodPost, dc.WebHookURL, bytes.NewBuffer(discordBody)) - if err != nil { - return err - } - req.Header.Add("Content-Type", "application/json") - resp, err := dc.client.Do(req) - if err != nil { - return err - } - - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - //nolint:errcheck // silent fail - defer resp.Body.Close() - - if string(buf) != ok { - return err - } - - return nil -} diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index 3c700e9..d6bcacf 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -1,57 +1,28 @@ package engine import ( + "errors" + "fmt" + "strings" + "github.com/acarl005/stripansi" + "github.com/containrrr/shoutrrr" "github.com/projectdiscovery/notify/pkg/types" - "github.com/projectdiscovery/retryablehttp-go" ) // Notify handles the notification engine type Notify struct { - options *types.Options - client *retryablehttp.Client - slackClient *SlackClient - discordClient *DiscordClient - telegramClient *TelegramClient - smtpClient *SMTPClient + options *types.Options } // New notify instance func New() (*Notify, error) { - retryhttp := retryablehttp.NewClient(retryablehttp.DefaultOptionsSingle) - return &Notify{client: retryhttp}, nil + return &Notify{}, nil } // NewWithOptions create a new instance of notify with options func NewWithOptions(options *types.Options) (*Notify, error) { - notifier, err := New() - if err != nil { - return nil, err - } - SlackClient := &SlackClient{ - client: notifier.client, - WebHookURL: options.SlackWebHookURL, - UserName: options.SlackUsername, - Channel: options.SlackUsername, - TimeOut: DefaultSlackTimeout, - } - discordClient := &DiscordClient{ - client: notifier.client, - WebHookURL: options.DiscordWebHookURL, - UserName: options.DiscordWebHookUsername, - Avatar: options.DiscordWebHookAvatarURL, - } - telegramClient := &TelegramClient{ - client: notifier.client, - apiKEY: options.TelegramAPIKey, - chatID: options.TelegramChatID, - } - smtpClient := &SMTPClient{ - Providers: options.SMTPProviders, - CC: options.SMTPCC, - } - - return &Notify{options: options, slackClient: SlackClient, discordClient: discordClient, telegramClient: telegramClient, smtpClient: smtpClient}, nil + return &Notify{options: options}, nil } // SendNotification to registered webhooks @@ -59,28 +30,59 @@ func (n *Notify) SendNotification(message string) error { // strip unsupported color control chars message = stripansi.Strip(message) if n.options.Slack { - err := n.slackClient.SendInfo(message) + slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") + url := fmt.Sprintf("slack://%s", slackTokens) + err := shoutrrr.Send(url, message) if err != nil { return err } } if n.options.Discord { - err := n.discordClient.SendInfo(message) + discordTokens := strings.TrimPrefix(n.options.DiscordWebHookURL, "https://discord.com/api/webhooks/") + tokens := strings.Split(discordTokens, "/") + if len(tokens) != 2 { + return errors.New("Wrong discord configuration") + } + webhookID, token := tokens[0], tokens[1] + url := fmt.Sprintf("discord://%s@%s", token, webhookID) + err := shoutrrr.Send(url, message) if err != nil { return err } } if n.options.Telegram { - err := n.telegramClient.SendInfo(message) + url := fmt.Sprintf("telegram://%s@telegram?channels=%s", n.options.TelegramAPIKey, n.options.TelegramChatID) + err := shoutrrr.Send(url, message) if err != nil { return err } } if n.options.SMTP { - err := n.smtpClient.SendInfo(message) + for _, provider := range n.options.SMTPProviders { + url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", provider.Username, provider.Password, provider.Server, provider.FromAddress, strings.Join(n.options.SMTPCC, ",")) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + } + + if n.options.Pushover { + url := fmt.Sprintf("pushover://shoutrrr:apiToken@userKey/?devices=device1[,device2, ...]", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + + if n.options.Teams { + teamsTokens := strings.TrimPrefix(n.options.TeamsWebHookURL, "https://outlook.office.com/webhook/") + teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") + url := fmt.Sprintf("teams://%s", teamsTokens) + err := shoutrrr.Send(url, message) if err != nil { return err } diff --git a/pkg/engine/slack.go b/pkg/engine/slack.go deleted file mode 100644 index f5c7b3c..0000000 --- a/pkg/engine/slack.go +++ /dev/null @@ -1,161 +0,0 @@ -package engine - -// From https://dev.to/arunx2/simple-slack-notification-with-golang-55i2 - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "net/http" - "strconv" - "time" - - "github.com/projectdiscovery/retryablehttp-go" -) - -// DefaultSlackTimeout to conclude operations -const DefaultSlackTimeout = 5 * time.Second - -// SlackClient holding the slack communication logic -type SlackClient struct { - client *retryablehttp.Client - WebHookURL string - UserName string - Channel string - TimeOut time.Duration -} - -// SimpleSlackRequest basic request -type SimpleSlackRequest struct { - Text string - IconEmoji string -} - -// SlackJobNotification structure -type SlackJobNotification struct { - Color string - IconEmoji string - Details string - Text string -} - -// SlackMessage structure -type SlackMessage struct { - Username string `json:"username,omitempty"` - IconEmoji string `json:"icon_emoji,omitempty"` - Channel string `json:"channel,omitempty"` - Text string `json:"text,omitempty"` - Attachments []Attachment `json:"attachments,omitempty"` -} - -// Attachment of slack message -type Attachment struct { - Color string `json:"color,omitempty"` - Fallback string `json:"fallback,omitempty"` - CallbackID string `json:"callback_id,omitempty"` - ID int `json:"id,omitempty"` - AuthorID string `json:"author_id,omitempty"` - AuthorName string `json:"author_name,omitempty"` - AuthorSubname string `json:"author_subname,omitempty"` - AuthorLink string `json:"author_link,omitempty"` - AuthorIcon string `json:"author_icon,omitempty"` - Title string `json:"title,omitempty"` - TitleLink string `json:"title_link,omitempty"` - Pretext string `json:"pretext,omitempty"` - Text string `json:"text,omitempty"` - ImageURL string `json:"image_url,omitempty"` - ThumbURL string `json:"thumb_url,omitempty"` - // Fields and actions are not defined. - MarkdownIn []string `json:"mrkdwn_in,omitempty"` - TS json.Number `json:"ts,omitempty"` -} - -// SendSlackNotification will post to an 'Incoming Webook' url setup in Slack Apps. It accepts -// some text and the slack channel is saved within Slack. -func (sc *SlackClient) SendSlackNotification(sr SimpleSlackRequest) error { - slackRequest := &SlackMessage{ - Text: sr.Text, - Username: sc.UserName, - IconEmoji: sr.IconEmoji, - Channel: sc.Channel, - } - return sc.sendHTTPRequest(slackRequest) -} - -// SendJobNotification will post a job notification to slack -func (sc *SlackClient) SendJobNotification(job SlackJobNotification) error { - attachment := Attachment{ - Color: job.Color, - Text: job.Details, - TS: json.Number(strconv.FormatInt(time.Now().Unix(), 10)), - } - slackRequest := &SlackMessage{ - Text: job.Text, - Username: sc.UserName, - IconEmoji: job.IconEmoji, - Channel: sc.Channel, - Attachments: []Attachment{attachment}, - } - return sc.sendHTTPRequest(slackRequest) -} - -// SendError message -func (sc *SlackClient) SendError(message string, options ...string) (err error) { - return sc.funcName("danger", message, options) -} - -// SendInfo message -func (sc *SlackClient) SendInfo(message string, options ...string) (err error) { - return sc.funcName("good", message, options) -} - -// SendWarning message -func (sc *SlackClient) SendWarning(message string, options ...string) (err error) { - return sc.funcName("warning", message, options) -} - -func (sc *SlackClient) funcName(color, message string, options []string) error { - emoji := ":hammer_and_wrench" - if len(options) > 0 { - emoji = options[0] - } - sjn := SlackJobNotification{ - Color: color, - IconEmoji: emoji, - Details: message, - } - return sc.SendJobNotification(sjn) -} - -func (sc *SlackClient) sendHTTPRequest(slackRequest *SlackMessage) error { - slackBody, err := json.Marshal(slackRequest) - if err != nil { - return err - } - req, err := retryablehttp.NewRequest(http.MethodPost, sc.WebHookURL, bytes.NewBuffer(slackBody)) - if err != nil { - return err - } - req.Header.Add("Content-Type", "application/json") - if sc.TimeOut == 0 { - sc.TimeOut = DefaultSlackTimeout - } - - resp, err := sc.client.Do(req) - if err != nil { - return err - } - - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - - //nolint:errcheck // silent fail - defer resp.Body.Close() - - if string(buf) != ok { - return err - } - return nil -} diff --git a/pkg/engine/smtp.go b/pkg/engine/smtp.go deleted file mode 100644 index 64c1746..0000000 --- a/pkg/engine/smtp.go +++ /dev/null @@ -1,60 +0,0 @@ -package engine - -import ( - "net/smtp" - "time" - - "github.com/projectdiscovery/gologger" - "github.com/projectdiscovery/notify/pkg/types" -) - -// DefaultTelegraTimeout to conclude operations -const ( - DefaultSMTPTimeout = 10 * time.Second -) - -type AuthenticationType int - -const ( - PlainAuth = iota + 1 - CRAMMD5Auth -) - -type SMTPProvider struct { - Server string `yaml:"smtp_server,omitempty"` - Username string `yaml:"smtp_username,omitempty"` - Password string `yaml:"smtp_password,omitempty"` - AuthenticationType string `yaml:"smtp_authentication_type,omitempty"` -} - -// TelegramClient handling webhooks -type SMTPClient struct { - Providers []types.SMTPProvider - CC []string - TimeOut time.Duration -} - -// SendInfo to telegram -func (sm *SMTPClient) SendInfo(message string) (err error) { - // Create connection if not done already - for _, provider := range sm.Providers { - var auth smtp.Auth - if provider.AuthenticationType == "basic" { - auth = smtp.PlainAuth("", provider.Username, provider.Password, provider.Server) - } else if provider.AuthenticationType == "crammd5" { - auth = smtp.CRAMMD5Auth(provider.Username, provider.Password) - } else if provider.AuthenticationType == "none" { - auth = nil - } else { - continue - } - - err := smtp.SendMail(provider.Server, auth, provider.Username, sm.CC, []byte(message)) - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - return err - } - } - - return nil -} diff --git a/pkg/engine/telegram.go b/pkg/engine/telegram.go deleted file mode 100644 index 8756210..0000000 --- a/pkg/engine/telegram.go +++ /dev/null @@ -1,75 +0,0 @@ -package engine - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "net/http" - "strings" - "time" - - "github.com/projectdiscovery/retryablehttp-go" -) - -// DefaultTelegraTimeout to conclude operations -const ( - DefaultTelegraTimeout = 5 * time.Second - Endpoint = "https://api.telegram.org/bot{{apikey}}/sendMessage?chat_id={{chatid}}&text={{message}}" -) - -// TelegramClient handling webhooks -type TelegramClient struct { - client *retryablehttp.Client - apiKEY string - chatID string - TimeOut time.Duration -} - -// SendInfo to telegram -func (dc *TelegramClient) SendInfo(message string) (err error) { - return dc.sendHTTPRequest(message) -} - -func (dc *TelegramClient) sendHTTPRequest(message string) error { - r := strings.NewReplacer( - "{{apikey}}", dc.apiKEY, - "{{chatid}}", dc.chatID, - "{{message}}", message, - ) - URL := r.Replace(Endpoint) - req, err := retryablehttp.NewRequest(http.MethodGet, URL, nil) - if err != nil { - return err - } - resp, err := dc.client.Do(req) - if err != nil { - return err - } - - buf, err := ioutil.ReadAll(resp.Body) - if err != nil { - return err - } - //nolint:errcheck // silent fail - defer resp.Body.Close() - - var tgresponse TelegramResponse - - err = json.Unmarshal(buf, &tgresponse) - if err != nil { - return err - } - - if !tgresponse.Ok { - return fmt.Errorf("%s", tgresponse.Description) - } - - return nil -} - -// TelegramResponse structure -type TelegramResponse struct { - Ok bool `json:"ok"` - ErrorCode int `json:"error_code,omitempty"` - Description string `json:"description,omitempty"` -} diff --git a/pkg/types/types.go b/pkg/types/types.go index 1487a1a..29f6885 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -25,6 +25,16 @@ type Options struct { SMTPCC []string `yaml:"smtp_cc,omitempty"` SMTP bool `yaml:"smtp,omitempty"` + // Pushover + Pushover bool `yaml:"pushover,omitempty"` + PushoverApiToken string `yaml:"pushover_api_token,omitempty"` + UserKey string `yaml:"pushover_user_key,omitempty"` + PushoverDevices []string `yaml:"pushover_devices,omitempty"` + + // Teams + Teams bool `yaml:"teams,omitempty"` + TeamsWebHookURL string `yaml:"teams_webhook_url,omitempty"` + Verbose bool NoColor bool Silent bool @@ -38,8 +48,8 @@ type Options struct { } type SMTPProvider struct { - Server string `yaml:"smtp_server,omitempty"` - Username string `yaml:"smtp_username,omitempty"` - Password string `yaml:"smtp_password,omitempty"` - AuthenticationType string `yaml:"smtp_authentication_type,omitempty"` + Server string `yaml:"smtp_server,omitempty"` + Username string `yaml:"smtp_username,omitempty"` + Password string `yaml:"smtp_password,omitempty"` + FromAddress string `yaml:"from_address,omitempty"` } From 5a6bef4491eaa2d804d932ce48a6bb3bfad8fe34 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Fri, 5 Mar 2021 21:35:02 +0100 Subject: [PATCH 24/72] updating dockerfile --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index edfe285..17a3756 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ -FROM golang:1.14-alpine AS builder -RUN apk add --no-cache git -RUN GO111MODULE=auto go get -u -v github.com/projectdiscovery/notify/cmd/notify +FROM golang:1.16.0-alpine as build-env +RUN GO111MODULE=on go get -v github.com/projectdiscovery/notify/cmd/notify FROM alpine:latest -COPY --from=builder /go/bin/notify /usr/local/bin/ +COPY --from=build-env /go/bin/notify /usr/local/bin/notify ENTRYPOINT ["notify"] From 3b5569f43100e45141e4db53d6f74d5f94dccf72 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Wed, 26 May 2021 00:33:25 +0200 Subject: [PATCH 25/72] Deprecating golint --- .github/workflows/build.yaml | 4 +- .golangci.yml | 122 ----------------------------------- 2 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 .golangci.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 997f641..11ce30e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,10 +12,10 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2.4.0 + uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.31 + version: latest args: --timeout 5m build: diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index d5e9089..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,122 +0,0 @@ -linters-settings: - dupl: - threshold: 100 - exhaustive: - default-signifies-exhaustive: false - # funlen: - # lines: 100 - # statements: 50 - goconst: - min-len: 2 - min-occurrences: 2 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - # gocyclo: - # min-complexity: 15 - goimports: - local-prefixes: github.com/golangci/golangci-lint - golint: - min-confidence: 0 - gomnd: - settings: - mnd: - # don't include the "operation" and "assign" - checks: argument,case,condition,return - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - # lll: - # line-length: 140 - maligned: - suggest-new: true - misspell: - locale: US - nolintlint: - allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - -linters: - # please, do not use `enable-all`: it's deprecated and will be removed soon. - # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint - disable-all: true - enable: - - bodyclose - - deadcode - - dogsled - - dupl - - errcheck - - exhaustive - - gochecknoinits - - goconst - - gocritic - - gofmt - - goimports - - golint - - gomnd - - goprintffuncname - - gosimple - - govet - - ineffassign - - interfacer - - maligned - - misspell - - nakedret - - noctx - - nolintlint - - rowserrcheck - - scopelint - - staticcheck - - structcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - varcheck - - whitespace - - # don't enable: - # - depguard - # - asciicheck - # - funlen - # - gochecknoglobals - # - gocognit - # - gocyclo - # - godot - # - godox - # - goerr113 - # - gosec - # - lll - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - exclude-use-default: false - exclude: - # should have a package comment, unless it's in another file for this package (golint) - - 'in another file for this package' - -# golangci.com configuration -# https://github.com/golangci/golangci/wiki/Configuration -service: - golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly - prepare: - - echo "here I can run custom commands, but no preparation needed for this repo" From 5b428a041f527a634734a9dbf00613621c82fb24 Mon Sep 17 00:00:00 2001 From: Philippe Delteil Date: Sun, 6 Jun 2021 03:16:36 -0400 Subject: [PATCH 26/72] Update README.md Flags sorted alphabetically. Telegram flags added. Fixed typos --- README.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e39e871..3e88090 100644 --- a/README.md +++ b/README.md @@ -51,21 +51,25 @@ This will display help for the tool. Here are all the switches it supports. | Flag | Description | Example | |------|-------------|---------| | -biid | burp private key | notify -biid 123456789 | -| -slack-webhook-url | Slack Webhook URL | notify -slack-webhook-url hxxp://a.b.c | -| -slack-username | Slack Username | notify -slack-username test | -| -slack-channel | Slack Channel | notify -slack-channel test | -| -slack | Enable Slack | notify -slack | -| -discord-webhook-url | Discord Webhook URL | notify -discord-webhook-url hxxp://a.b.c | -| -discord-username | Discord Username | notify -discord-username test | | -discord-avatar | Discord Avatar Url | notify -discord-avatar hxxp://a.b.c | | -discord | Enable Discord | notify -discord | -| -silent | Silent mode | notify -silent | -| -version | Show version of notify | notify -version | -| -interval | Polling interval in seconds | notify -interval 5 | +| -discord-username | Discord Username | notify -discord-username test | +| -discord-webhook-url | Discord Webhook URL | notify -discord-webhook-url hxxp://a.b.c | +| -dns-message | DNS Message | notify -dns-message test | +| -http-message | HTTP Message | notify -http-message test | | -intercept-biid | Attempt to intercept biid (needs sudo) | notify -intercept-biid | | -intercept-biid-timeout | Timeout for biid interception in seconds | notify -intercept-biid-timeout 120 | -| -http-message | HTTP Message | notify -http-message test | -| -dns-message | DNS Message | notify -dns-message test | +| -interval | Polling interval in seconds | notify -interval 5 | +| -silent | Silent mode | notify -silent | +| -slack-channel | Slack Channel | notify -slack-channel test | +| -slack | Enable Slack | notify -slack | +| -slack-username | Slack Username | notify -slack-username test | +| -slack-webhook-url | Slack Webhook URL | notify -slack-webhook-url hxxp://a.b.c | +| -telegram-api-key | Telegram Api Key | notify -telegram-api-key 119489xxxx-:AAF4OV9 | +| -telegram-chat-id | Telegram Chat ID | notify -telegram-chat-id 1231434| +| -telegram | Enable Telegram | notify -telegram | +| -version | Show version of notify | notify -version | + # Installation Instructions @@ -153,7 +157,7 @@ If you already configured the config file, you can simply run following command ## Discord notification -Similarly to slack, in order to use discord +Similarly to slack, in order to use discord: ```sh ▶ notify -biid 132456789 -discord -discord-webhook-url https://a.b.c -discord-username notify-bot @@ -161,7 +165,7 @@ Similarly to slack, in order to use discord ## Telegram notification -Similarly to slack, in order to use discord +Similarly to slack, in order to use Telegram: ```sh ▶ notify -biid 132456789 -telegram -telegram-api-key 119489xxxx-:AAF4OV9 -telegram-chat-id 1231434 From d259c7aa32d1caa674ae1361edaeee6268f52d42 Mon Sep 17 00:00:00 2001 From: Philippe Delteil Date: Sun, 6 Jun 2021 03:36:51 -0400 Subject: [PATCH 27/72] Update README.md required dependency --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e39e871..ca88c43 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,10 @@ This will display help for the tool. Here are all the switches it supports. # Installation Instructions +## Dependencies (libpcap) + +``sudo apt-get install libpcap-dev`` + ### From Binary The installation is easy. You can download the pre-built binaries for your platform from the [releases](https://github.com/projectdiscovery/notify/releases/) page. Extract them using tar, move it to your `$PATH`and you're ready to go. From 992240478f75fefe2611922292e7b9a3d048be06 Mon Sep 17 00:00:00 2001 From: mzack Date: Fri, 25 Jun 2021 07:47:52 +0200 Subject: [PATCH 28/72] fixing lint errors --- cmd/notify/notify.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 2ea5993..b5eb576 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -20,7 +20,7 @@ func main() { // Setup close handler go func() { - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c From 73148c1e981695c56df52aff248871513281c9c2 Mon Sep 17 00:00:00 2001 From: mzack Date: Fri, 25 Jun 2021 07:54:19 +0200 Subject: [PATCH 29/72] updating deps --- go.mod | 14 +++++++++-- go.sum | 73 +++++++++++++++++++++++++++------------------------------- 2 files changed, 46 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index 1559cda..5afe2d2 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,20 @@ go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/containrrr/shoutrrr v0.4.1 + github.com/containrrr/shoutrrr v0.4.4 github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e + github.com/fatih/color v1.12.0 // indirect + github.com/google/uuid v1.2.0 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/klauspost/compress v1.13.1 // indirect + github.com/mattn/go-isatty v0.0.13 // indirect + github.com/miekg/dns v1.1.43 // indirect + github.com/onsi/ginkgo v1.16.4 // indirect github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/goflags v0.0.2 + github.com/projectdiscovery/goflags v0.0.4 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 + golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect + golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect + nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/go.sum b/go.sum index 24de13c..818efd6 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ github.com/chromedp/chromedp v0.4.0/go.mod h1:DC3QUn4mJ24dwjcaGQLoZrhm4X/uPHZ6sp github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= -github.com/containrrr/shoutrrr v0.4.1 h1:+p5+3Gb5dhzjUf3yriUIK6IeXtElJFFgBUGD9vb9ygE= -github.com/containrrr/shoutrrr v0.4.1/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= +github.com/containrrr/shoutrrr v0.4.4 h1:vHZ4E/76pKVY+Jyn/qhBz3X540Bn8NI5ppPHK4PyILY= +github.com/containrrr/shoutrrr v0.4.4/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -43,7 +43,6 @@ github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMljIftb7WlFtzGANRCnoOhPjtl2ifcs= github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= -github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e h1:CQn2/8fi3kmpT9BTiHEELgdxAOQNVZc9GoPA4qnQzrs= github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= @@ -51,9 +50,9 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -76,6 +75,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -84,11 +84,9 @@ github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -103,10 +101,10 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -120,8 +118,9 @@ github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190908185732-236ed259b199/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= @@ -132,22 +131,23 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jarcoal/httpmock v1.0.4 h1:jp+dy/+nonJE4g4xbVtl9QdrUNbn6/3hDT5R4nDIZnA= github.com/jarcoal/httpmock v1.0.4/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/knq/sysutil v0.0.0-20181215143952-f05b59f0f307/go.mod h1:BjPj+aVjl9FW/cCGiF3nGh5v+9Gd3VCgBQbod/GlMaQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -161,7 +161,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -179,23 +178,21 @@ github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.1.29 h1:xHBEhR+t5RzcFJjBLJlax2daXOrTYtr9z4WdKEfWFzg= github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.38 h1:MtIY+fmHUVVgv1AXzmKMWcwdCYxTRPG1EDjpqF4RCEw= github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -206,14 +203,13 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4= github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -233,9 +229,8 @@ github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/goflags v0.0.2 h1:4vB5+mA41xgW6V1y4YD1A+iI8Kq68iTTny50XuSYKdo= -github.com/projectdiscovery/goflags v0.0.2/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= -github.com/projectdiscovery/gologger v1.1.3 h1:rKWZW2QUigRV1jnlWwWJbJRvz8b+T/+bB5qemDGGBJU= +github.com/projectdiscovery/goflags v0.0.4 h1:fWKLMAr3KmPlZxE1b54pfei+vGIUJn9q6aM7woZIbCY= +github.com/projectdiscovery/goflags v0.0.4/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= @@ -293,7 +288,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -320,7 +314,6 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -346,19 +339,21 @@ golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -383,21 +378,23 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210217105451-b926d437f341 h1:2/QtM1mL37YmcsT8HaDNHDgTqqFVw+zr8UzMiBVLzYU= golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -438,12 +435,10 @@ google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4 google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -453,7 +448,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -471,5 +465,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= mvdan.cc/sh v2.6.4+incompatible/go.mod h1:IeeQbZq+x2SUGBensq/jge5lLQbS3XT2ktyp3wrt4x8= nhooyr.io/websocket v1.6.5/go.mod h1:F259lAzPRAH0htX2y3ehpJe09ih1aSHN7udWki1defY= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= +nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= From fc549010628e6e6548f6bd20343575fb984b3bda Mon Sep 17 00:00:00 2001 From: mzack Date: Fri, 25 Jun 2021 07:56:48 +0200 Subject: [PATCH 30/72] updating linter settings --- .github/workflows/build.yaml | 6 +- .golangci.yml | 122 ----------------------------------- 2 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 .golangci.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 997f641..59bd0a0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,11 +12,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2.4.0 + uses: golangci/golangci-lint-action@v2 with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.31 + version: latest args: --timeout 5m + working-directory: . build: name: Build diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index d5e9089..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,122 +0,0 @@ -linters-settings: - dupl: - threshold: 100 - exhaustive: - default-signifies-exhaustive: false - # funlen: - # lines: 100 - # statements: 50 - goconst: - min-len: 2 - min-occurrences: 2 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - # gocyclo: - # min-complexity: 15 - goimports: - local-prefixes: github.com/golangci/golangci-lint - golint: - min-confidence: 0 - gomnd: - settings: - mnd: - # don't include the "operation" and "assign" - checks: argument,case,condition,return - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - # lll: - # line-length: 140 - maligned: - suggest-new: true - misspell: - locale: US - nolintlint: - allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - -linters: - # please, do not use `enable-all`: it's deprecated and will be removed soon. - # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint - disable-all: true - enable: - - bodyclose - - deadcode - - dogsled - - dupl - - errcheck - - exhaustive - - gochecknoinits - - goconst - - gocritic - - gofmt - - goimports - - golint - - gomnd - - goprintffuncname - - gosimple - - govet - - ineffassign - - interfacer - - maligned - - misspell - - nakedret - - noctx - - nolintlint - - rowserrcheck - - scopelint - - staticcheck - - structcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - varcheck - - whitespace - - # don't enable: - # - depguard - # - asciicheck - # - funlen - # - gochecknoglobals - # - gocognit - # - gocyclo - # - godot - # - godox - # - goerr113 - # - gosec - # - lll - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - exclude-use-default: false - exclude: - # should have a package comment, unless it's in another file for this package (golint) - - 'in another file for this package' - -# golangci.com configuration -# https://github.com/golangci/golangci/wiki/Configuration -service: - golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly - prepare: - - echo "here I can run custom commands, but no preparation needed for this repo" From 6a23403713ef48602057d5f5cda8fd4472f41438 Mon Sep 17 00:00:00 2001 From: mzack Date: Fri, 25 Jun 2021 08:02:36 +0200 Subject: [PATCH 31/72] misc --- cmd/notify/notify.go | 2 +- internal/runner/runner.go | 7 ------- pkg/engine/const.go | 5 ----- pkg/engine/notify.go | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 pkg/engine/const.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 3ca25cc..36fc185 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -29,7 +29,7 @@ func main() { // Setup close handler go func() { - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d5f8eed..96ece47 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -14,13 +14,6 @@ import ( "github.com/projectdiscovery/notify/pkg/types" ) -const ( - defaultHTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n```\n{{request}}\n{{response}}```" - defaultDNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n```{{request}}```" - defaultSMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}\n\nThe email details were:\n\nFrom:\n{{sender}}\n\nTo:\n{{recipients}}\n\nMessage:\n{{message}}\n\nSMTP Conversation:\n{{conversation}}" - defaultCLIMessage = "{{data}}" -) - // Runner contains the internal logic of the program type Runner struct { options *types.Options diff --git a/pkg/engine/const.go b/pkg/engine/const.go deleted file mode 100644 index c5ceeee..0000000 --- a/pkg/engine/const.go +++ /dev/null @@ -1,5 +0,0 @@ -package engine - -const ( - ok = "ok" -) diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index d6bcacf..38884c1 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -71,7 +71,7 @@ func (n *Notify) SendNotification(message string) error { } if n.options.Pushover { - url := fmt.Sprintf("pushover://shoutrrr:apiToken@userKey/?devices=device1[,device2, ...]", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) + url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) err := shoutrrr.Send(url, message) if err != nil { return err From e087f102e42247d7e8120c8e0552d4801629ed60 Mon Sep 17 00:00:00 2001 From: mzack Date: Fri, 25 Jun 2021 09:49:02 +0200 Subject: [PATCH 32/72] temporary updating goflags --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5afe2d2..10047c5 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/miekg/dns v1.1.43 // indirect github.com/onsi/ginkgo v1.16.4 // indirect github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/goflags v0.0.4 + github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect diff --git a/go.sum b/go.sum index 818efd6..80c6bed 100644 --- a/go.sum +++ b/go.sum @@ -231,6 +231,8 @@ github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/ github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= github.com/projectdiscovery/goflags v0.0.4 h1:fWKLMAr3KmPlZxE1b54pfei+vGIUJn9q6aM7woZIbCY= github.com/projectdiscovery/goflags v0.0.4/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= +github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= From 4a561ae7e5c4ff96695ab02373bc5254e9cda754 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 1 Jul 2021 15:00:41 +0530 Subject: [PATCH 33/72] add -data flag to suport file reading --- cmd/notify/notify.go | 2 ++ internal/runner/runner.go | 18 ++++++++++++++++-- pkg/types/types.go | 4 +++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 36fc185..cbc9a4e 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -71,6 +71,8 @@ func readConfig() { set.StringVar(&options.DNSMessage, "message-dns", types.DefaultDNSMessage, "DNS Message") set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") + set.StringVar(&options.Data, "data", "", "file path to read data from") + _ = set.Parse() if cfgFile != "" { diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 96ece47..d02340a 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -36,8 +36,22 @@ func NewRunner(options *types.Options) (*Runner, error) { // Run polling and notification func (r *Runner) Run() error { // If stdin is present pass everything to webhooks and exit - if hasStdin() { - br := bufio.NewScanner(os.Stdin) + if hasStdin() || r.options.Data != "" { + var br *bufio.Scanner + + switch { + case hasStdin(): + br = bufio.NewScanner(os.Stdin) + + case r.options.Data != "": + inFile, err := os.Open(r.options.Data) + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } + br = bufio.NewScanner(inFile) + + } + for br.Scan() { msg := br.Text() rr := strings.NewReplacer( diff --git a/pkg/types/types.go b/pkg/types/types.go index 29f6885..11698a6 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -44,7 +44,9 @@ type Options struct { DNSMessage string `yaml:"dns_message,omitempty"` CLIMessage string `yaml:"cli_message,omitempty"` SMTPMessage string `yaml:"smtp_message,omitempty"` - Stdin bool + + Stdin bool + Data string `yaml:"data,omitempty"` } type SMTPProvider struct { From 2ab04213977df5875282775fdb16331398fb6d5e Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Mon, 5 Jul 2021 20:22:28 +0530 Subject: [PATCH 34/72] add stdin-all flag --- cmd/notify/notify.go | 3 +- go.sum | 2 -- internal/runner/runner.go | 67 ++++++++++++++++++++++++++++++++------- pkg/engine/notify.go | 35 ++++++++++++-------- pkg/types/types.go | 5 +-- 5 files changed, 81 insertions(+), 31 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index cbc9a4e..3a10dc4 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -71,7 +71,8 @@ func readConfig() { set.StringVar(&options.DNSMessage, "message-dns", types.DefaultDNSMessage, "DNS Message") set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") - set.StringVar(&options.Data, "data", "", "file path to read data from") + set.StringVar(&options.Data, "data", "", "File path to read data from") + set.BoolVar(&options.StdinAll, "stdin-all", false, "Read all the input and send it as single message") _ = set.Parse() diff --git a/go.sum b/go.sum index 80c6bed..904def9 100644 --- a/go.sum +++ b/go.sum @@ -229,8 +229,6 @@ github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/goflags v0.0.4 h1:fWKLMAr3KmPlZxE1b54pfei+vGIUJn9q6aM7woZIbCY= -github.com/projectdiscovery/goflags v0.0.4/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d02340a..93377d6 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -3,6 +3,7 @@ package runner import ( "bufio" "fmt" + "io" "os" "strconv" "strings" @@ -35,32 +36,59 @@ func NewRunner(options *types.Options) (*Runner, error) { // Run polling and notification func (r *Runner) Run() error { - // If stdin is present pass everything to webhooks and exit + + // If stdin/file input is present pass everything to webhooks and exit if hasStdin() || r.options.Data != "" { - var br *bufio.Scanner + var inFile *os.File + var err error switch { case hasStdin(): - br = bufio.NewScanner(os.Stdin) + inFile = os.Stdin case r.options.Data != "": - inFile, err := os.Open(r.options.Data) + inFile, err = os.Open(r.options.Data) if err != nil { gologger.Fatal().Msgf("%s\n", err) } - br = bufio.NewScanner(inFile) + } + if r.options.StdinAll { + fi, err := inFile.Stat() + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } + + // LimitReader can be used to read large file content in smaller chunks (size of which is supported by platforms) + // Although this might cause one issue: messages won't necessarily get delivered in the same order that they are sent + reader := io.LimitReader(inFile, fi.Size()) + msgB := make([]byte, fi.Size()) + for { + n, err := reader.Read(msgB) + if err != nil { + if err == io.EOF { + break + } + gologger.Fatal().Msgf("%s\n", err) + } + + if n == 0 { + break + } + + msg := string(msgB) + if err := r.sendMessage(msg); err != nil { + gologger.Fatal().Msgf("%s\n", err) + } + } + + os.Exit(0) } + br := bufio.NewScanner(inFile) for br.Scan() { msg := br.Text() - rr := strings.NewReplacer( - "{{data}}", msg, - ) - msg = rr.Replace(r.options.CLIMessage) - gologger.Print().Msgf(msg) - //nolint:errcheck // silent fail - r.notifier.SendNotification(msg) + r.sendMessage(msg) } os.Exit(0) } @@ -143,6 +171,21 @@ func (r *Runner) Run() error { } } +func (r *Runner) sendMessage(msg string) error { + rr := strings.NewReplacer( + "{{data}}", msg, + ) + msg = rr.Replace(r.options.CLIMessage) + if len(msg) > 0 { + gologger.Print().Msgf(msg) + err := r.notifier.SendNotification(msg) + if err != nil { + return err + } + } + return nil +} + // Close the runner instance func (r *Runner) Close() { r.burpcollab.Empty() diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index 38884c1..52ca9d9 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -1,12 +1,12 @@ package engine import ( - "errors" "fmt" "strings" "github.com/acarl005/stripansi" "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/types" ) @@ -34,29 +34,33 @@ func (n *Notify) SendNotification(message string) error { url := fmt.Sprintf("slack://%s", slackTokens) err := shoutrrr.Send(url, message) if err != nil { - return err + gologger.Error().Msgf("Slack: error while sending message : %s\n", err) + // return err } } if n.options.Discord { discordTokens := strings.TrimPrefix(n.options.DiscordWebHookURL, "https://discord.com/api/webhooks/") tokens := strings.Split(discordTokens, "/") - if len(tokens) != 2 { - return errors.New("Wrong discord configuration") - } - webhookID, token := tokens[0], tokens[1] - url := fmt.Sprintf("discord://%s@%s", token, webhookID) - err := shoutrrr.Send(url, message) - if err != nil { - return err + if len(tokens) == 2 { + webhookID, token := tokens[0], tokens[1] + url := fmt.Sprintf("discord://%s@%s?splitlines=No", token, webhookID) + err := shoutrrr.Send(url, message) + if err != nil { + gologger.Error().Msgf("Discord: error while sending message : %s\n", err) + // return err + } } + // return errors.New("Wrong discord configuration") + } if n.options.Telegram { url := fmt.Sprintf("telegram://%s@telegram?channels=%s", n.options.TelegramAPIKey, n.options.TelegramChatID) err := shoutrrr.Send(url, message) if err != nil { - return err + gologger.Error().Msgf("Telegram: error while sending message : %s\n", err) + // return err } } @@ -65,7 +69,8 @@ func (n *Notify) SendNotification(message string) error { url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", provider.Username, provider.Password, provider.Server, provider.FromAddress, strings.Join(n.options.SMTPCC, ",")) err := shoutrrr.Send(url, message) if err != nil { - return err + gologger.Error().Msgf("SMTP: error while sending message : %s\n", err) + // return err } } } @@ -74,7 +79,8 @@ func (n *Notify) SendNotification(message string) error { url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) err := shoutrrr.Send(url, message) if err != nil { - return err + gologger.Error().Msgf("Pushover: error while sending message : %s\n", err) + // return err } } @@ -84,7 +90,8 @@ func (n *Notify) SendNotification(message string) error { url := fmt.Sprintf("teams://%s", teamsTokens) err := shoutrrr.Send(url, message) if err != nil { - return err + gologger.Error().Msgf("Teams: error while sending message : %s\n", err) + // return err } } diff --git a/pkg/types/types.go b/pkg/types/types.go index 11698a6..c4ad634 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -45,8 +45,9 @@ type Options struct { CLIMessage string `yaml:"cli_message,omitempty"` SMTPMessage string `yaml:"smtp_message,omitempty"` - Stdin bool - Data string `yaml:"data,omitempty"` + Stdin bool + StdinAll bool `yaml:"stdin-all,omitempty"` + Data string `yaml:"data,omitempty"` } type SMTPProvider struct { From 433fb03374feb0b18fce2a87610f684d7c978b1d Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Tue, 6 Jul 2021 09:06:55 +0530 Subject: [PATCH 35/72] fix lint issue --- internal/runner/runner.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 93377d6..b335ab8 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -88,6 +88,7 @@ func (r *Runner) Run() error { br := bufio.NewScanner(inFile) for br.Scan() { msg := br.Text() + //nolint:errcheck r.sendMessage(msg) } os.Exit(0) From 0b6b3e1aa3a99816c17ac9d483439afab6276941 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Wed, 7 Jul 2021 17:56:31 +0530 Subject: [PATCH 36/72] add support to send Slack messages in a thread --- cmd/notify/notify.go | 3 ++- go.mod | 5 ++++- go.sum | 17 ++++++++++------- pkg/engine/notify.go | 10 ++++++++-- pkg/types/types.go | 1 + 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index cbc9a4e..3fc3437 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -51,10 +51,11 @@ func readConfig() { set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") set.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") + set.BoolVar(&options.Slack, "slack", false, "Enable Slack") set.StringVar(&options.SlackWebHookURL, "slack-webhook-url", "", "Slack Webhook URL") set.StringVar(&options.SlackUsername, "slack-username", "", "Slack Username") set.StringVar(&options.SlackChannel, "slack-channel", "", "Slack Channel") - set.BoolVar(&options.Slack, "slack", false, "Enable Slack") + set.StringVar(&options.SlackThreadTS, "slack-thread-ts", "", "Slack Message TimeStamp (To send messages as reply in thread)") set.StringVar(&options.DiscordWebHookURL, "discord-webhook-url", "", "Discord Webhook URL") set.StringVar(&options.DiscordWebHookUsername, "discord-username", "", "Discord Username") set.StringVar(&options.DiscordWebHookAvatarURL, "discord-channel", "", "Discord Channel") diff --git a/go.mod b/go.mod index 10047c5..4b30b89 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/containrrr/shoutrrr v0.4.4 + github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557 github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/fatih/color v1.12.0 // indirect github.com/google/uuid v1.2.0 // indirect @@ -14,9 +14,12 @@ require ( github.com/miekg/dns v1.1.43 // indirect github.com/onsi/ginkgo v1.16.4 // indirect github.com/projectdiscovery/collaborator v0.0.2 + github.com/projectdiscovery/fastdialer v0.0.8 // indirect github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 + github.com/projectdiscovery/retryabledns v1.0.10 // indirect + github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 // indirect golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect nhooyr.io/websocket v1.8.7 // indirect diff --git a/go.sum b/go.sum index 80c6bed..c2f7b65 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ github.com/chromedp/chromedp v0.4.0/go.mod h1:DC3QUn4mJ24dwjcaGQLoZrhm4X/uPHZ6sp github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= -github.com/containrrr/shoutrrr v0.4.4 h1:vHZ4E/76pKVY+Jyn/qhBz3X540Bn8NI5ppPHK4PyILY= -github.com/containrrr/shoutrrr v0.4.4/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= +github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557 h1:TvIiq3pBYX9D25mu1jZvCezS2FjoVvCS320pWytJkXI= +github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -227,10 +227,9 @@ github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5 github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= -github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/goflags v0.0.4 h1:fWKLMAr3KmPlZxE1b54pfei+vGIUJn9q6aM7woZIbCY= -github.com/projectdiscovery/goflags v0.0.4/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= +github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= @@ -242,10 +241,13 @@ github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCA github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 h1:kVGWhu6pisPOTpDi9T/wBNF//BL3quenLv9oS1CXfQ4= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06/go.mod h1:KD3L4uNgvAXHS6JywunTPhiyVGBqLljweugPAPRNj3s= -github.com/projectdiscovery/retryabledns v1.0.6 h1:fz33puVeUKJJ5s2POSlxO4WA4iodW6Yzm/EVNuO/93w= github.com/projectdiscovery/retryabledns v1.0.6/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= +github.com/projectdiscovery/retryabledns v1.0.7/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= +github.com/projectdiscovery/retryabledns v1.0.10 h1:xJZ2aKoqrNg/OZEw1+4+QIOH40V/WkZDYY1ZZc+uphE= +github.com/projectdiscovery/retryabledns v1.0.10/go.mod h1:4sMC8HZyF01HXukRleSQYwz4870bwgb4+hTSXTMrkf4= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 h1:CJHP3CLCc/eqdXQEvZy8KiiqtAk9kEsd1URtPyPAQ1s= +github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727/go.mod h1:dx//aY9V247qHdsRf0vdWHTBZuBQ2vm6Dq5dagxrDYI= github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -343,6 +345,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index 38884c1..a545156 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -3,6 +3,7 @@ package engine import ( "errors" "fmt" + "net/url" "strings" "github.com/acarl005/stripansi" @@ -31,8 +32,13 @@ func (n *Notify) SendNotification(message string) error { message = stripansi.Strip(message) if n.options.Slack { slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") - url := fmt.Sprintf("slack://%s", slackTokens) - err := shoutrrr.Send(url, message) + url := &url.URL{ + Scheme: "slack", + Path: slackTokens, + RawQuery: fmt.Sprintf("thread_ts=%s", n.options.SlackThreadTS), + } + + err := shoutrrr.Send(url.String(), message) if err != nil { return err } diff --git a/pkg/types/types.go b/pkg/types/types.go index 11698a6..f564445 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -7,6 +7,7 @@ type Options struct { SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` SlackUsername string `yaml:"slack_username,omitempty"` SlackChannel string `yaml:"slack_channel,omitempty"` + SlackThreadTS string `yaml:"slack_thread_ts,omitempty"` Slack bool `yaml:"slack,omitempty"` // Discord From cdbdda0bad4f3df98c4d590a3ea20a68135bcb7f Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 8 Jul 2021 22:24:43 +0530 Subject: [PATCH 37/72] put in empty check for slack-thread-ts value --- pkg/engine/notify.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index a545156..c1d1cf9 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -33,9 +33,12 @@ func (n *Notify) SendNotification(message string) error { if n.options.Slack { slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") url := &url.URL{ - Scheme: "slack", - Path: slackTokens, - RawQuery: fmt.Sprintf("thread_ts=%s", n.options.SlackThreadTS), + Scheme: "slack", + Path: slackTokens, + } + + if n.options.SlackThreadTS != "" { + url.RawQuery = fmt.Sprintf("thread_ts=%s", n.options.SlackThreadTS) } err := shoutrrr.Send(url.String(), message) From bdb28bdf63939c342aa43713b512d41637f6e1e4 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Wed, 14 Jul 2021 14:17:30 +0530 Subject: [PATCH 38/72] add char-limit flag and split text by lines --- cmd/notify/notify.go | 1 + internal/runner/runner.go | 31 +++++++++++------------ internal/runner/util.go | 53 +++++++++++++++++++++++++++++++++++++++ pkg/engine/notify.go | 2 +- pkg/types/types.go | 7 +++--- 5 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 internal/runner/util.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 3a10dc4..f2ba280 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -73,6 +73,7 @@ func readConfig() { set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") set.StringVar(&options.Data, "data", "", "File path to read data from") set.BoolVar(&options.StdinAll, "stdin-all", false, "Read all the input and send it as single message") + set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") _ = set.Parse() diff --git a/internal/runner/runner.go b/internal/runner/runner.go index b335ab8..7bdf228 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -3,7 +3,6 @@ package runner import ( "bufio" "fmt" - "io" "os" "strconv" "strings" @@ -59,25 +58,23 @@ func (r *Runner) Run() error { gologger.Fatal().Msgf("%s\n", err) } - // LimitReader can be used to read large file content in smaller chunks (size of which is supported by platforms) - // Although this might cause one issue: messages won't necessarily get delivered in the same order that they are sent - reader := io.LimitReader(inFile, fi.Size()) msgB := make([]byte, fi.Size()) - for { - n, err := reader.Read(msgB) - if err != nil { - if err == io.EOF { - break - } - gologger.Fatal().Msgf("%s\n", err) - } + n, err := inFile.Read(msgB) + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } - if n == 0 { - break - } + if n == 0 { + gologger.Fatal().Msgf("%s\n", err) + } + + // char limit to search for a split + searchLimit := 250 + + items := SplitText(string(msgB), r.options.CharLimit, searchLimit) - msg := string(msgB) - if err := r.sendMessage(msg); err != nil { + for _, v := range items { + if err := r.sendMessage(v); err != nil { gologger.Fatal().Msgf("%s\n", err) } } diff --git a/internal/runner/util.go b/internal/runner/util.go new file mode 100644 index 0000000..a487be7 --- /dev/null +++ b/internal/runner/util.go @@ -0,0 +1,53 @@ +package runner + +import ( + "math" +) + +// SplitText tries to split a string by line while keeping the chunk size as close to maxChunkSize as possible (equal or less than maxChunkSize) +func SplitText(in string, maxChunkSize, searchLimit int) (chunks []string) { + runes := []rune(in) + totalSize := len(runes) + + chunkOffset := 0 + + maxPossibleChunks := int(math.Ceil(float64(totalSize) / float64(maxChunkSize-searchLimit+1))) + + for i := 0; i <= maxPossibleChunks; i++ { + + chunkEnd := chunkOffset + maxChunkSize + nextChunkStart := chunkEnd + + // Check if it is the last chunk (chunkEnd is greater or equal to total size) + if chunkEnd >= totalSize { + chunkEnd = totalSize + nextChunkStart = totalSize + } else { + + //Check for a line break + for j := 0; j < searchLimit; j++ { + + sp := chunkEnd - j + + // Check if sp is the suitable split point + if runes[sp] == '\n' { + + chunkEnd = sp + nextChunkStart = chunkEnd + 1 + + break + } + } + + } + + chunks = append(chunks, string(runes[chunkOffset:chunkEnd])) + + chunkOffset = nextChunkStart + if chunkOffset >= totalSize { + break + } + } + + return chunks +} diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index 52ca9d9..8c77ef7 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -44,7 +44,7 @@ func (n *Notify) SendNotification(message string) error { tokens := strings.Split(discordTokens, "/") if len(tokens) == 2 { webhookID, token := tokens[0], tokens[1] - url := fmt.Sprintf("discord://%s@%s?splitlines=No", token, webhookID) + url := fmt.Sprintf("discord://%s@%s?splitlines=no", token, webhookID) err := shoutrrr.Send(url, message) if err != nil { gologger.Error().Msgf("Discord: error while sending message : %s\n", err) diff --git a/pkg/types/types.go b/pkg/types/types.go index c4ad634..d361710 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -45,9 +45,10 @@ type Options struct { CLIMessage string `yaml:"cli_message,omitempty"` SMTPMessage string `yaml:"smtp_message,omitempty"` - Stdin bool - StdinAll bool `yaml:"stdin-all,omitempty"` - Data string `yaml:"data,omitempty"` + Stdin bool + StdinAll bool `yaml:"stdin_all,omitempty"` + CharLimit int `yaml:"char_limit,omitempty"` + Data string `yaml:"data,omitempty"` } type SMTPProvider struct { From 94a17a7a66e93d68ba8da98d70bdabf34bf795e7 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 15 Jul 2021 16:41:23 +0530 Subject: [PATCH 39/72] add separate provider config, code restructuring to prepare for custom provider implementation --- cmd/notify/notify.go | 14 +--- go.mod | 5 ++ go.sum | 13 ++-- internal/runner/runner.go | 39 +++++++++- pkg/engine/notify.go | 114 ++++++++++++++--------------- pkg/providers/discord/discord.go | 50 +++++++++++++ pkg/providers/providers.go | 103 ++++++++++++++++++++++++++ pkg/providers/pushover/pushover.go | 44 +++++++++++ pkg/providers/slack/slack.go | 46 ++++++++++++ pkg/providers/smtp/smtp.go | 46 ++++++++++++ pkg/providers/teams/teams.go | 44 +++++++++++ pkg/providers/telegram/telegram.go | 42 +++++++++++ pkg/types/types.go | 53 +++----------- pkg/utils/utils.go | 11 +++ 14 files changed, 503 insertions(+), 121 deletions(-) create mode 100644 pkg/providers/discord/discord.go create mode 100644 pkg/providers/providers.go create mode 100644 pkg/providers/pushover/pushover.go create mode 100644 pkg/providers/slack/slack.go create mode 100644 pkg/providers/smtp/smtp.go create mode 100644 pkg/providers/teams/teams.go create mode 100644 pkg/providers/telegram/telegram.go create mode 100644 pkg/utils/utils.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index cbc9a4e..3ba26d1 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -51,17 +51,6 @@ func readConfig() { set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") set.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") - set.StringVar(&options.SlackWebHookURL, "slack-webhook-url", "", "Slack Webhook URL") - set.StringVar(&options.SlackUsername, "slack-username", "", "Slack Username") - set.StringVar(&options.SlackChannel, "slack-channel", "", "Slack Channel") - set.BoolVar(&options.Slack, "slack", false, "Enable Slack") - set.StringVar(&options.DiscordWebHookURL, "discord-webhook-url", "", "Discord Webhook URL") - set.StringVar(&options.DiscordWebHookUsername, "discord-username", "", "Discord Username") - set.StringVar(&options.DiscordWebHookAvatarURL, "discord-channel", "", "Discord Channel") - set.BoolVar(&options.Discord, "discord", false, "Enable Discord") - set.StringVar(&options.TelegramAPIKey, "telegram-api-key", "", "Telegram API Key") - set.StringVar(&options.TelegramChatID, "telegram-chat-id", "", "Telegram Chat ID") - set.BoolVar(&options.Telegram, "telegram", false, "Enable Telegram") set.BoolVar(&options.Silent, "silent", false, "Don't print the banner") set.BoolVar(&options.Version, "version", false, "Show version of notify") set.BoolVar(&options.Verbose, "v", false, "Show Verbose output") @@ -72,6 +61,9 @@ func readConfig() { set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") set.StringVar(&options.Data, "data", "", "file path to read data from") + set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") + set.StringSliceVar(&options.Providers, "provider", []string{}, "") + set.StringSliceVar(&options.Profiles, "profile", []string{}, "") _ = set.Parse() diff --git a/go.mod b/go.mod index 10047c5..e44ea27 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,16 @@ require ( github.com/mattn/go-isatty v0.0.13 // indirect github.com/miekg/dns v1.1.43 // indirect github.com/onsi/ginkgo v1.16.4 // indirect + github.com/pkg/errors v0.9.1 github.com/projectdiscovery/collaborator v0.0.2 + github.com/projectdiscovery/fastdialer v0.0.8 // indirect github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 + github.com/projectdiscovery/retryabledns v1.0.10 // indirect + github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 // indirect golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect + gopkg.in/yaml.v2 v2.4.0 nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/go.sum b/go.sum index 80c6bed..6bfcc51 100644 --- a/go.sum +++ b/go.sum @@ -227,10 +227,9 @@ github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5 github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= -github.com/projectdiscovery/fastdialer v0.0.5 h1:wTeZRPFED1VQRcw5aGoeZ6UlhJ6Cra/Jqw2Wi5kPuis= github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/goflags v0.0.4 h1:fWKLMAr3KmPlZxE1b54pfei+vGIUJn9q6aM7woZIbCY= -github.com/projectdiscovery/goflags v0.0.4/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= +github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= @@ -242,10 +241,13 @@ github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCA github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 h1:kVGWhu6pisPOTpDi9T/wBNF//BL3quenLv9oS1CXfQ4= github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06/go.mod h1:KD3L4uNgvAXHS6JywunTPhiyVGBqLljweugPAPRNj3s= -github.com/projectdiscovery/retryabledns v1.0.6 h1:fz33puVeUKJJ5s2POSlxO4WA4iodW6Yzm/EVNuO/93w= github.com/projectdiscovery/retryabledns v1.0.6/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -github.com/projectdiscovery/retryablehttp-go v1.0.1 h1:V7wUvsZNq1Rcz7+IlcyoyQlNwshuwptuBVYWw9lx8RE= +github.com/projectdiscovery/retryabledns v1.0.7/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= +github.com/projectdiscovery/retryabledns v1.0.10 h1:xJZ2aKoqrNg/OZEw1+4+QIOH40V/WkZDYY1ZZc+uphE= +github.com/projectdiscovery/retryabledns v1.0.10/go.mod h1:4sMC8HZyF01HXukRleSQYwz4870bwgb4+hTSXTMrkf4= github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= +github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 h1:CJHP3CLCc/eqdXQEvZy8KiiqtAk9kEsd1URtPyPAQ1s= +github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727/go.mod h1:dx//aY9V247qHdsRf0vdWHTBZuBQ2vm6Dq5dagxrDYI= github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -343,6 +345,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d02340a..d2d7257 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -4,14 +4,18 @@ import ( "bufio" "fmt" "os" + "path" "strconv" "strings" "time" + "github.com/pkg/errors" "github.com/projectdiscovery/collaborator" "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/engine" + "github.com/projectdiscovery/notify/pkg/providers" "github.com/projectdiscovery/notify/pkg/types" + "gopkg.in/yaml.v2" ) // Runner contains the internal logic of the program @@ -19,6 +23,7 @@ type Runner struct { options *types.Options burpcollab *collaborator.BurpCollaborator notifier *engine.Notify + providers *providers.Client } // NewRunner instance @@ -29,8 +34,35 @@ func NewRunner(options *types.Options) (*Runner, error) { if err != nil { return nil, err } + var providerOptions providers.Options - return &Runner{options: options, burpcollab: burpcollab, notifier: notifier}, nil + if options.ProviderConfig == "" { + home, err := os.UserHomeDir() + if err != nil { + return nil, err + } + options.ProviderConfig = path.Join(home, "/.config/notify/provider-config.yaml") + gologger.Print().Msgf("Using default provider config: %s\n", options.ProviderConfig) + } + + file, err := os.Open(options.ProviderConfig) + if err != nil { + return nil, errors.Wrap(err, "could not open provider config file") + } + + if parseErr := yaml.NewDecoder(file).Decode(&providerOptions); parseErr != nil { + file.Close() + return nil, errors.Wrap(parseErr, "could not parse provider config file") + } + + file.Close() + + prClient, err := providers.New(&providerOptions, options.Providers, options.Profiles) + if err != nil { + return nil, err + } + + return &Runner{options: options, burpcollab: burpcollab, notifier: notifier, providers: prClient}, nil } // Run polling and notification @@ -54,13 +86,16 @@ func (r *Runner) Run() error { for br.Scan() { msg := br.Text() + if msg == "" { + continue + } rr := strings.NewReplacer( "{{data}}", msg, ) msg = rr.Replace(r.options.CLIMessage) gologger.Print().Msgf(msg) //nolint:errcheck // silent fail - r.notifier.SendNotification(msg) + r.providers.Send(msg) } os.Exit(0) } diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go index 38884c1..dd6bb64 100644 --- a/pkg/engine/notify.go +++ b/pkg/engine/notify.go @@ -1,12 +1,6 @@ package engine import ( - "errors" - "fmt" - "strings" - - "github.com/acarl005/stripansi" - "github.com/containrrr/shoutrrr" "github.com/projectdiscovery/notify/pkg/types" ) @@ -28,65 +22,65 @@ func NewWithOptions(options *types.Options) (*Notify, error) { // SendNotification to registered webhooks func (n *Notify) SendNotification(message string) error { // strip unsupported color control chars - message = stripansi.Strip(message) - if n.options.Slack { - slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") - url := fmt.Sprintf("slack://%s", slackTokens) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } + // message = stripansi.Strip(message) + // if n.options.Slack { + // slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") + // url := fmt.Sprintf("slack://%s", slackTokens) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } - if n.options.Discord { - discordTokens := strings.TrimPrefix(n.options.DiscordWebHookURL, "https://discord.com/api/webhooks/") - tokens := strings.Split(discordTokens, "/") - if len(tokens) != 2 { - return errors.New("Wrong discord configuration") - } - webhookID, token := tokens[0], tokens[1] - url := fmt.Sprintf("discord://%s@%s", token, webhookID) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } + // if n.options.Discord { + // discordTokens := strings.TrimPrefix(n.options.DiscordWebHookURL, "https://discord.com/api/webhooks/") + // tokens := strings.Split(discordTokens, "/") + // if len(tokens) != 2 { + // return errors.New("Wrong discord configuration") + // } + // webhookID, token := tokens[0], tokens[1] + // url := fmt.Sprintf("discord://%s@%s", token, webhookID) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } - if n.options.Telegram { - url := fmt.Sprintf("telegram://%s@telegram?channels=%s", n.options.TelegramAPIKey, n.options.TelegramChatID) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } + // if n.options.Telegram { + // url := fmt.Sprintf("telegram://%s@telegram?channels=%s", n.options.TelegramAPIKey, n.options.TelegramChatID) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } - if n.options.SMTP { - for _, provider := range n.options.SMTPProviders { - url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", provider.Username, provider.Password, provider.Server, provider.FromAddress, strings.Join(n.options.SMTPCC, ",")) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } - } + // if n.options.SMTP { + // for _, provider := range n.options.SMTPProviders { + // url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", provider.Username, provider.Password, provider.Server, provider.FromAddress, strings.Join(n.options.SMTPCC, ",")) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } + // } - if n.options.Pushover { - url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } + // if n.options.Pushover { + // url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } - if n.options.Teams { - teamsTokens := strings.TrimPrefix(n.options.TeamsWebHookURL, "https://outlook.office.com/webhook/") - teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") - url := fmt.Sprintf("teams://%s", teamsTokens) - err := shoutrrr.Send(url, message) - if err != nil { - return err - } - } + // if n.options.Teams { + // teamsTokens := strings.TrimPrefix(n.options.TeamsWebHookURL, "https://outlook.office.com/webhook/") + // teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") + // url := fmt.Sprintf("teams://%s", teamsTokens) + // err := shoutrrr.Send(url, message) + // if err != nil { + // return err + // } + // } return nil } diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go new file mode 100644 index 0000000..075285c --- /dev/null +++ b/pkg/providers/discord/discord.go @@ -0,0 +1,50 @@ +package discord + +import ( + "errors" + "fmt" + "strings" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + Discord []*Options `yaml:"discord,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` + DiscordWebHookUsername string `yaml:"discord_username,omitempty"` + DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Discord = append(provider.Discord, o) + } + } + + return provider, nil +} +func (p *Provider) Send(message string) error { + + for _, pr := range p.Discord { + discordTokens := strings.TrimPrefix(pr.DiscordWebHookURL, "https://discord.com/api/webhooks/") + tokens := strings.Split(discordTokens, "/") + if len(tokens) != 2 { + return errors.New("Wrong discord configuration") + } + webhookID, token := tokens[0], tokens[1] + url := fmt.Sprintf("discord://%s@%s", token, webhookID) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go new file mode 100644 index 0000000..a9104f6 --- /dev/null +++ b/pkg/providers/providers.go @@ -0,0 +1,103 @@ +package providers + +import ( + "github.com/acarl005/stripansi" + "github.com/pkg/errors" + "github.com/projectdiscovery/notify/pkg/providers/discord" + "github.com/projectdiscovery/notify/pkg/providers/pushover" + "github.com/projectdiscovery/notify/pkg/providers/slack" + "github.com/projectdiscovery/notify/pkg/providers/smtp" + "github.com/projectdiscovery/notify/pkg/providers/teams" + "github.com/projectdiscovery/notify/pkg/providers/telegram" + "github.com/projectdiscovery/notify/pkg/utils" +) + +// Options is a configuration file for nuclei reporting module +type Options struct { + Slack []*slack.Options `yaml:"slack,omitempty"` + Discord []*discord.Options `yaml:"discord,omitempty"` + Pushover []*pushover.Options `yaml:"pushover,omitempty"` + SMTP []*smtp.Options `yaml:"smtp,omitempty"` + Teams []*teams.Options `yaml:"teams,omitempty"` + Telegram []*telegram.Options `yaml:"telegram,omitempty"` +} + +// Provider is an interface implemented by providers +type Provider interface { + Send(string) error +} + +type Client struct { + providers []Provider + options *Options +} + +func New(options *Options, providers, profiles []string) (*Client, error) { + + client := &Client{options: options} + + if options.Slack != nil && (len(providers) == 0 || utils.Contains(providers, "slack")) { + + provider, err := slack.New(options.Slack, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create slack provider client") + } + + client.providers = append(client.providers, provider) + } + if options.Discord != nil && (len(providers) == 0 || utils.Contains(providers, "discord")) { + + provider, err := discord.New(options.Discord, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create discord provider client") + } + client.providers = append(client.providers, provider) + } + if options.Pushover != nil && (len(providers) == 0 || utils.Contains(providers, "pushover")) { + + provider, err := pushover.New(options.Pushover, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create pushover provider client") + } + client.providers = append(client.providers, provider) + } + if options.SMTP != nil && (len(providers) == 0 || utils.Contains(providers, "smtp")) { + + provider, err := smtp.New(options.SMTP, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create smtp provider client") + } + client.providers = append(client.providers, provider) + } + if options.Teams != nil && (len(providers) == 0 || utils.Contains(providers, "teams")) { + + provider, err := teams.New(options.Teams, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create teams provider client") + } + client.providers = append(client.providers, provider) + } + if options.Telegram != nil && (len(providers) == 0 || utils.Contains(providers, "telegram")) { + + provider, err := telegram.New(options.Telegram, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create telegram provider client") + } + client.providers = append(client.providers, provider) + } + + return client, nil +} + +func (p *Client) Send(message string) error { + + // strip unsupported color control chars + message = stripansi.Strip(message) + + for _, v := range p.providers { + //nolint:errcheck + v.Send(message) + } + + return nil +} diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go new file mode 100644 index 0000000..85ca543 --- /dev/null +++ b/pkg/providers/pushover/pushover.go @@ -0,0 +1,44 @@ +package pushover + +import ( + "fmt" + "strings" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + Pushover []*Options `yaml:"pushover,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + PushoverApiToken string `yaml:"pushover_api_token,omitempty"` + UserKey string `yaml:"pushover_user_key,omitempty"` + PushoverDevices []string `yaml:"pushover_devices,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Pushover = append(provider.Pushover, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.Pushover { + url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", pr.PushoverApiToken, pr.UserKey, strings.Join(pr.PushoverDevices, ",")) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go new file mode 100644 index 0000000..11a101e --- /dev/null +++ b/pkg/providers/slack/slack.go @@ -0,0 +1,46 @@ +package slack + +import ( + "fmt" + "strings" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + Slack []*Options `yaml:"slack,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` + SlackUsername string `yaml:"slack_username,omitempty"` + SlackChannel string `yaml:"slack_channel,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Slack = append(provider.Slack, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.Slack { + + slackTokens := strings.TrimPrefix(pr.SlackWebHookURL, "https://hooks.slack.com/services/") + url := fmt.Sprintf("slack://%s", slackTokens) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go new file mode 100644 index 0000000..01468bf --- /dev/null +++ b/pkg/providers/smtp/smtp.go @@ -0,0 +1,46 @@ +package smtp + +import ( + "fmt" + "strings" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + SMTP []*Options `yaml:"smtp,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + Server string `yaml:"smtp_server,omitempty"` + Username string `yaml:"smtp_username,omitempty"` + Password string `yaml:"smtp_password,omitempty"` + FromAddress string `yaml:"from_address,omitempty"` + SMTPCC []string `yaml:"smtp_cc,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.SMTP = append(provider.SMTP, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.SMTP { + url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", pr.Username, pr.Password, pr.Server, pr.FromAddress, strings.Join(pr.SMTPCC, ",")) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go new file mode 100644 index 0000000..a2d1e8a --- /dev/null +++ b/pkg/providers/teams/teams.go @@ -0,0 +1,44 @@ +package teams + +import ( + "fmt" + "strings" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + Teams []*Options `yaml:"teams,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + TeamsWebHookURL string `yaml:"teams_webhook_url,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Teams = append(provider.Teams, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.Teams { + teamsTokens := strings.TrimPrefix(pr.TeamsWebHookURL, "https://outlook.office.com/webhook/") + teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") + url := fmt.Sprintf("teams://%s", teamsTokens) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go new file mode 100644 index 0000000..13fc92e --- /dev/null +++ b/pkg/providers/telegram/telegram.go @@ -0,0 +1,42 @@ +package telegram + +import ( + "fmt" + + "github.com/containrrr/shoutrrr" + "github.com/projectdiscovery/notify/pkg/utils" +) + +type Provider struct { + Telegram []*Options `yaml:"options,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + TelegramAPIKey string `yaml:"telegram_apikey,omitempty"` + TelegramChatID string `yaml:"telegram_chat_id,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Telegram = append(provider.Telegram, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.Telegram { + url := fmt.Sprintf("telegram://%s@telegram?channels=%s", pr.TelegramAPIKey, pr.TelegramChatID) + err := shoutrrr.Send(url, message) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/types/types.go b/pkg/types/types.go index 11698a6..48f48f1 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -1,45 +1,19 @@ package types +import "github.com/projectdiscovery/goflags" + type Options struct { BIID string `yaml:"burp_biid,omitempty"` - // Slack - SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` - SlackUsername string `yaml:"slack_username,omitempty"` - SlackChannel string `yaml:"slack_channel,omitempty"` - Slack bool `yaml:"slack,omitempty"` - - // Discord - DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` - DiscordWebHookUsername string `yaml:"discord_username,omitempty"` - DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` - Discord bool `yaml:"discord,omitempty"` - - // Telegram - TelegramAPIKey string `yaml:"telegram_apikey,omitempty"` - TelegramChatID string `yaml:"telegram_chat_id,omitempty"` - Telegram bool `yaml:"telegram,omitempty"` - - // SMTP - SMTPProviders []SMTPProvider `yaml:"smtp_providers,omitempty"` - SMTPCC []string `yaml:"smtp_cc,omitempty"` - SMTP bool `yaml:"smtp,omitempty"` + Verbose bool `yaml:"verbose,omitempty"` + NoColor bool `yaml:"no_color,omitempty"` + Silent bool `yaml:"silent,omitempty"` + Version bool `yaml:"version,omitempty"` + Interval int `yaml:"interval,omitempty"` + ProviderConfig string `yaml:"provider_config,omitempty"` + Providers goflags.StringSlice `yaml:"providers,omitempty"` + Profiles goflags.StringSlice `yaml:"profiles,omitempty"` - // Pushover - Pushover bool `yaml:"pushover,omitempty"` - PushoverApiToken string `yaml:"pushover_api_token,omitempty"` - UserKey string `yaml:"pushover_user_key,omitempty"` - PushoverDevices []string `yaml:"pushover_devices,omitempty"` - - // Teams - Teams bool `yaml:"teams,omitempty"` - TeamsWebHookURL string `yaml:"teams_webhook_url,omitempty"` - - Verbose bool - NoColor bool - Silent bool - Version bool - Interval int `yaml:"interval,omitempty"` HTTPMessage string `yaml:"http_message,omitempty"` DNSMessage string `yaml:"dns_message,omitempty"` CLIMessage string `yaml:"cli_message,omitempty"` @@ -48,10 +22,3 @@ type Options struct { Stdin bool Data string `yaml:"data,omitempty"` } - -type SMTPProvider struct { - Server string `yaml:"smtp_server,omitempty"` - Username string `yaml:"smtp_username,omitempty"` - Password string `yaml:"smtp_password,omitempty"` - FromAddress string `yaml:"from_address,omitempty"` -} diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go new file mode 100644 index 0000000..a7677d3 --- /dev/null +++ b/pkg/utils/utils.go @@ -0,0 +1,11 @@ +package utils + +func Contains(slice []string, item string) bool { + set := make(map[string]struct{}, len(slice)) + for _, s := range slice { + set[s] = struct{}{} + } + + _, ok := set[item] + return ok +} From d05526fa79ed12fbae8b9390c22d9828abf66364 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 16 Jul 2021 22:22:09 +0530 Subject: [PATCH 40/72] log send error --- pkg/providers/providers.go | 6 ++++-- pkg/providers/telegram/telegram.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index a9104f6..3132f98 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -3,6 +3,7 @@ package providers import ( "github.com/acarl005/stripansi" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/providers/discord" "github.com/projectdiscovery/notify/pkg/providers/pushover" "github.com/projectdiscovery/notify/pkg/providers/slack" @@ -95,8 +96,9 @@ func (p *Client) Send(message string) error { message = stripansi.Strip(message) for _, v := range p.providers { - //nolint:errcheck - v.Send(message) + if err := v.Send(message); err != nil { + gologger.Error().Msgf("error while sending message: %s", err) + } } return nil diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index 13fc92e..7d3cd8d 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -8,12 +8,12 @@ import ( ) type Provider struct { - Telegram []*Options `yaml:"options,omitempty"` + Telegram []*Options `yaml:"telegram,omitempty"` } type Options struct { Profile string `yaml:"profile,omitempty"` - TelegramAPIKey string `yaml:"telegram_apikey,omitempty"` + TelegramAPIKey string `yaml:"telegram_api_key,omitempty"` TelegramChatID string `yaml:"telegram_chat_id,omitempty"` } From ae037d52d98076d71cee3ff9eb9df1b3cd9d85eb Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Sat, 17 Jul 2021 07:49:29 +0530 Subject: [PATCH 41/72] combine error and bytes count check --- internal/runner/runner.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 7bdf228..389e3c8 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -59,12 +59,9 @@ func (r *Runner) Run() error { } msgB := make([]byte, fi.Size()) + n, err := inFile.Read(msgB) - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - } - - if n == 0 { + if err != nil || n == 0 { gologger.Fatal().Msgf("%s\n", err) } From b312b248a95c961de54b1b97d21dc05b239b8fe9 Mon Sep 17 00:00:00 2001 From: Ziaur Rashid Date: Thu, 22 Jul 2021 00:07:38 +0600 Subject: [PATCH 42/72] [Fix] CVE-2020-9283: Improper Signature Verification Affected version of golang.org/x/crypto package is vulnerable to Improper Signature Verification (CVE-2020-9283, CWE-347). --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f6b1562..f380ecd 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/projectdiscovery/collaborator v0.0.1 github.com/projectdiscovery/gologger v1.0.1 github.com/projectdiscovery/retryablehttp-go v1.0.1 - golang.org/x/crypto v0.0.0-20201116153603-4be66e5b6582 // indirect + golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c // indirect golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect golang.org/x/sys v0.0.0-20201116194326-cc9327a14d48 // indirect ) From ac84d8b0eb01d6b2f85a12bc01734d087e9e33dc Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Sat, 24 Jul 2021 12:08:45 +0530 Subject: [PATCH 43/72] update goflags --- cmd/notify/notify.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 3ba26d1..4101273 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -46,7 +46,7 @@ func main() { } func readConfig() { - set := goflags.New() + set := goflags.NewFlagSet() set.Marshal = true set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") diff --git a/go.mod b/go.mod index 383d5bb..7510c48 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/fastdialer v0.0.8 // indirect - github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b + github.com/projectdiscovery/goflags v0.0.5 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryabledns v1.0.10 // indirect diff --git a/go.sum b/go.sum index c2f7b65..f4cd833 100644 --- a/go.sum +++ b/go.sum @@ -230,8 +230,8 @@ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCt github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= -github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= -github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/goflags v0.0.5 h1:jI6HD9Z7vkg4C4Cz16BfZKICnIf94W3KFU5M3DcUgUk= +github.com/projectdiscovery/goflags v0.0.5/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= From 80f5241a08f3663e545bce6586d6aaaa31beccac Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Sat, 24 Jul 2021 13:03:53 +0530 Subject: [PATCH 44/72] update goflags, replace stdin-all flag with bulk --- cmd/notify/notify.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- internal/runner/runner.go | 5 ++++- internal/runner/util.go | 10 ++++++++-- pkg/types/types.go | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 3b1ef6b..b856da8 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -46,7 +46,7 @@ func main() { } func readConfig() { - set := goflags.New() + set := goflags.NewFlagSet() set.Marshal = true set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") @@ -61,7 +61,7 @@ func readConfig() { set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") set.StringVar(&options.Data, "data", "", "File path to read data from") - set.BoolVar(&options.StdinAll, "stdin-all", false, "Read all the input and send it as single message") + set.BoolVar(&options.Bulk, "bulk", false, "Read the input and send it in bulk, character limit can be set using char-limit flag") set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") set.StringSliceVar(&options.Providers, "provider", []string{}, "") diff --git a/go.mod b/go.mod index e44ea27..092677f 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/fastdialer v0.0.8 // indirect - github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b + github.com/projectdiscovery/goflags v0.0.5 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryabledns v1.0.10 // indirect diff --git a/go.sum b/go.sum index 6bfcc51..c3482e1 100644 --- a/go.sum +++ b/go.sum @@ -230,8 +230,8 @@ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCt github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= -github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b h1:5qQHjTH8J0muAeq3PyTCpP41+ExjwH3zTLd9beoCjzI= -github.com/projectdiscovery/goflags v0.0.5-0.20210625074658-a323e95c0c3b/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/goflags v0.0.5 h1:jI6HD9Z7vkg4C4Cz16BfZKICnIf94W3KFU5M3DcUgUk= +github.com/projectdiscovery/goflags v0.0.5/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= diff --git a/internal/runner/runner.go b/internal/runner/runner.go index dfbb9c8..051137b 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -84,7 +84,7 @@ func (r *Runner) Run() error { } } - if r.options.StdinAll { + if r.options.Bulk { fi, err := inFile.Stat() if err != nil { gologger.Fatal().Msgf("%s\n", err) @@ -99,6 +99,9 @@ func (r *Runner) Run() error { // char limit to search for a split searchLimit := 250 + if r.options.CharLimit < searchLimit { + searchLimit = r.options.CharLimit + } items := SplitText(string(msgB), r.options.CharLimit, searchLimit) diff --git a/internal/runner/util.go b/internal/runner/util.go index a487be7..b103497 100644 --- a/internal/runner/util.go +++ b/internal/runner/util.go @@ -8,10 +8,13 @@ import ( func SplitText(in string, maxChunkSize, searchLimit int) (chunks []string) { runes := []rune(in) totalSize := len(runes) - + minChunkSize := 1 chunkOffset := 0 - maxPossibleChunks := int(math.Ceil(float64(totalSize) / float64(maxChunkSize-searchLimit+1))) + if maxChunkSize > searchLimit { + minChunkSize = maxChunkSize - searchLimit + } + maxPossibleChunks := int(math.Ceil(float64(totalSize) / float64(minChunkSize))) for i := 0; i <= maxPossibleChunks; i++ { @@ -29,6 +32,9 @@ func SplitText(in string, maxChunkSize, searchLimit int) (chunks []string) { sp := chunkEnd - j + if sp < 0 { + break + } // Check if sp is the suitable split point if runes[sp] == '\n' { diff --git a/pkg/types/types.go b/pkg/types/types.go index dbcba52..c4cb450 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -20,7 +20,7 @@ type Options struct { SMTPMessage string `yaml:"smtp_message,omitempty"` Stdin bool - StdinAll bool `yaml:"stdin_all,omitempty"` + Bulk bool `yaml:"bulk,omitempty"` CharLimit int `yaml:"char_limit,omitempty"` Data string `yaml:"data,omitempty"` } From cf3087f3a78084961c913bc70979d6de2554b5ce Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Mon, 26 Jul 2021 11:31:29 +0530 Subject: [PATCH 45/72] add custom webhook URL support --- go.mod | 4 +-- go.sum | 4 +-- pkg/providers/custom/custom.go | 60 ++++++++++++++++++++++++++++++++++ pkg/providers/providers.go | 13 +++++++- 4 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 pkg/providers/custom/custom.go diff --git a/go.mod b/go.mod index e44ea27..12fc110 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d - github.com/containrrr/shoutrrr v0.4.4 + github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557 github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/fatih/color v1.12.0 // indirect github.com/google/uuid v1.2.0 // indirect @@ -20,7 +20,7 @@ require ( github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryabledns v1.0.10 // indirect - github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 // indirect + github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 6bfcc51..c2f7b65 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ github.com/chromedp/chromedp v0.4.0/go.mod h1:DC3QUn4mJ24dwjcaGQLoZrhm4X/uPHZ6sp github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ= github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4= -github.com/containrrr/shoutrrr v0.4.4 h1:vHZ4E/76pKVY+Jyn/qhBz3X540Bn8NI5ppPHK4PyILY= -github.com/containrrr/shoutrrr v0.4.4/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= +github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557 h1:TvIiq3pBYX9D25mu1jZvCezS2FjoVvCS320pWytJkXI= +github.com/containrrr/shoutrrr v0.4.5-0.20210707101419-8018a476b557/go.mod h1:zqL2BvfC1W4FujrT4b3/ZCLxvD+uoeEpBL7rg9Dqpbg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= diff --git a/pkg/providers/custom/custom.go b/pkg/providers/custom/custom.go new file mode 100644 index 0000000..39f2066 --- /dev/null +++ b/pkg/providers/custom/custom.go @@ -0,0 +1,60 @@ +package custom + +import ( + "bytes" + "strings" + + "github.com/projectdiscovery/notify/pkg/utils" + "github.com/projectdiscovery/retryablehttp-go" +) + +type Provider struct { + Custom []*Options `yaml:"custom,omitempty"` +} + +type Options struct { + Profile string `yaml:"profile,omitempty"` + CustomWebhookURL string `yaml:"custom_webook_url,omitempty"` + CustomMethod string `yaml:"custom_method,omitempty"` + CustomHeaders map[string]string `yaml:"custom_headers,omitempty"` + CustomBody string `yaml:"custom_body,omitempty"` +} + +func New(options []*Options, profiles []string) (*Provider, error) { + provider := &Provider{} + + for _, o := range options { + if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + provider.Custom = append(provider.Custom, o) + } + } + + return provider, nil +} + +func (p *Provider) Send(message string) error { + + for _, pr := range p.Custom { + + rr := strings.NewReplacer( + "{{data}}", message, + ) + final := rr.Replace(pr.CustomBody) + + r, err := retryablehttp.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, bytes.NewReader([]byte(final))) + if err != nil { + return err + } + + for k, v := range pr.CustomHeaders { + r.Header.Set(k, v) + } + + client := retryablehttp.NewClient(retryablehttp.DefaultOptionsSingle) + _, err = client.Do(r) + if err != nil { + return err + } + } + return nil +} diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index 3132f98..4c47a97 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -4,6 +4,7 @@ import ( "github.com/acarl005/stripansi" "github.com/pkg/errors" "github.com/projectdiscovery/gologger" + "github.com/projectdiscovery/notify/pkg/providers/custom" "github.com/projectdiscovery/notify/pkg/providers/discord" "github.com/projectdiscovery/notify/pkg/providers/pushover" "github.com/projectdiscovery/notify/pkg/providers/slack" @@ -13,7 +14,7 @@ import ( "github.com/projectdiscovery/notify/pkg/utils" ) -// Options is a configuration file for nuclei reporting module +// Options is a configuration file for notify providers type Options struct { Slack []*slack.Options `yaml:"slack,omitempty"` Discord []*discord.Options `yaml:"discord,omitempty"` @@ -21,6 +22,7 @@ type Options struct { SMTP []*smtp.Options `yaml:"smtp,omitempty"` Teams []*teams.Options `yaml:"teams,omitempty"` Telegram []*telegram.Options `yaml:"telegram,omitempty"` + Custom []*custom.Options `yaml:"custom,omitempty"` } // Provider is an interface implemented by providers @@ -87,6 +89,15 @@ func New(options *Options, providers, profiles []string) (*Client, error) { client.providers = append(client.providers, provider) } + if options.Custom != nil && (len(providers) == 0 || utils.Contains(providers, "custom")) { + + provider, err := custom.New(options.Custom, profiles) + if err != nil { + return nil, errors.Wrap(err, "could not create custom provider client") + } + client.providers = append(client.providers, provider) + } + return client, nil } From 16464827b258f020220cb25dcb9f5b37d8671a22 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Mon, 26 Jul 2021 17:38:06 +0530 Subject: [PATCH 46/72] remove intercept and collaborator --- cmd/intercept/intercept.go | 46 ---------------- cmd/notify/notify.go | 6 --- internal/runner/runner.go | 108 +++---------------------------------- pkg/engine/doc.go | 2 - pkg/engine/notify.go | 86 ----------------------------- pkg/types/default.go | 5 +- pkg/types/types.go | 8 --- 7 files changed, 8 insertions(+), 253 deletions(-) delete mode 100644 cmd/intercept/intercept.go delete mode 100644 pkg/engine/doc.go delete mode 100644 pkg/engine/notify.go diff --git a/cmd/intercept/intercept.go b/cmd/intercept/intercept.go deleted file mode 100644 index 9eb7ae9..0000000 --- a/cmd/intercept/intercept.go +++ /dev/null @@ -1,46 +0,0 @@ -package main - -import ( - "flag" - "net/http" - "os" - "strings" - - "github.com/elazarl/goproxy" - "github.com/projectdiscovery/gologger" - "github.com/projectdiscovery/proxify" -) - -// Options to handle intercept -type Options struct { - ListenAddress string -} - -func main() { - var options Options - flag.StringVar(&options.ListenAddress, "listen-address", ":8888", "Listen Port") - - gologger.Print().Msgf("Starting Intercepting Proxy") - proxy, err := proxify.NewProxy(&proxify.Options{ - ListenAddr: options.ListenAddress, - CertCacheSize: 256, - OnRequestCallback: func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { - if req.Host == "polling.burpcollaborator.net" && strings.HasSuffix(req.URL.Path, "/burpresults") { - interceptedBiid := req.URL.Query().Get("biid") - if interceptedBiid != "" { - gologger.Print().Msgf("BIID found: %s", interceptedBiid) - os.Exit(0) - } - } - return req, nil - }, - OnResponseCallback: func(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response { - return resp - }, - }) - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - } - - gologger.Print().Msgf("%s", proxy.Run()) -} diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index b856da8..4f26555 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -50,16 +50,10 @@ func readConfig() { set.Marshal = true set.SetDescription(`Notify is a general notification tool`) set.StringVar(&cfgFile, "config", "", "Notify configuration file") - set.StringVar(&options.BIID, "biid", "", "burp collaborator unique id") set.BoolVar(&options.Silent, "silent", false, "Don't print the banner") set.BoolVar(&options.Version, "version", false, "Show version of notify") set.BoolVar(&options.Verbose, "v", false, "Show Verbose output") set.BoolVar(&options.NoColor, "no-color", false, "Don't Use colors in output") - set.IntVar(&options.Interval, "interval", 2, "Polling interval in seconds") - set.StringVar(&options.HTTPMessage, "message-http", types.DefaultHTTPMessage, "HTTP Message") - set.StringVar(&options.DNSMessage, "message-dns", types.DefaultDNSMessage, "DNS Message") - set.StringVar(&options.SMTPMessage, "message-smtp", types.DefaultSMTPMessage, "SMTP Message") - set.StringVar(&options.CLIMessage, "message-cli", types.DefaultCLIMessage, "CLI Message") set.StringVar(&options.Data, "data", "", "File path to read data from") set.BoolVar(&options.Bulk, "bulk", false, "Read the input and send it in bulk, character limit can be set using char-limit flag") set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 051137b..fa18ee8 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -2,17 +2,11 @@ package runner import ( "bufio" - "fmt" "os" "path" - "strconv" - "strings" - "time" "github.com/pkg/errors" - "github.com/projectdiscovery/collaborator" "github.com/projectdiscovery/gologger" - "github.com/projectdiscovery/notify/pkg/engine" "github.com/projectdiscovery/notify/pkg/providers" "github.com/projectdiscovery/notify/pkg/types" "gopkg.in/yaml.v2" @@ -20,20 +14,13 @@ import ( // Runner contains the internal logic of the program type Runner struct { - options *types.Options - burpcollab *collaborator.BurpCollaborator - notifier *engine.Notify - providers *providers.Client + options *types.Options + providers *providers.Client } // NewRunner instance func NewRunner(options *types.Options) (*Runner, error) { - burpcollab := collaborator.NewBurpCollaborator() - notifier, err := engine.NewWithOptions(options) - if err != nil { - return nil, err - } var providerOptions providers.Options if options.ProviderConfig == "" { @@ -41,7 +28,7 @@ func NewRunner(options *types.Options) (*Runner, error) { if err != nil { return nil, err } - options.ProviderConfig = path.Join(home, "/.config/notify/provider-config.yaml") + options.ProviderConfig = path.Join(home, types.DefaultProviderConfigLocation) gologger.Print().Msgf("Using default provider config: %s\n", options.ProviderConfig) } @@ -62,7 +49,7 @@ func NewRunner(options *types.Options) (*Runner, error) { return nil, err } - return &Runner{options: options, burpcollab: burpcollab, notifier: notifier, providers: prClient}, nil + return &Runner{options: options, providers: prClient}, nil } // Run polling and notification @@ -123,90 +110,11 @@ func (r *Runner) Run() error { } os.Exit(0) } - - // otherwise works as long term collaborator poll and notify via webhook - // If BIID passed via cli - if r.options.BIID != "" { - gologger.Print().Msgf("Using BIID: %s", r.options.BIID) - r.burpcollab.AddBIID(r.options.BIID) - } - - if r.options.BIID == "" { - return fmt.Errorf("BIID not specified or not found") - } - - err := r.burpcollab.Poll() - if err != nil { - return err - } - - pollTime := time.Duration(r.options.Interval) * time.Second - for { - time.Sleep(pollTime) - //nolint:errcheck // silent fail - r.burpcollab.Poll() - - for _, httpresp := range r.burpcollab.RespBuffer { - for i := range httpresp.Responses { - resp := httpresp.Responses[i] - var at int64 - at, _ = strconv.ParseInt(resp.Time, 10, 64) - atTime := time.Unix(0, at*int64(time.Millisecond)) - switch resp.Protocol { - case "http", "https": - rr := strings.NewReplacer( - "{{protocol}}", strings.ToUpper(resp.Protocol), - "{{from}}", resp.Client, - "{{time}}", atTime.String(), - "{{request}}", resp.Data.RequestDecoded, - "{{response}}", resp.Data.ResponseDecoded, - ) - - msg := rr.Replace(r.options.HTTPMessage) - gologger.Print().Msgf(msg) - - //nolint:errcheck // silent fail - r.notifier.SendNotification(msg) - case "dns": - rr := strings.NewReplacer( - "{{type}}", resp.Data.RequestType, - "{{domain}} ", resp.Data.SubDomain, - "{{from}}", resp.Client, - "{{time}}", atTime.String(), - "{{request}}", resp.Data.RawRequestDecoded, - ) - msg := rr.Replace(r.options.DNSMessage) - gologger.Print().Msgf(msg) - - //nolint:errcheck // silent fail - r.notifier.SendNotification(msg) - case "smtp": - rr := strings.NewReplacer( - "{{from}}", resp.Client, - "{{time}}", atTime.String(), - "{{sender}}", resp.Data.SenderDecoded, - "{{recipients}}", strings.Join(resp.Data.RecipientsDecoded, ","), - "{{message}}", resp.Data.MessageDecoded, - "{{conversation}}", resp.Data.ConversationDecoded, - ) - msg := rr.Replace(r.options.SMTPMessage) - gologger.Print().Msgf(msg) - - //nolint:errcheck // silent fail - r.notifier.SendNotification(msg) - } - } - } - - r.burpcollab.Empty() - } + return errors.New("notify works with stdin or file using -data flag") } func (r *Runner) sendMessage(msg string) error { - rr := strings.NewReplacer( - "{{data}}", msg, - ) - msg = rr.Replace(r.options.CLIMessage) + if len(msg) > 0 { gologger.Print().Msgf(msg) err := r.providers.Send(msg) @@ -218,6 +126,4 @@ func (r *Runner) sendMessage(msg string) error { } // Close the runner instance -func (r *Runner) Close() { - r.burpcollab.Empty() -} +func (r *Runner) Close() {} diff --git a/pkg/engine/doc.go b/pkg/engine/doc.go deleted file mode 100644 index e0075ed..0000000 --- a/pkg/engine/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package engine notifies out of band interactions via webhook -package engine diff --git a/pkg/engine/notify.go b/pkg/engine/notify.go deleted file mode 100644 index dd6bb64..0000000 --- a/pkg/engine/notify.go +++ /dev/null @@ -1,86 +0,0 @@ -package engine - -import ( - "github.com/projectdiscovery/notify/pkg/types" -) - -// Notify handles the notification engine -type Notify struct { - options *types.Options -} - -// New notify instance -func New() (*Notify, error) { - return &Notify{}, nil -} - -// NewWithOptions create a new instance of notify with options -func NewWithOptions(options *types.Options) (*Notify, error) { - return &Notify{options: options}, nil -} - -// SendNotification to registered webhooks -func (n *Notify) SendNotification(message string) error { - // strip unsupported color control chars - // message = stripansi.Strip(message) - // if n.options.Slack { - // slackTokens := strings.TrimPrefix(n.options.SlackWebHookURL, "https://hooks.slack.com/services/") - // url := fmt.Sprintf("slack://%s", slackTokens) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - - // if n.options.Discord { - // discordTokens := strings.TrimPrefix(n.options.DiscordWebHookURL, "https://discord.com/api/webhooks/") - // tokens := strings.Split(discordTokens, "/") - // if len(tokens) != 2 { - // return errors.New("Wrong discord configuration") - // } - // webhookID, token := tokens[0], tokens[1] - // url := fmt.Sprintf("discord://%s@%s", token, webhookID) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - - // if n.options.Telegram { - // url := fmt.Sprintf("telegram://%s@telegram?channels=%s", n.options.TelegramAPIKey, n.options.TelegramChatID) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - - // if n.options.SMTP { - // for _, provider := range n.options.SMTPProviders { - // url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", provider.Username, provider.Password, provider.Server, provider.FromAddress, strings.Join(n.options.SMTPCC, ",")) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - // } - - // if n.options.Pushover { - // url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", n.options.PushoverApiToken, n.options.UserKey, strings.Join(n.options.PushoverDevices, ",")) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - - // if n.options.Teams { - // teamsTokens := strings.TrimPrefix(n.options.TeamsWebHookURL, "https://outlook.office.com/webhook/") - // teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") - // url := fmt.Sprintf("teams://%s", teamsTokens) - // err := shoutrrr.Send(url, message) - // if err != nil { - // return err - // } - // } - - return nil -} diff --git a/pkg/types/default.go b/pkg/types/default.go index aa6b083..1f520b9 100644 --- a/pkg/types/default.go +++ b/pkg/types/default.go @@ -1,8 +1,5 @@ package types const ( - DefaultHTTPMessage = "The collaborator server received an {{protocol}} request from {{from}} at {{time}}:\n```\n{{request}}\n{{response}}```" - DefaultDNSMessage = "The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}:\n```{{request}}```" - DefaultSMTPMessage = "The collaborator server received an SMTP connection from IP address {{from}} at {{time}}\n\nThe email details were:\n\nFrom:\n{{sender}}\n\nTo:\n{{recipients}}\n\nMessage:\n{{message}}\n\nSMTP Conversation:\n{{conversation}}" - DefaultCLIMessage = "{{data}}" + DefaultProviderConfigLocation = "/.config/notify/provider-config.yaml" ) diff --git a/pkg/types/types.go b/pkg/types/types.go index c4cb450..059c448 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -3,22 +3,14 @@ package types import "github.com/projectdiscovery/goflags" type Options struct { - BIID string `yaml:"burp_biid,omitempty"` - Verbose bool `yaml:"verbose,omitempty"` NoColor bool `yaml:"no_color,omitempty"` Silent bool `yaml:"silent,omitempty"` Version bool `yaml:"version,omitempty"` - Interval int `yaml:"interval,omitempty"` ProviderConfig string `yaml:"provider_config,omitempty"` Providers goflags.StringSlice `yaml:"providers,omitempty"` Profiles goflags.StringSlice `yaml:"profiles,omitempty"` - HTTPMessage string `yaml:"http_message,omitempty"` - DNSMessage string `yaml:"dns_message,omitempty"` - CLIMessage string `yaml:"cli_message,omitempty"` - SMTPMessage string `yaml:"smtp_message,omitempty"` - Stdin bool Bulk bool `yaml:"bulk,omitempty"` CharLimit int `yaml:"char_limit,omitempty"` From 357a3ee739ecce43bbe71f78dc35767d027171b0 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Mon, 26 Jul 2021 19:48:03 +0530 Subject: [PATCH 47/72] fix default provider config location --- pkg/types/default.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/types/default.go b/pkg/types/default.go index 1f520b9..aaf75ee 100644 --- a/pkg/types/default.go +++ b/pkg/types/default.go @@ -1,5 +1,5 @@ package types const ( - DefaultProviderConfigLocation = "/.config/notify/provider-config.yaml" + DefaultProviderConfigLocation = ".config/notify/provider-config.yaml" ) From 618c0f7fc12d1fa148f61acbe5b95cac741e85ba Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Mon, 26 Jul 2021 19:58:36 +0530 Subject: [PATCH 48/72] remove intercept build instructions --- .github/workflows/build.yaml | 10 +--------- .gitignore | 1 - .goreleaser.yml | 11 ----------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 59bd0a0..f5cc649 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,12 +36,4 @@ jobs: - name: Build notify run: go build . - working-directory: cmd/notify/ - - - name: Test intercept - run: go test . - working-directory: cmd/intercept/ - - - name: Build intercept - run: go build . - working-directory: cmd/intercept/ \ No newline at end of file + working-directory: cmd/notify/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index bef0f48..b762b24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ cmd/notify/notify -cmd/intercept/intercept .DS_Store dist \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index a6f9382..5b8fad0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,17 +10,6 @@ builds: - 386 - arm - arm64 - - binary: intercept - main: cmd/intercept/intercept.go - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - 386 - - arm - - arm64 archives: - id: tgz From 52891a52936fc11ef50c8d536af6848c812ae6e5 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 30 Jul 2021 11:07:10 +0530 Subject: [PATCH 49/72] change profile to id --- cmd/notify/notify.go | 2 +- internal/runner/runner.go | 2 +- pkg/providers/discord/discord.go | 6 +++--- pkg/providers/providers.go | 14 +++++++------- pkg/providers/pushover/pushover.go | 6 +++--- pkg/providers/slack/slack.go | 6 +++--- pkg/providers/smtp/smtp.go | 6 +++--- pkg/providers/teams/teams.go | 6 +++--- pkg/providers/telegram/telegram.go | 6 +++--- pkg/types/types.go | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index b856da8..a4bb41a 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -65,7 +65,7 @@ func readConfig() { set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") set.StringSliceVar(&options.Providers, "provider", []string{}, "") - set.StringSliceVar(&options.Profiles, "profile", []string{}, "") + set.StringSliceVar(&options.IDs, "id", []string{}, "") _ = set.Parse() diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 051137b..d65bd05 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -57,7 +57,7 @@ func NewRunner(options *types.Options) (*Runner, error) { file.Close() - prClient, err := providers.New(&providerOptions, options.Providers, options.Profiles) + prClient, err := providers.New(&providerOptions, options.Providers, options.IDs) if err != nil { return nil, err } diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index 075285c..f4f809d 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -14,17 +14,17 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` DiscordWebHookUsername string `yaml:"discord_username,omitempty"` DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.Discord = append(provider.Discord, o) } } diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index 3132f98..9b59a69 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -33,13 +33,13 @@ type Client struct { options *Options } -func New(options *Options, providers, profiles []string) (*Client, error) { +func New(options *Options, providers, ids []string) (*Client, error) { client := &Client{options: options} if options.Slack != nil && (len(providers) == 0 || utils.Contains(providers, "slack")) { - provider, err := slack.New(options.Slack, profiles) + provider, err := slack.New(options.Slack, ids) if err != nil { return nil, errors.Wrap(err, "could not create slack provider client") } @@ -48,7 +48,7 @@ func New(options *Options, providers, profiles []string) (*Client, error) { } if options.Discord != nil && (len(providers) == 0 || utils.Contains(providers, "discord")) { - provider, err := discord.New(options.Discord, profiles) + provider, err := discord.New(options.Discord, ids) if err != nil { return nil, errors.Wrap(err, "could not create discord provider client") } @@ -56,7 +56,7 @@ func New(options *Options, providers, profiles []string) (*Client, error) { } if options.Pushover != nil && (len(providers) == 0 || utils.Contains(providers, "pushover")) { - provider, err := pushover.New(options.Pushover, profiles) + provider, err := pushover.New(options.Pushover, ids) if err != nil { return nil, errors.Wrap(err, "could not create pushover provider client") } @@ -64,7 +64,7 @@ func New(options *Options, providers, profiles []string) (*Client, error) { } if options.SMTP != nil && (len(providers) == 0 || utils.Contains(providers, "smtp")) { - provider, err := smtp.New(options.SMTP, profiles) + provider, err := smtp.New(options.SMTP, ids) if err != nil { return nil, errors.Wrap(err, "could not create smtp provider client") } @@ -72,7 +72,7 @@ func New(options *Options, providers, profiles []string) (*Client, error) { } if options.Teams != nil && (len(providers) == 0 || utils.Contains(providers, "teams")) { - provider, err := teams.New(options.Teams, profiles) + provider, err := teams.New(options.Teams, ids) if err != nil { return nil, errors.Wrap(err, "could not create teams provider client") } @@ -80,7 +80,7 @@ func New(options *Options, providers, profiles []string) (*Client, error) { } if options.Telegram != nil && (len(providers) == 0 || utils.Contains(providers, "telegram")) { - provider, err := telegram.New(options.Telegram, profiles) + provider, err := telegram.New(options.Telegram, ids) if err != nil { return nil, errors.Wrap(err, "could not create telegram provider client") } diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go index 85ca543..6d14bde 100644 --- a/pkg/providers/pushover/pushover.go +++ b/pkg/providers/pushover/pushover.go @@ -13,17 +13,17 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` PushoverApiToken string `yaml:"pushover_api_token,omitempty"` UserKey string `yaml:"pushover_user_key,omitempty"` PushoverDevices []string `yaml:"pushover_devices,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.Pushover = append(provider.Pushover, o) } } diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index 11a101e..eec6b72 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -13,17 +13,17 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` SlackUsername string `yaml:"slack_username,omitempty"` SlackChannel string `yaml:"slack_channel,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.Slack = append(provider.Slack, o) } } diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go index 01468bf..e0ef10e 100644 --- a/pkg/providers/smtp/smtp.go +++ b/pkg/providers/smtp/smtp.go @@ -13,7 +13,7 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` Server string `yaml:"smtp_server,omitempty"` Username string `yaml:"smtp_username,omitempty"` Password string `yaml:"smtp_password,omitempty"` @@ -21,11 +21,11 @@ type Options struct { SMTPCC []string `yaml:"smtp_cc,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.SMTP = append(provider.SMTP, o) } } diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go index a2d1e8a..2f13e5f 100644 --- a/pkg/providers/teams/teams.go +++ b/pkg/providers/teams/teams.go @@ -13,15 +13,15 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` TeamsWebHookURL string `yaml:"teams_webhook_url,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.Teams = append(provider.Teams, o) } } diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index 7d3cd8d..db4fd36 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -12,16 +12,16 @@ type Provider struct { } type Options struct { - Profile string `yaml:"profile,omitempty"` + ID string `yaml:"id,omitempty"` TelegramAPIKey string `yaml:"telegram_api_key,omitempty"` TelegramChatID string `yaml:"telegram_chat_id,omitempty"` } -func New(options []*Options, profiles []string) (*Provider, error) { +func New(options []*Options, ids []string) (*Provider, error) { provider := &Provider{} for _, o := range options { - if len(profiles) == 0 || utils.Contains(profiles, o.Profile) { + if len(ids) == 0 || utils.Contains(ids, o.ID) { provider.Telegram = append(provider.Telegram, o) } } diff --git a/pkg/types/types.go b/pkg/types/types.go index c4cb450..9f6a4e0 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -12,7 +12,7 @@ type Options struct { Interval int `yaml:"interval,omitempty"` ProviderConfig string `yaml:"provider_config,omitempty"` Providers goflags.StringSlice `yaml:"providers,omitempty"` - Profiles goflags.StringSlice `yaml:"profiles,omitempty"` + IDs goflags.StringSlice `yaml:"ids,omitempty"` HTTPMessage string `yaml:"http_message,omitempty"` DNSMessage string `yaml:"dns_message,omitempty"` From 71a86229d1d5f4cdfd7380e3a63b79c893b70413 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 30 Jul 2021 11:43:19 +0530 Subject: [PATCH 50/72] add flag usage message --- cmd/notify/notify.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index a4bb41a..289187e 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -64,8 +64,8 @@ func readConfig() { set.BoolVar(&options.Bulk, "bulk", false, "Read the input and send it in bulk, character limit can be set using char-limit flag") set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") - set.StringSliceVar(&options.Providers, "provider", []string{}, "") - set.StringSliceVar(&options.IDs, "id", []string{}, "") + set.StringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") + set.StringSliceVar(&options.IDs, "id", []string{}, "id to send the notification to (optional)") _ = set.Parse() From 65575023cfb39ce55bf3df30129319da93cba601 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Wed, 4 Aug 2021 16:11:54 +0530 Subject: [PATCH 51/72] add format message option --- cmd/notify/notify.go | 1 + internal/runner/runner.go | 8 ++---- pkg/providers/discord/discord.go | 7 ++++-- pkg/providers/providers.go | 40 ++++++++++++++++-------------- pkg/providers/pushover/pushover.go | 7 ++++-- pkg/providers/slack/slack.go | 7 +++--- pkg/providers/smtp/smtp.go | 7 ++++-- pkg/providers/teams/teams.go | 7 ++++-- pkg/providers/telegram/telegram.go | 7 ++++-- pkg/types/types.go | 9 ++++--- pkg/utils/utils.go | 20 +++++++++++++++ 11 files changed, 78 insertions(+), 42 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 289187e..e9721e0 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -66,6 +66,7 @@ func readConfig() { set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") set.StringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") set.StringSliceVar(&options.IDs, "id", []string{}, "id to send the notification to (optional)") + set.StringVar(&options.MessageFormat, "msg-format", "{{data}}", "apply custom formatting to the text") _ = set.Parse() diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d65bd05..a945793 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -34,7 +34,7 @@ func NewRunner(options *types.Options) (*Runner, error) { if err != nil { return nil, err } - var providerOptions providers.Options + var providerOptions providers.ProviderOptions if options.ProviderConfig == "" { home, err := os.UserHomeDir() @@ -57,7 +57,7 @@ func NewRunner(options *types.Options) (*Runner, error) { file.Close() - prClient, err := providers.New(&providerOptions, options.Providers, options.IDs) + prClient, err := providers.New(&providerOptions, options) if err != nil { return nil, err } @@ -203,10 +203,6 @@ func (r *Runner) Run() error { } func (r *Runner) sendMessage(msg string) error { - rr := strings.NewReplacer( - "{{data}}", msg, - ) - msg = rr.Replace(r.options.CLIMessage) if len(msg) > 0 { gologger.Print().Msgf(msg) err := r.providers.Send(msg) diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index f4f809d..86e0a1f 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -18,6 +18,7 @@ type Options struct { DiscordWebHookURL string `yaml:"discord_webhook_url,omitempty"` DiscordWebHookUsername string `yaml:"discord_username,omitempty"` DiscordWebHookAvatarURL string `yaml:"discord_avatar,omitempty"` + DiscordFormat string `yaml:"discord_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -31,9 +32,11 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Discord { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.DiscordFormat)) + discordTokens := strings.TrimPrefix(pr.DiscordWebHookURL, "https://discord.com/api/webhooks/") tokens := strings.Split(discordTokens, "/") if len(tokens) != 2 { @@ -41,7 +44,7 @@ func (p *Provider) Send(message string) error { } webhookID, token := tokens[0], tokens[1] url := fmt.Sprintf("discord://%s@%s", token, webhookID) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index 9b59a69..a19b7a2 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -10,11 +10,12 @@ import ( "github.com/projectdiscovery/notify/pkg/providers/smtp" "github.com/projectdiscovery/notify/pkg/providers/teams" "github.com/projectdiscovery/notify/pkg/providers/telegram" + "github.com/projectdiscovery/notify/pkg/types" "github.com/projectdiscovery/notify/pkg/utils" ) // Options is a configuration file for nuclei reporting module -type Options struct { +type ProviderOptions struct { Slack []*slack.Options `yaml:"slack,omitempty"` Discord []*discord.Options `yaml:"discord,omitempty"` Pushover []*pushover.Options `yaml:"pushover,omitempty"` @@ -25,62 +26,63 @@ type Options struct { // Provider is an interface implemented by providers type Provider interface { - Send(string) error + Send(message, CliFormat string) error } type Client struct { - providers []Provider - options *Options + providers []Provider + providerOptions *ProviderOptions + options *types.Options } -func New(options *Options, providers, ids []string) (*Client, error) { +func New(providerOptions *ProviderOptions, options *types.Options) (*Client, error) { - client := &Client{options: options} + client := &Client{providerOptions: providerOptions, options: options} - if options.Slack != nil && (len(providers) == 0 || utils.Contains(providers, "slack")) { + if providerOptions.Slack != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "slack")) { - provider, err := slack.New(options.Slack, ids) + provider, err := slack.New(providerOptions.Slack, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create slack provider client") } client.providers = append(client.providers, provider) } - if options.Discord != nil && (len(providers) == 0 || utils.Contains(providers, "discord")) { + if providerOptions.Discord != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "discord")) { - provider, err := discord.New(options.Discord, ids) + provider, err := discord.New(providerOptions.Discord, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create discord provider client") } client.providers = append(client.providers, provider) } - if options.Pushover != nil && (len(providers) == 0 || utils.Contains(providers, "pushover")) { + if providerOptions.Pushover != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "pushover")) { - provider, err := pushover.New(options.Pushover, ids) + provider, err := pushover.New(providerOptions.Pushover, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create pushover provider client") } client.providers = append(client.providers, provider) } - if options.SMTP != nil && (len(providers) == 0 || utils.Contains(providers, "smtp")) { + if providerOptions.SMTP != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "smtp")) { - provider, err := smtp.New(options.SMTP, ids) + provider, err := smtp.New(providerOptions.SMTP, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create smtp provider client") } client.providers = append(client.providers, provider) } - if options.Teams != nil && (len(providers) == 0 || utils.Contains(providers, "teams")) { + if providerOptions.Teams != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "teams")) { - provider, err := teams.New(options.Teams, ids) + provider, err := teams.New(providerOptions.Teams, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create teams provider client") } client.providers = append(client.providers, provider) } - if options.Telegram != nil && (len(providers) == 0 || utils.Contains(providers, "telegram")) { + if providerOptions.Telegram != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "telegram")) { - provider, err := telegram.New(options.Telegram, ids) + provider, err := telegram.New(providerOptions.Telegram, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create telegram provider client") } @@ -96,7 +98,7 @@ func (p *Client) Send(message string) error { message = stripansi.Strip(message) for _, v := range p.providers { - if err := v.Send(message); err != nil { + if err := v.Send(message, p.options.MessageFormat); err != nil { gologger.Error().Msgf("error while sending message: %s", err) } } diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go index 6d14bde..190592e 100644 --- a/pkg/providers/pushover/pushover.go +++ b/pkg/providers/pushover/pushover.go @@ -17,6 +17,7 @@ type Options struct { PushoverApiToken string `yaml:"pushover_api_token,omitempty"` UserKey string `yaml:"pushover_user_key,omitempty"` PushoverDevices []string `yaml:"pushover_devices,omitempty"` + PushoverFormat string `yaml:"pushover_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -31,11 +32,13 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Pushover { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.PushoverFormat)) + url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", pr.PushoverApiToken, pr.UserKey, strings.Join(pr.PushoverDevices, ",")) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index eec6b72..0340217 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -17,6 +17,7 @@ type Options struct { SlackWebHookURL string `yaml:"slack_webhook_url,omitempty"` SlackUsername string `yaml:"slack_username,omitempty"` SlackChannel string `yaml:"slack_channel,omitempty"` + SlackFormat string `yaml:"slack_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -31,13 +32,13 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { - +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Slack { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.SlackFormat)) slackTokens := strings.TrimPrefix(pr.SlackWebHookURL, "https://hooks.slack.com/services/") url := fmt.Sprintf("slack://%s", slackTokens) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go index e0ef10e..bc4f0c5 100644 --- a/pkg/providers/smtp/smtp.go +++ b/pkg/providers/smtp/smtp.go @@ -19,6 +19,7 @@ type Options struct { Password string `yaml:"smtp_password,omitempty"` FromAddress string `yaml:"from_address,omitempty"` SMTPCC []string `yaml:"smtp_cc,omitempty"` + SMTPFormat string `yaml:"smtp_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -33,11 +34,13 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.SMTP { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.SMTPFormat)) + url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", pr.Username, pr.Password, pr.Server, pr.FromAddress, strings.Join(pr.SMTPCC, ",")) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go index 2f13e5f..73fe050 100644 --- a/pkg/providers/teams/teams.go +++ b/pkg/providers/teams/teams.go @@ -15,6 +15,7 @@ type Provider struct { type Options struct { ID string `yaml:"id,omitempty"` TeamsWebHookURL string `yaml:"teams_webhook_url,omitempty"` + TeamsFormat string `yaml:"teams_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -29,13 +30,15 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Teams { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.TeamsFormat)) + teamsTokens := strings.TrimPrefix(pr.TeamsWebHookURL, "https://outlook.office.com/webhook/") teamsTokens = strings.ReplaceAll(teamsTokens, "IncomingWebhook/", "") url := fmt.Sprintf("teams://%s", teamsTokens) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index db4fd36..8770772 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -15,6 +15,7 @@ type Options struct { ID string `yaml:"id,omitempty"` TelegramAPIKey string `yaml:"telegram_api_key,omitempty"` TelegramChatID string `yaml:"telegram_chat_id,omitempty"` + TelegramFormat string `yaml:"telegram_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -29,11 +30,13 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Telegram { + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.TelegramFormat)) + url := fmt.Sprintf("telegram://%s@telegram?channels=%s", pr.TelegramAPIKey, pr.TelegramChatID) - err := shoutrrr.Send(url, message) + err := shoutrrr.Send(url, msg) if err != nil { return err } diff --git a/pkg/types/types.go b/pkg/types/types.go index 9f6a4e0..10fc7aa 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -14,10 +14,11 @@ type Options struct { Providers goflags.StringSlice `yaml:"providers,omitempty"` IDs goflags.StringSlice `yaml:"ids,omitempty"` - HTTPMessage string `yaml:"http_message,omitempty"` - DNSMessage string `yaml:"dns_message,omitempty"` - CLIMessage string `yaml:"cli_message,omitempty"` - SMTPMessage string `yaml:"smtp_message,omitempty"` + HTTPMessage string `yaml:"http_message,omitempty"` + DNSMessage string `yaml:"dns_message,omitempty"` + CLIMessage string `yaml:"cli_message,omitempty"` + SMTPMessage string `yaml:"smtp_message,omitempty"` + MessageFormat string `yaml:"message_format,omitempty"` Stdin bool Bulk bool `yaml:"bulk,omitempty"` diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index a7677d3..97e5737 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,5 +1,11 @@ package utils +import ( + "strings" +) + +const defaultFormat = "{{data}}" + func Contains(slice []string, item string) bool { set := make(map[string]struct{}, len(slice)) for _, s := range slice { @@ -8,4 +14,18 @@ func Contains(slice []string, item string) bool { _, ok := set[item] return ok + +} + +func FormatMessage(msg, format string) string { + return strings.Replace(format, defaultFormat, msg, -1) +} + +func SelectFormat(cliFormat, configFormat string) string { + if cliFormat != "" && cliFormat != defaultFormat { + return cliFormat + } else if configFormat != "" && configFormat != defaultFormat { + return configFormat + } + return defaultFormat } From 0eb3987bb8900c39d95a4b619063106d8e117e5c Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Wed, 4 Aug 2021 18:36:06 +0530 Subject: [PATCH 52/72] update README --- README.md | 220 ++++++++++---------------------------- cmd/notify/notify.go | 4 +- go.mod | 11 +- go.sum | 72 ------------- internal/runner/runner.go | 86 ++++++++------- 5 files changed, 102 insertions(+), 291 deletions(-) diff --git a/README.md b/README.md index 070b4b7..b733cfd 100644 --- a/README.md +++ b/README.md @@ -11,34 +11,18 @@ [![Follow on Twitter](https://img.shields.io/twitter/follow/pdiscoveryio.svg?logo=twitter)](https://twitter.com/pdiscoveryio) [![Chat on Discord](https://img.shields.io/discord/695645237418131507.svg?logo=discord)](https://discord.gg/KECAGdH) -Notify is an helper utility written in Go that allows you to pull results from burp collaborator instances and post to CLI, also sends the notification via webhooks to Slack and Discord. +Notify is an helper utility written in Go that allows you to pipe the output from various tools (or read from a file) and post the same to slack, discord, telegram etc (we call them providers) # Resources - [Resources](#resources) -- [Features](#features) - [Usage](#usage) - [Installation Instructions](#installation-instructions) - [From Binary](#from-binary) - - [From Source](#from-source) - - [From Github](#from-github) -- [Intercept BIID](#intercept-biid) -- [Config File](#config-file) + - [Using go CLI](#download-using-go-cli) + - [From Source](#build-from-source) - [Running notify](#running-notify) - - [CLI](#cli) - - [Slack notification](#slack-notification) - - [Discord notification](#discord-notification) - - [General purpose use](#using-notify-with-other-tools) - -# Features - -

- notify -
-

- -- 💥 Automatic Burp Collaborator BIID interception. -- 💥 Burp Collaborator Slack / Discord notification support. -- 💥 Redirect output of any tool to Slack / Discord / Telegram. + - [Provider config](#provider-config) + - [Example provider config](#example-provider-config) # Usage @@ -50,33 +34,21 @@ This will display help for the tool. Here are all the switches it supports. | Flag | Description | Example | |------|-------------|---------| -| -biid | burp private key | notify -biid 123456789 | -| -discord-avatar | Discord Avatar Url | notify -discord-avatar hxxp://a.b.c | -| -discord | Enable Discord | notify -discord | -| -discord-username | Discord Username | notify -discord-username test | -| -discord-webhook-url | Discord Webhook URL | notify -discord-webhook-url hxxp://a.b.c | -| -dns-message | DNS Message | notify -dns-message test | -| -http-message | HTTP Message | notify -http-message test | -| -intercept-biid | Attempt to intercept biid (needs sudo) | notify -intercept-biid | -| -intercept-biid-timeout | Timeout for biid interception in seconds | notify -intercept-biid-timeout 120 | -| -interval | Polling interval in seconds | notify -interval 5 | -| -silent | Silent mode | notify -silent | -| -slack-channel | Slack Channel | notify -slack-channel test | -| -slack | Enable Slack | notify -slack | -| -slack-username | Slack Username | notify -slack-username test | -| -slack-webhook-url | Slack Webhook URL | notify -slack-webhook-url hxxp://a.b.c | -| -telegram-api-key | Telegram Api Key | notify -telegram-api-key 119489xxxx-:AAF4OV9 | -| -telegram-chat-id | Telegram Chat ID | notify -telegram-chat-id 1231434| -| -telegram | Enable Telegram | notify -telegram | -| -version | Show version of notify | notify -version | +| -config string | Notify configuration file| notify -config config.yaml +| -silent | Don't print the banner| notify -silent +| -version | Show version of notify| notify -version +| -v | Show Verbose output| notify -v +| -no-color | Don't Use colors in output| notify -no-color +| -data string | File path to read data from| notify -data test.txt +| -bulk | Read the input and send it in bulk, character limit can be set using char-limit flag| notify -bulk +| -char-limit int | Character limit for message (default 4000)| notify -char-limit 2000 +| -provider-config string | provider config path (default: $HOME/.config/notify/provider-config.yaml)| notify -provider-config testproviderconfig.yaml +| -provider string[] | provider to send the notification to (optional)| notify -provider slack -provider telegram +| -profile string[] | profile to send the notification to (optional)| notify -profile recon # Installation Instructions -## Dependencies (libpcap) - -``sudo apt-get install libpcap-dev`` - ### From Binary The installation is easy. You can download the pre-built binaries for your platform from the [releases](https://github.com/projectdiscovery/notify/releases/) page. Extract them using tar, move it to your `$PATH`and you're ready to go. @@ -89,99 +61,28 @@ Download latest binary from https://github.com/projectdiscovery/notify/releases ▶ notify -version ``` -### From Source +### Download using go cli -Notify requires **go1.14+** to install successfully. Run the following command to get the repo - +Notify requires **go1.14+** to install successfully. Run the following command to download and install notify - -Installing Notify - ```sh ▶ GO111MODULE=on go get -v github.com/projectdiscovery/notify/cmd/notify ``` -Installing Intercept - -```sh -▶ GO111MODULE=on go get -v github.com/projectdiscovery/notify/cmd/intercept -``` - -### From Github - -Installing Notify - +### Build From Source ```sh ▶ git clone https://github.com/projectdiscovery/notify.git; cd notify/cmd/notify; go build; mv notify /usr/local/bin/; notify -version ``` -Installing Intercept - - -```sh -▶ git clone https://github.com/projectdiscovery/notify.git; cd notify/cmd/intercept; go build; mv intercept /usr/local/bin/; -``` - -# Intercept BIID - -- Run intercept `intercept` -- Open Burp Suite => Project Options => Misc -- Tick `Pull Over HTTP` -- Go to Options => Connections => Upstream Proxy Servers -- Add `localhost:8888` (or the custom intercept listening port) as upstream proxy -- Generate **new** collaborator, click on **Poll now**. -- Intercept will capture `biid` that can be used with `notify` - -```sh -sudo ./intercept -Attempting to intercept BIID -BIID found: o%2JREfoFxWfdk4i1VOvPQiX96MfpZ7qlZ6kXiGeHbjvJ%3d -``` # Running notify -## CLI - -You can use **notify** to receive burp collaborator interaction on your CLI, following command accepts `biid` as input and post all incoming interaction over CLI. - -```sh -notify -biid 132456789 -``` - -## Slack notification - -The tool accept parameters from a config file located at `$HOME/.config/notify/notify.conf` or either via CLI. - -To run the tool just use the following command. - -```sh -▶ notify -biid 132456789 -slack -slack-webhook-url https://a.b.c -slack-username test -slack-channel test-channel -``` - -If you already configured the config file, you can simply run following command and `notify` will start receiving burp collaborator interaction on CLI and sends notification to slack / discord. - -```sh -▶ notify -``` +Notify supports piping output of any tool and send it to configured provider/s (e.g, discord, slack channel) as notification. -## Discord notification - -Similarly to slack, in order to use discord: - -```sh -▶ notify -biid 132456789 -discord -discord-webhook-url https://a.b.c -discord-username notify-bot -``` - -## Telegram notification - -Similarly to slack, in order to use Telegram: - -```sh -▶ notify -biid 132456789 -telegram -telegram-api-key 119489xxxx-:AAF4OV9 -telegram-chat-id 1231434 -``` - -## Using notify with other tools - -Notify also supports piping output of any tool and send it over discord/slack channel as notification. - -Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe for alive URLs and sends the notifications of alive URLs using [httpx](https://github.com/projectdiscovery/httpx) to configured discord / slack channel. +Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe for alive URLs and sends the notifications of alive URLs using [httpx](https://github.com/projectdiscovery/httpx) to configured provider/s. ``` subfinder -d hackerone.com | httpx | notify @@ -192,7 +93,7 @@ subfinder -d hackerone.com | httpx | notify
-Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe alive URLs using [httpx](https://github.com/projectdiscovery/httpx), runs [Nuclei](https://github.com/projectdiscovery/nuclei) templates and send the nuclei results as a notifications to configured discord / slack channel. +Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe alive URLs using [httpx](https://github.com/projectdiscovery/httpx), runs [Nuclei](https://github.com/projectdiscovery/nuclei) templates and send the nuclei results as a notifications to configured provider/s. ``` @@ -201,55 +102,42 @@ subfinder -d intigriti.com | httpx | nuclei -t files | notify In similar manner, output (stdout) of any tool can be piped to **notify** for posting data into slack/discord. -# Config File -The default config file should be located in `$HOME/.config/notify/notify.conf` and has the following contents: -```yaml -burp_biid: 132465789 -# Slack -slack: true -slack_webhook_url: https://a.b.c -slack_username: test -slack_channel: test - -# Discord -discord: true -discord_webhook_url: https://a.b.c -discord_username: test -discord_avatar: https://a.b.c/avatar - -# Telegram -telegram: true -telegram_apikey: 119489xxxx-:AAF4OV9cdCEzq3tQ3aMtVyzHaRV3a1M7Ow4 -telegram_chat_id: 36808xxxx - -# General Settings -interval: 2 # seconds - -http_message: | - The collaborator server received an {{protocol}} request from {{from}} at {{time}}: - - ```http - {{request}} - - {{response}} - ``` - -dns_message: | - The collaborator server received a DNS lookup of type {{type}} for the domain name {{domain}} from {{from}} at {{time}}: - - ``` - {{request}} - ``` -``` +# Provider config + + +The tool tries to use the default provider config (`$HOME/.config/notify/provider-config.yaml`), it can also be specified via CLI by running. +To run the tool just use the following command. + +```sh +▶ notify -provider-config path/to/testproviderconfig.yaml +``` -📋 Notes +## Example provider config +The default provider config file can be created at `$HOME/.config/notify/provider-config.yal` and can have the following contents: + +```yaml +slack: + - id: "recon" + slack_channel: "test" + slack_username: "test" + slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" + - id: "test" + slack_channel: "test" + slack_username: "test" + slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" +discord: + - id: "test" + discord_channel: "test" + discord_username: "Sajad" + discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" +telegram: + - id: "recon" + telegram_api_key: "XXXXXXXXXXXX" + telegram_chat_id: "XXXXXXXX" +``` -- You can obtain the **biid** with wireshark on any platform and configure it within the config file. -- Burp collaborator server allow to fetch results only for once, so if you are using this, you will **not** see results in burp collaborator window. -- Config file has priority over CLI arguments. -- Telegram notification does not support burp collaborator. ## References:- diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 4f26555..174085e 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -58,8 +58,8 @@ func readConfig() { set.BoolVar(&options.Bulk, "bulk", false, "Read the input and send it in bulk, character limit can be set using char-limit flag") set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") - set.StringSliceVar(&options.Providers, "provider", []string{}, "") - set.StringSliceVar(&options.Profiles, "profile", []string{}, "") + set.StringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") + set.StringSliceVar(&options.Profiles, "profile", []string{}, "profile to send the notification to (optional)") _ = set.Parse() diff --git a/go.mod b/go.mod index 092677f..bd019df 100644 --- a/go.mod +++ b/go.mod @@ -5,24 +5,21 @@ go 1.15 require ( github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/containrrr/shoutrrr v0.4.4 - github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/fatih/color v1.12.0 // indirect + github.com/golang/protobuf v1.4.3 // indirect + github.com/google/go-cmp v0.5.4 // indirect github.com/google/uuid v1.2.0 // indirect github.com/json-iterator/go v1.1.11 // indirect github.com/klauspost/compress v1.13.1 // indirect github.com/mattn/go-isatty v0.0.13 // indirect - github.com/miekg/dns v1.1.43 // indirect github.com/onsi/ginkgo v1.16.4 // indirect + github.com/onsi/gomega v1.10.5 // indirect github.com/pkg/errors v0.9.1 - github.com/projectdiscovery/collaborator v0.0.2 - github.com/projectdiscovery/fastdialer v0.0.8 // indirect github.com/projectdiscovery/goflags v0.0.5 github.com/projectdiscovery/gologger v1.1.4 - github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 - github.com/projectdiscovery/retryabledns v1.0.10 // indirect - github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 // indirect golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect + google.golang.org/protobuf v1.25.0 // indirect gopkg.in/yaml.v2 v2.4.0 nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/go.sum b/go.sum index c3482e1..d6324f9 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.0+incompatible h1:7o6+MAPhYTCF0+fdvoz1xDedhRb4f6s9Tn1Tt7/WTEg= -github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= @@ -38,14 +36,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= -github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e h1:/cwV7t2xezilMljIftb7WlFtzGANRCnoOhPjtl2ifcs= -github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= -github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= -github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e h1:CQn2/8fi3kmpT9BTiHEELgdxAOQNVZc9GoPA4qnQzrs= -github.com/elazarl/goproxy/ext v0.0.0-20210110162100-a92cc753f88e/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -101,9 +92,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -114,7 +102,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190908185732-236ed259b199/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -128,8 +115,6 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -161,7 +146,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -182,11 +166,6 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.38/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= -github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -203,11 +182,9 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -223,33 +200,10 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/collaborator v0.0.2 h1:BSiMlWM3NvuKbpedn6fIjjEo5b7q5zmiJ6tI7+6mB3s= -github.com/projectdiscovery/collaborator v0.0.2/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20= -github.com/projectdiscovery/dsl v0.0.2 h1:7UysmR2d9CUbmNta8OFYA990FBlc/G7P6s7oNZL/kn4= -github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCtNA9C6bH80WOo= -github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= -github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= -github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= github.com/projectdiscovery/goflags v0.0.5 h1:jI6HD9Z7vkg4C4Cz16BfZKICnIf94W3KFU5M3DcUgUk= github.com/projectdiscovery/goflags v0.0.5/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= -github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= -github.com/projectdiscovery/hmap v0.0.1 h1:VAONbJw5jP+syI5smhsfkrq9XPGn4aiYy5pR6KR1wog= -github.com/projectdiscovery/hmap v0.0.1/go.mod h1:VDEfgzkKQdq7iGTKz8Ooul0NuYHQ8qiDs6r8bPD1Sb0= -github.com/projectdiscovery/mapsutil v0.0.1 h1:hXIQUPvU+5HtPzzyaLvsPg4R/39N77CCAL0ezYhFdgw= -github.com/projectdiscovery/mapsutil v0.0.1/go.mod h1:Q49P7sQzz9m+dWgdx/ryNwOfsClt8ZmHhF4WdXTheyE= -github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 h1:kVGWhu6pisPOTpDi9T/wBNF//BL3quenLv9oS1CXfQ4= -github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06/go.mod h1:KD3L4uNgvAXHS6JywunTPhiyVGBqLljweugPAPRNj3s= -github.com/projectdiscovery/retryabledns v1.0.6/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -github.com/projectdiscovery/retryabledns v1.0.7/go.mod h1:/UzJn4I+cPdQl6pKiiQfvVAT636YZvJQYZhYhGB0dUQ= -github.com/projectdiscovery/retryabledns v1.0.10 h1:xJZ2aKoqrNg/OZEw1+4+QIOH40V/WkZDYY1ZZc+uphE= -github.com/projectdiscovery/retryabledns v1.0.10/go.mod h1:4sMC8HZyF01HXukRleSQYwz4870bwgb4+hTSXTMrkf4= -github.com/projectdiscovery/retryablehttp-go v1.0.1/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= -github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 h1:CJHP3CLCc/eqdXQEvZy8KiiqtAk9kEsd1URtPyPAQ1s= -github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727/go.mod h1:dx//aY9V247qHdsRf0vdWHTBZuBQ2vm6Dq5dagxrDYI= -github.com/projectdiscovery/tinydns v0.0.1 h1:Ls5TAlMJoCfEObpsC7S+Hg4WLyF5wiN+O1xNgEIjnEc= -github.com/projectdiscovery/tinydns v0.0.1/go.mod h1:xPZcaMje/MWozKc5Sdln3XWptINYoWqCBXgLeSrNB1Q= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -261,9 +215,6 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= -github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -273,8 +224,6 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -296,8 +245,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -318,14 +265,11 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -339,13 +283,9 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -356,9 +296,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -373,10 +310,8 @@ golang.org/x/sys v0.0.0-20190618155005-516e3c20635f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190927073244-c990c680b611/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -386,18 +321,13 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210217105451-b926d437f341/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -411,8 +341,6 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/runner/runner.go b/internal/runner/runner.go index fa18ee8..3d435b7 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -55,62 +55,60 @@ func NewRunner(options *types.Options) (*Runner, error) { // Run polling and notification func (r *Runner) Run() error { - // If stdin/file input is present pass everything to webhooks and exit - if hasStdin() || r.options.Data != "" { - var inFile *os.File - var err error - - switch { - case hasStdin(): - inFile = os.Stdin - - case r.options.Data != "": - inFile, err = os.Open(r.options.Data) - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - } - } - - if r.options.Bulk { - fi, err := inFile.Stat() - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - } + var inFile *os.File + var err error - msgB := make([]byte, fi.Size()) + switch { + case hasStdin(): + inFile = os.Stdin - n, err := inFile.Read(msgB) - if err != nil || n == 0 { - gologger.Fatal().Msgf("%s\n", err) - } + case r.options.Data != "": + inFile, err = os.Open(r.options.Data) + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } + default: + return errors.New("notify works with stdin or file using -data flag") + } - // char limit to search for a split - searchLimit := 250 - if r.options.CharLimit < searchLimit { - searchLimit = r.options.CharLimit - } + if r.options.Bulk { + fi, err := inFile.Stat() + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } - items := SplitText(string(msgB), r.options.CharLimit, searchLimit) + msgB := make([]byte, fi.Size()) - for _, v := range items { - if err := r.sendMessage(v); err != nil { - gologger.Fatal().Msgf("%s\n", err) - } - } + n, err := inFile.Read(msgB) + if err != nil || n == 0 { + gologger.Fatal().Msgf("%s\n", err) + } - os.Exit(0) + // char limit to search for a split + searchLimit := 250 + if r.options.CharLimit < searchLimit { + searchLimit = r.options.CharLimit } - br := bufio.NewScanner(inFile) - for br.Scan() { - msg := br.Text() - //nolint:errcheck - r.sendMessage(msg) + items := SplitText(string(msgB), r.options.CharLimit, searchLimit) + for _, v := range items { + if err := r.sendMessage(v); err != nil { + gologger.Fatal().Msgf("%s\n", err) + } } + os.Exit(0) } - return errors.New("notify works with stdin or file using -data flag") + + br := bufio.NewScanner(inFile) + for br.Scan() { + msg := br.Text() + //nolint:errcheck + r.sendMessage(msg) + + } + return nil } func (r *Runner) sendMessage(msg string) error { From 7af7ef9d881c315b9b6d94736cdb5aacfc13f2c5 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Wed, 4 Aug 2021 18:39:02 +0530 Subject: [PATCH 53/72] update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b733cfd..82e8e40 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ This will display help for the tool. Here are all the switches it supports. | -char-limit int | Character limit for message (default 4000)| notify -char-limit 2000 | -provider-config string | provider config path (default: $HOME/.config/notify/provider-config.yaml)| notify -provider-config testproviderconfig.yaml | -provider string[] | provider to send the notification to (optional)| notify -provider slack -provider telegram -| -profile string[] | profile to send the notification to (optional)| notify -profile recon +| -id string[] | id to send the notification to (optional)| notify -id recon # Installation Instructions @@ -130,7 +130,7 @@ slack: discord: - id: "test" discord_channel: "test" - discord_username: "Sajad" + discord_username: "test" discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" telegram: - id: "recon" From 4a1b07e57d00cccd79b9df6c141bdf5be1b49a5b Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 5 Aug 2021 17:50:21 +0530 Subject: [PATCH 54/72] add slack threaded message logic to use ts value from first message --- go.mod | 6 +-- go.sum | 4 +- pkg/providers/slack/slack.go | 35 ++++++++++++------ pkg/providers/slack/slack_api.go | 59 ++++++++++++++++++++++++++++++ pkg/providers/slack/slack_types.go | 13 +++++++ 5 files changed, 101 insertions(+), 16 deletions(-) create mode 100644 pkg/providers/slack/slack_api.go create mode 100644 pkg/providers/slack/slack_types.go diff --git a/go.mod b/go.mod index 7510c48..1db0514 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e github.com/fatih/color v1.12.0 // indirect github.com/google/uuid v1.2.0 // indirect - github.com/json-iterator/go v1.1.11 // indirect + github.com/json-iterator/go v1.1.11 github.com/klauspost/compress v1.13.1 // indirect github.com/mattn/go-isatty v0.0.13 // indirect github.com/miekg/dns v1.1.43 // indirect @@ -16,11 +16,11 @@ require ( github.com/pkg/errors v0.9.1 github.com/projectdiscovery/collaborator v0.0.2 github.com/projectdiscovery/fastdialer v0.0.8 // indirect - github.com/projectdiscovery/goflags v0.0.5 + github.com/projectdiscovery/goflags v0.0.6 github.com/projectdiscovery/gologger v1.1.4 github.com/projectdiscovery/proxify v0.0.4-0.20210217225554-5384e02d9d06 github.com/projectdiscovery/retryabledns v1.0.10 // indirect - github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 // indirect + github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index f4cd833..c049462 100644 --- a/go.sum +++ b/go.sum @@ -230,8 +230,8 @@ github.com/projectdiscovery/dsl v0.0.2/go.mod h1:LMhpgZjWJ8NfZokFhzyu1blLWhUutCt github.com/projectdiscovery/fastdialer v0.0.5/go.mod h1:m20Ls/JratRO8wSSpvOMIKu4aFDh9c5zwCH8+5JO0nA= github.com/projectdiscovery/fastdialer v0.0.8 h1:mEMc8bfXV5hc1PUEkJiUnR5imYQe6+839Zezd5jLkc0= github.com/projectdiscovery/fastdialer v0.0.8/go.mod h1:AuaV0dzrNeBLHqjNnzpFSnTXnHGIZAlGQE+WUMmSIW4= -github.com/projectdiscovery/goflags v0.0.5 h1:jI6HD9Z7vkg4C4Cz16BfZKICnIf94W3KFU5M3DcUgUk= -github.com/projectdiscovery/goflags v0.0.5/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/goflags v0.0.6 h1:4ErduTfSC55cRR3TmUg+TQirBlCuBdBadrluAsy1pew= +github.com/projectdiscovery/goflags v0.0.6/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= github.com/projectdiscovery/gologger v1.1.3/go.mod h1:jdXflz3TLB8bcVNzb0v26TztI9KPz8Lr4BVdUhNUs6E= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index 45d25e2..a9f9644 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -1,6 +1,7 @@ package slack import ( + "errors" "fmt" "net/url" "strings" @@ -19,6 +20,8 @@ type Options struct { SlackUsername string `yaml:"slack_username,omitempty"` SlackChannel string `yaml:"slack_channel,omitempty"` SlackThreadTS string `yaml:"slack_thread_ts,omitempty"` + SlackThreads bool `yaml:"slack_threads,omitempty"` + SlackToken string `yaml:"slack_token,omitempty"` } func New(options []*Options, profiles []string) (*Provider, error) { @@ -37,19 +40,29 @@ func (p *Provider) Send(message string) error { for _, pr := range p.Slack { - slackTokens := strings.TrimPrefix(pr.SlackWebHookURL, "https://hooks.slack.com/services/") - url := &url.URL{ - Scheme: "slack", - Path: slackTokens, - } + if pr.SlackThreads { + if pr.SlackToken == "" { + return errors.New("can't start a slack thread without slack_token value in provider config") + } + if pr.SlackChannel == "" { + return errors.New("can't start a slack thread without slack_channel value in provider config") + } + return pr.SendThreaded(message) + } else { + slackTokens := strings.TrimPrefix(pr.SlackWebHookURL, "https://hooks.slack.com/services/") + url := &url.URL{ + Scheme: "slack", + Path: slackTokens, + } - if pr.SlackThreadTS != "" { - url.RawQuery = fmt.Sprintf("thread_ts=%s", pr.SlackThreadTS) - } + if pr.SlackThreadTS != "" && pr.SlackThreads { + url.RawQuery = fmt.Sprintf("thread_ts=%s", pr.SlackThreadTS) + } - err := shoutrrr.Send(url.String(), message) - if err != nil { - return err + err := shoutrrr.Send(url.String(), message) + if err != nil { + return err + } } } return nil diff --git a/pkg/providers/slack/slack_api.go b/pkg/providers/slack/slack_api.go new file mode 100644 index 0000000..f8ccde5 --- /dev/null +++ b/pkg/providers/slack/slack_api.go @@ -0,0 +1,59 @@ +package slack + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + + jsoniter "github.com/json-iterator/go" + "github.com/projectdiscovery/retryablehttp-go" +) + +const SlackPostMessageAPI = "https://slack.com/api/chat.postMessage" + +func (options *Options) SendThreaded(message string) error { + + payload := APIRequest{ + Channel: options.SlackChannel, + Text: message, + TS: options.SlackThreadTS, + } + + reqBody, err := json.Marshal(payload) + if err != nil { + return fmt.Errorf("error while sending slack message: %s ", err) + } + + r, err := retryablehttp.NewRequest(http.MethodPost, SlackPostMessageAPI, bytes.NewReader(reqBody)) + if err != nil { + return err + } + + r.Header.Set("Authorization", "Bearer "+options.SlackToken) + r.Header.Set("Content-Type", "application/json") + + client := retryablehttp.NewClient(retryablehttp.DefaultOptionsSingle) + res, err := client.Do(r) + if err != nil { + return fmt.Errorf("error while sending slack message: %s ", err) + } + + if res.StatusCode != http.StatusOK { + return fmt.Errorf("error while sending slack message: %s ", fmt.Errorf("request failed with status code %d ", res.StatusCode)) + } + + var response APIResponse + if err = jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { + return fmt.Errorf("error trying to unmarshal the response: %v", err) + } + + if !response.Ok { + return fmt.Errorf("error while sending slack message: %s ", response.Error) + } + + if options.SlackThreadTS == "" { + options.SlackThreadTS = response.TS + } + return nil +} diff --git a/pkg/providers/slack/slack_types.go b/pkg/providers/slack/slack_types.go new file mode 100644 index 0000000..7231c9a --- /dev/null +++ b/pkg/providers/slack/slack_types.go @@ -0,0 +1,13 @@ +package slack + +type APIRequest struct { + Channel string `json:"channel,omitempty"` + Text string `json:"text,omitempty"` + TS string `json:"thread_ts,omitempty"` +} + +type APIResponse struct { + Ok bool `json:"ok,omitempty"` + TS string `json:"ts,omitempty"` + Error string `json:"error,omitempty"` +} From b57aec63a3073c397ebed7444a6fa5852169eb32 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 5 Aug 2021 18:14:01 +0530 Subject: [PATCH 55/72] slack: remove thread_ts from shoutrrr --- pkg/providers/slack/slack.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index a9f9644..d4a823a 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -2,7 +2,6 @@ package slack import ( "errors" - "fmt" "net/url" "strings" @@ -55,10 +54,6 @@ func (p *Provider) Send(message string) error { Path: slackTokens, } - if pr.SlackThreadTS != "" && pr.SlackThreads { - url.RawQuery = fmt.Sprintf("thread_ts=%s", pr.SlackThreadTS) - } - err := shoutrrr.Send(url.String(), message) if err != nil { return err From 02492cf6ca1e9e5b717f09ab41c9db1f95ea540a Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 5 Aug 2021 21:08:15 +0530 Subject: [PATCH 56/72] add http proxy support --- cmd/notify/notify.go | 1 + internal/runner/runner.go | 17 +++++++++++ pkg/types/types.go | 1 + pkg/utils/httpreq/httpreq.go | 57 ++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 pkg/utils/httpreq/httpreq.go diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index 289187e..332c426 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -66,6 +66,7 @@ func readConfig() { set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") set.StringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") set.StringSliceVar(&options.IDs, "id", []string{}, "id to send the notification to (optional)") + set.StringVar(&options.Proxy, "proxy", "", "Set http proxy to be used by notify") _ = set.Parse() diff --git a/internal/runner/runner.go b/internal/runner/runner.go index d65bd05..eda14c6 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -2,7 +2,10 @@ package runner import ( "bufio" + "crypto/tls" "fmt" + "net/http" + "net/url" "os" "path" "strconv" @@ -68,6 +71,20 @@ func NewRunner(options *types.Options) (*Runner, error) { // Run polling and notification func (r *Runner) Run() error { + if r.options.Proxy != "" { + proxyurl, err := url.Parse(r.options.Proxy) + if err != nil || proxyurl == nil { + gologger.Warning().Msgf("supplied proxy '%s' is not valid", r.options.Proxy) + } else { + http.DefaultClient.Transport = &http.Transport{ + Proxy: http.ProxyURL(proxyurl), + ForceAttemptHTTP2: true, + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + }, + } + } + } // If stdin/file input is present pass everything to webhooks and exit if hasStdin() || r.options.Data != "" { var inFile *os.File diff --git a/pkg/types/types.go b/pkg/types/types.go index 9f6a4e0..2f15e77 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -13,6 +13,7 @@ type Options struct { ProviderConfig string `yaml:"provider_config,omitempty"` Providers goflags.StringSlice `yaml:"providers,omitempty"` IDs goflags.StringSlice `yaml:"ids,omitempty"` + Proxy string `yaml:"proxy,omitempty"` HTTPMessage string `yaml:"http_message,omitempty"` DNSMessage string `yaml:"dns_message,omitempty"` diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go new file mode 100644 index 0000000..59067b4 --- /dev/null +++ b/pkg/utils/httpreq/httpreq.go @@ -0,0 +1,57 @@ +package httpreq + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + + jsoniter "github.com/json-iterator/go" +) + +type Client struct { + httpClient *http.Client +} + +func NewClient() *Client { + return &Client{ + httpClient: http.DefaultClient, + } +} + +func (c *Client) Get(url string, response interface{}) error { + res, err := c.httpClient.Get(url) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + if err := jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { + return fmt.Errorf("error trying to unmarshal the response: %v", err) + } + return nil +} + +func (c *Client) Post(url string, request interface{}, headers http.Header, response interface{}) error { + body, err := json.Marshal(request) + if err != nil { + return fmt.Errorf("error creating payload: %v", err) + } + + req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(body)) + if err != nil { + return fmt.Errorf("error creating request: %v", err) + } + + for key, val := range headers { + req.Header.Set(key, val[0]) + } + + res, err := c.httpClient.Do(req) + if err != nil { + return fmt.Errorf("error sending payload: %v", err) + } + + if err = jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { + return fmt.Errorf("error trying to unmarshal the response: %v", err) + } + return nil +} From 56c0bdde60ffe2c42653d03ebb76e676c6325cd3 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 6 Aug 2021 13:05:49 +0530 Subject: [PATCH 57/72] disable shoutrrr splitlines for discord --- pkg/providers/discord/discord.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index 86e0a1f..5b2dc3c 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -43,7 +43,7 @@ func (p *Provider) Send(message, CliFormat string) error { return errors.New("Wrong discord configuration") } webhookID, token := tokens[0], tokens[1] - url := fmt.Sprintf("discord://%s@%s", token, webhookID) + url := fmt.Sprintf("discord://%s@%s?splitlines=no", token, webhookID) err := shoutrrr.Send(url, msg) if err != nil { return err From b92728048b1d6e3a9219822db81a2c4a71fe1876 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Sat, 7 Aug 2021 07:53:56 +0530 Subject: [PATCH 58/72] resolve merge conflicts --- pkg/types/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/types/types.go b/pkg/types/types.go index a2333b7..c44eddb 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -11,6 +11,8 @@ type Options struct { Providers goflags.StringSlice `yaml:"providers,omitempty"` IDs goflags.StringSlice `yaml:"ids,omitempty"` + MessageFormat string `yaml:"message_format,omitempty"` + Stdin bool Bulk bool `yaml:"bulk,omitempty"` CharLimit int `yaml:"char_limit,omitempty"` From ba22e2828afc4b99017bf4b3d789d4f310e89e49 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 13 Aug 2021 13:24:29 +0530 Subject: [PATCH 59/72] change CustomBody to CustomFormat --- pkg/providers/custom/custom.go | 15 ++++++--------- pkg/providers/providers.go | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pkg/providers/custom/custom.go b/pkg/providers/custom/custom.go index 43544da..b3c9aac 100644 --- a/pkg/providers/custom/custom.go +++ b/pkg/providers/custom/custom.go @@ -2,7 +2,6 @@ package custom import ( "bytes" - "strings" "github.com/projectdiscovery/notify/pkg/utils" "github.com/projectdiscovery/retryablehttp-go" @@ -13,11 +12,11 @@ type Provider struct { } type Options struct { - ID string `yaml:"id,omitempty"` + ID string `yaml:"id,omitempty"` CustomWebhookURL string `yaml:"custom_webook_url,omitempty"` CustomMethod string `yaml:"custom_method,omitempty"` CustomHeaders map[string]string `yaml:"custom_headers,omitempty"` - CustomBody string `yaml:"custom_body,omitempty"` + CustomFormat string `yaml:"custom_format,omitempty"` } func New(options []*Options, ids []string) (*Provider, error) { @@ -32,16 +31,14 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } -func (p *Provider) Send(message string) error { +func (p *Provider) Send(message, CliFormat string) error { for _, pr := range p.Custom { - rr := strings.NewReplacer( - "{{data}}", message, - ) - final := rr.Replace(pr.CustomBody) + msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.CustomFormat)) + body := bytes.NewBufferString(msg) - r, err := retryablehttp.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, bytes.NewReader([]byte(final))) + r, err := retryablehttp.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, body) if err != nil { return err } diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index ee40d41..c547b2c 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -91,9 +91,9 @@ func New(providerOptions *ProviderOptions, options *types.Options) (*Client, err client.providers = append(client.providers, provider) } - if options.Custom != nil && (len(providers) == 0 || utils.Contains(providers, "custom")) { + if providerOptions.Custom != nil && (len(options.Providers) == 0 || utils.Contains(options.Providers, "custom")) { - provider, err := custom.New(options.Custom, ids) + provider, err := custom.New(providerOptions.Custom, options.IDs) if err != nil { return nil, errors.Wrap(err, "could not create custom provider client") } From 228e3d4a103e0abdd50b96c89228bcf00b70ceea Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 20 Aug 2021 12:02:54 +0530 Subject: [PATCH 60/72] fix error handling, multi instance issue #70 --- cmd/notify/notify.go | 4 ++-- go.mod | 6 +++--- go.sum | 11 ++++++----- pkg/providers/custom/custom.go | 18 +++++++++++------- pkg/providers/discord/discord.go | 13 ++++++++----- pkg/providers/providers.go | 2 +- pkg/providers/pushover/pushover.go | 8 +++++--- pkg/providers/slack/slack.go | 7 +++++-- pkg/providers/smtp/smtp.go | 9 ++++++--- pkg/providers/teams/teams.go | 9 ++++++--- pkg/providers/telegram/telegram.go | 8 +++++--- pkg/types/types.go | 4 ++-- pkg/utils/httpreq/httpreq.go | 4 ++++ 13 files changed, 64 insertions(+), 39 deletions(-) diff --git a/cmd/notify/notify.go b/cmd/notify/notify.go index c78775a..106c509 100644 --- a/cmd/notify/notify.go +++ b/cmd/notify/notify.go @@ -58,8 +58,8 @@ func readConfig() { set.BoolVar(&options.Bulk, "bulk", false, "Read the input and send it in bulk, character limit can be set using char-limit flag") set.IntVar(&options.CharLimit, "char-limit", 4000, "Character limit for message") set.StringVar(&options.ProviderConfig, "provider-config", "", "provider config path (default: $HOME/.config/notify/provider-config.yaml)") - set.StringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") - set.StringSliceVar(&options.IDs, "id", []string{}, "id to send the notification to (optional)") + set.NormalizedStringSliceVar(&options.Providers, "provider", []string{}, "provider to send the notification to (optional)") + set.NormalizedStringSliceVar(&options.IDs, "id", []string{}, "id to send the notification to (optional)") set.StringVar(&options.MessageFormat, "msg-format", "{{data}}", "apply custom formatting to the text") set.StringVar(&options.Proxy, "proxy", "", "Set http proxy to be used by notify") diff --git a/go.mod b/go.mod index aca5914..ef7378d 100644 --- a/go.mod +++ b/go.mod @@ -9,15 +9,15 @@ require ( github.com/golang/protobuf v1.4.3 // indirect github.com/google/go-cmp v0.5.4 // indirect github.com/google/uuid v1.2.0 // indirect - github.com/json-iterator/go v1.1.11 // indirect + github.com/json-iterator/go v1.1.11 github.com/klauspost/compress v1.13.1 // indirect github.com/mattn/go-isatty v0.0.13 // indirect github.com/onsi/ginkgo v1.16.4 // indirect github.com/onsi/gomega v1.10.5 // indirect github.com/pkg/errors v0.9.1 - github.com/projectdiscovery/goflags v0.0.5 + github.com/projectdiscovery/goflags v0.0.7 github.com/projectdiscovery/gologger v1.1.4 - github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 + go.uber.org/multierr v1.1.0 golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect google.golang.org/protobuf v1.25.0 // indirect diff --git a/go.sum b/go.sum index 651ddfb..9fc7975 100644 --- a/go.sum +++ b/go.sum @@ -200,12 +200,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/projectdiscovery/goflags v0.0.5 h1:jI6HD9Z7vkg4C4Cz16BfZKICnIf94W3KFU5M3DcUgUk= -github.com/projectdiscovery/goflags v0.0.5/go.mod h1:Ae1mJ5MIIqjys0lFe3GiMZ10Z8VLaxkYJ1ySA4Zv8HA= +github.com/projectdiscovery/goflags v0.0.7 h1:aykmRkrOgDyRwcvGrK3qp+9aqcjGfAMs/+LtRmtyxwk= +github.com/projectdiscovery/goflags v0.0.7/go.mod h1:Jjwsf4eEBPXDSQI2Y+6fd3dBumJv/J1U0nmpM+hy2YY= github.com/projectdiscovery/gologger v1.1.4 h1:qWxGUq7ukHWT849uGPkagPKF3yBPYAsTtMKunQ8O2VI= github.com/projectdiscovery/gologger v1.1.4/go.mod h1:Bhb6Bdx2PV1nMaFLoXNBmHIU85iROS9y1tBuv7T5pMY= -github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727 h1:CJHP3CLCc/eqdXQEvZy8KiiqtAk9kEsd1URtPyPAQ1s= -github.com/projectdiscovery/retryablehttp-go v1.0.2-0.20210524224054-9fbe1f2b0727/go.mod h1:dx//aY9V247qHdsRf0vdWHTBZuBQ2vm6Dq5dagxrDYI= +github.com/projectdiscovery/stringsutil v0.0.0-20210804142656-fd3c28dbaafe h1:tQTgf5XLBgZbkJDPtnV3SfdP9tzz5ZWeDBwv8WhnH9Q= +github.com/projectdiscovery/stringsutil v0.0.0-20210804142656-fd3c28dbaafe/go.mod h1:oTRc18WBv9t6BpaN9XBY+QmG28PUpsyDzRht56Qf49I= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -259,7 +259,9 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16/go.mod h1:iKV5yK9t+J5nG9O3uF6KYdPEz3dyfMyB15MN1rbQ8Qw= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180426230345-b49d69b5da94/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -288,7 +290,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= diff --git a/pkg/providers/custom/custom.go b/pkg/providers/custom/custom.go index b3c9aac..857fe22 100644 --- a/pkg/providers/custom/custom.go +++ b/pkg/providers/custom/custom.go @@ -2,9 +2,12 @@ package custom import ( "bytes" + "net/http" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" - "github.com/projectdiscovery/retryablehttp-go" + "github.com/projectdiscovery/notify/pkg/utils/httpreq" + "go.uber.org/multierr" ) type Provider struct { @@ -32,26 +35,27 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { + var CustomErr error for _, pr := range p.Custom { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.CustomFormat)) body := bytes.NewBufferString(msg) - r, err := retryablehttp.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, body) + r, err := http.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, body) if err != nil { - return err + CustomErr = multierr.Append(CustomErr, errors.Wrap(err, "error sending custom")) + continue } for k, v := range pr.CustomHeaders { r.Header.Set(k, v) } - client := retryablehttp.NewClient(retryablehttp.DefaultOptionsSingle) - _, err = client.Do(r) + _, err = httpreq.NewClient().Do(r) if err != nil { - return err + CustomErr = multierr.Append(CustomErr, errors.Wrap(err, "error sending custom")) } } - return nil + return CustomErr } diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index 5b2dc3c..4149813 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -1,12 +1,13 @@ package discord import ( - "errors" "fmt" "strings" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" ) type Provider struct { @@ -33,21 +34,23 @@ func New(options []*Options, ids []string) (*Provider, error) { return provider, nil } func (p *Provider) Send(message, CliFormat string) error { + var DiscordErr error for _, pr := range p.Discord { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.DiscordFormat)) discordTokens := strings.TrimPrefix(pr.DiscordWebHookURL, "https://discord.com/api/webhooks/") tokens := strings.Split(discordTokens, "/") - if len(tokens) != 2 { - return errors.New("Wrong discord configuration") + if len(tokens) < 2 { + DiscordErr = multierr.Append(DiscordErr, errors.Wrap(errors.New("wrong discord configuration"), "error sending discord")) + continue } webhookID, token := tokens[0], tokens[1] url := fmt.Sprintf("discord://%s@%s?splitlines=no", token, webhookID) err := shoutrrr.Send(url, msg) if err != nil { - return err + DiscordErr = multierr.Append(DiscordErr, errors.Wrap(err, "error sending discord")) } } - return nil + return DiscordErr } diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index c547b2c..9862128 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -110,7 +110,7 @@ func (p *Client) Send(message string) error { for _, v := range p.providers { if err := v.Send(message, p.options.MessageFormat); err != nil { - gologger.Error().Msgf("error while sending message: %s", err) + gologger.Error().Msgf("%s", err) } } diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go index 190592e..09baff0 100644 --- a/pkg/providers/pushover/pushover.go +++ b/pkg/providers/pushover/pushover.go @@ -6,6 +6,8 @@ import ( "github.com/containrrr/shoutrrr" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" + "github.com/pkg/errors" ) type Provider struct { @@ -33,15 +35,15 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { - + var PushoverErr error for _, pr := range p.Pushover { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.PushoverFormat)) url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", pr.PushoverApiToken, pr.UserKey, strings.Join(pr.PushoverDevices, ",")) err := shoutrrr.Send(url, msg) if err != nil { - return err + PushoverErr = multierr.Append(PushoverErr, errors.Wrap(err, "error sending pushover")) } } - return nil + return PushoverErr } diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index 0340217..e18ecd6 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -5,7 +5,9 @@ import ( "strings" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" ) type Provider struct { @@ -33,6 +35,7 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { + var SlackErr error for _, pr := range p.Slack { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.SlackFormat)) @@ -40,8 +43,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("slack://%s", slackTokens) err := shoutrrr.Send(url, msg) if err != nil { - return err + SlackErr = multierr.Append(SlackErr, errors.Wrap(err, "error sending slack")) } } - return nil + return SlackErr } diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go index bc4f0c5..415e76a 100644 --- a/pkg/providers/smtp/smtp.go +++ b/pkg/providers/smtp/smtp.go @@ -6,6 +6,9 @@ import ( "github.com/containrrr/shoutrrr" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" + "github.com/pkg/errors" + ) type Provider struct { @@ -35,15 +38,15 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { - + var SmtpErr error for _, pr := range p.SMTP { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.SMTPFormat)) url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", pr.Username, pr.Password, pr.Server, pr.FromAddress, strings.Join(pr.SMTPCC, ",")) err := shoutrrr.Send(url, msg) if err != nil { - return err + SmtpErr = multierr.Append(SmtpErr, errors.Wrap(err, "error sending smtp")) } } - return nil + return SmtpErr } diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go index 73fe050..719f165 100644 --- a/pkg/providers/teams/teams.go +++ b/pkg/providers/teams/teams.go @@ -6,6 +6,9 @@ import ( "github.com/containrrr/shoutrrr" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" + "github.com/pkg/errors" + ) type Provider struct { @@ -31,7 +34,7 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { - + var TeamsErr error for _, pr := range p.Teams { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.TeamsFormat)) @@ -40,8 +43,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("teams://%s", teamsTokens) err := shoutrrr.Send(url, msg) if err != nil { - return err + TeamsErr = multierr.Append(TeamsErr, errors.Wrap(err, "error sending teams")) } } - return nil + return TeamsErr } diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index 8770772..aa00d96 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -4,7 +4,9 @@ import ( "fmt" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" ) type Provider struct { @@ -31,15 +33,15 @@ func New(options []*Options, ids []string) (*Provider, error) { } func (p *Provider) Send(message, CliFormat string) error { - + var TelegramErr error for _, pr := range p.Telegram { msg := utils.FormatMessage(message, utils.SelectFormat(CliFormat, pr.TelegramFormat)) url := fmt.Sprintf("telegram://%s@telegram?channels=%s", pr.TelegramAPIKey, pr.TelegramChatID) err := shoutrrr.Send(url, msg) if err != nil { - return err + TelegramErr = multierr.Append(TelegramErr, errors.Wrap(err, "error sending telegram")) } } - return nil + return TelegramErr } diff --git a/pkg/types/types.go b/pkg/types/types.go index 5acb301..b3606af 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -8,8 +8,8 @@ type Options struct { Silent bool `yaml:"silent,omitempty"` Version bool `yaml:"version,omitempty"` ProviderConfig string `yaml:"provider_config,omitempty"` - Providers goflags.StringSlice `yaml:"providers,omitempty"` - IDs goflags.StringSlice `yaml:"ids,omitempty"` + Providers goflags.NormalizedStringSlice `yaml:"providers,omitempty"` + IDs goflags.NormalizedStringSlice `yaml:"ids,omitempty"` Proxy string `yaml:"proxy,omitempty"` MessageFormat string `yaml:"message_format,omitempty"` diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go index 59067b4..9fb873f 100644 --- a/pkg/utils/httpreq/httpreq.go +++ b/pkg/utils/httpreq/httpreq.go @@ -55,3 +55,7 @@ func (c *Client) Post(url string, request interface{}, headers http.Header, resp } return nil } + +func (c *Client) Do(req *http.Request) (*http.Response, error) { + return c.httpClient.Do(req) +} From 75164ca3c910544a93bbb1185fd0a886189b7405 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 20 Aug 2021 16:14:11 +0530 Subject: [PATCH 61/72] print multierr errors one by one, few error message changes --- pkg/providers/custom/custom.go | 7 +++++-- pkg/providers/discord/discord.go | 6 ++++-- pkg/providers/providers.go | 5 ++++- pkg/providers/pushover/pushover.go | 5 +++-- pkg/providers/slack/slack.go | 3 ++- pkg/providers/smtp/smtp.go | 6 +++--- pkg/providers/teams/teams.go | 6 +++--- pkg/providers/telegram/telegram.go | 3 ++- pkg/utils/httpreq/httpreq.go | 2 +- 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/pkg/providers/custom/custom.go b/pkg/providers/custom/custom.go index 857fe22..7fb56e2 100644 --- a/pkg/providers/custom/custom.go +++ b/pkg/providers/custom/custom.go @@ -2,6 +2,7 @@ package custom import ( "bytes" + "fmt" "net/http" "github.com/pkg/errors" @@ -44,7 +45,8 @@ func (p *Provider) Send(message, CliFormat string) error { r, err := http.NewRequest(pr.CustomMethod, pr.CustomWebhookURL, body) if err != nil { - CustomErr = multierr.Append(CustomErr, errors.Wrap(err, "error sending custom")) + err = errors.Wrap(err, fmt.Sprintf("failed to send custom notification for id: %s ", pr.ID)) + CustomErr = multierr.Append(CustomErr, err) continue } @@ -54,7 +56,8 @@ func (p *Provider) Send(message, CliFormat string) error { _, err = httpreq.NewClient().Do(r) if err != nil { - CustomErr = multierr.Append(CustomErr, errors.Wrap(err, "error sending custom")) + err = errors.Wrap(err, fmt.Sprintf("failed to send custom notification for id: %s ", pr.ID)) + CustomErr = multierr.Append(CustomErr, err) } } return CustomErr diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index 4149813..0b2e9b9 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -42,14 +42,16 @@ func (p *Provider) Send(message, CliFormat string) error { discordTokens := strings.TrimPrefix(pr.DiscordWebHookURL, "https://discord.com/api/webhooks/") tokens := strings.Split(discordTokens, "/") if len(tokens) < 2 { - DiscordErr = multierr.Append(DiscordErr, errors.Wrap(errors.New("wrong discord configuration"), "error sending discord")) + err := fmt.Errorf("incorrect discord configuration for id: %s ", pr.ID) + DiscordErr = multierr.Append(DiscordErr, err) continue } webhookID, token := tokens[0], tokens[1] url := fmt.Sprintf("discord://%s@%s?splitlines=no", token, webhookID) err := shoutrrr.Send(url, msg) if err != nil { - DiscordErr = multierr.Append(DiscordErr, errors.Wrap(err, "error sending discord")) + err = errors.Wrap(err, fmt.Sprintf("failed to send discord notification for id: %s ", pr.ID)) + DiscordErr = multierr.Append(DiscordErr, err) } } return DiscordErr diff --git a/pkg/providers/providers.go b/pkg/providers/providers.go index 9862128..01ade2c 100644 --- a/pkg/providers/providers.go +++ b/pkg/providers/providers.go @@ -13,6 +13,7 @@ import ( "github.com/projectdiscovery/notify/pkg/providers/telegram" "github.com/projectdiscovery/notify/pkg/types" "github.com/projectdiscovery/notify/pkg/utils" + "go.uber.org/multierr" ) // ProviderOptions is configuration for notify providers @@ -110,7 +111,9 @@ func (p *Client) Send(message string) error { for _, v := range p.providers { if err := v.Send(message, p.options.MessageFormat); err != nil { - gologger.Error().Msgf("%s", err) + for _, v := range multierr.Errors(err) { + gologger.Error().Msgf("%s", v) + } } } diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go index 09baff0..b06e8b4 100644 --- a/pkg/providers/pushover/pushover.go +++ b/pkg/providers/pushover/pushover.go @@ -5,9 +5,9 @@ import ( "strings" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" - "github.com/pkg/errors" ) type Provider struct { @@ -42,7 +42,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("pushover://shoutrrr:%s@%s/?devices=%s", pr.PushoverApiToken, pr.UserKey, strings.Join(pr.PushoverDevices, ",")) err := shoutrrr.Send(url, msg) if err != nil { - PushoverErr = multierr.Append(PushoverErr, errors.Wrap(err, "error sending pushover")) + err = errors.Wrap(err, fmt.Sprintf("failed to send pushover notification for id: %s ", pr.ID)) + PushoverErr = multierr.Append(PushoverErr, err) } } return PushoverErr diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index e18ecd6..0363269 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -43,7 +43,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("slack://%s", slackTokens) err := shoutrrr.Send(url, msg) if err != nil { - SlackErr = multierr.Append(SlackErr, errors.Wrap(err, "error sending slack")) + err = errors.Wrap(err, fmt.Sprintf("failed to send slack notification for id: %s ", pr.ID)) + SlackErr = multierr.Append(SlackErr, err) } } return SlackErr diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go index 415e76a..06c3b0b 100644 --- a/pkg/providers/smtp/smtp.go +++ b/pkg/providers/smtp/smtp.go @@ -5,10 +5,9 @@ import ( "strings" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" - "github.com/pkg/errors" - ) type Provider struct { @@ -45,7 +44,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("smtp://%s:%s@%s/?fromAddress=%s&toAddresses=%s", pr.Username, pr.Password, pr.Server, pr.FromAddress, strings.Join(pr.SMTPCC, ",")) err := shoutrrr.Send(url, msg) if err != nil { - SmtpErr = multierr.Append(SmtpErr, errors.Wrap(err, "error sending smtp")) + err = errors.Wrap(err, fmt.Sprintf("failed to send smtp notification for id: %s ", pr.ID)) + SmtpErr = multierr.Append(SmtpErr, err) } } return SmtpErr diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go index 719f165..8ee2e5a 100644 --- a/pkg/providers/teams/teams.go +++ b/pkg/providers/teams/teams.go @@ -5,10 +5,9 @@ import ( "strings" "github.com/containrrr/shoutrrr" + "github.com/pkg/errors" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" - "github.com/pkg/errors" - ) type Provider struct { @@ -43,7 +42,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("teams://%s", teamsTokens) err := shoutrrr.Send(url, msg) if err != nil { - TeamsErr = multierr.Append(TeamsErr, errors.Wrap(err, "error sending teams")) + err = errors.Wrap(err, fmt.Sprintf("failed to send teams notification for id: %s ", pr.ID)) + TeamsErr = multierr.Append(TeamsErr, err) } } return TeamsErr diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index aa00d96..c986ced 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -40,7 +40,8 @@ func (p *Provider) Send(message, CliFormat string) error { url := fmt.Sprintf("telegram://%s@telegram?channels=%s", pr.TelegramAPIKey, pr.TelegramChatID) err := shoutrrr.Send(url, msg) if err != nil { - TelegramErr = multierr.Append(TelegramErr, errors.Wrap(err, "error sending telegram")) + err = errors.Wrap(err, fmt.Sprintf("failed to send telegram notification for id: %s ", pr.ID)) + TelegramErr = multierr.Append(TelegramErr, err) } } return TelegramErr diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go index 9fb873f..0e95c64 100644 --- a/pkg/utils/httpreq/httpreq.go +++ b/pkg/utils/httpreq/httpreq.go @@ -47,7 +47,7 @@ func (c *Client) Post(url string, request interface{}, headers http.Header, resp res, err := c.httpClient.Do(req) if err != nil { - return fmt.Errorf("error sending payload: %v", err) + return fmt.Errorf("failed to send payload: %v", err) } if err = jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { From ad72eab00051c33c83549b2dddec8f6a4423b164 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 20 Aug 2021 16:40:12 +0530 Subject: [PATCH 62/72] add verbose logs --- internal/runner/runner.go | 4 ++++ pkg/providers/custom/custom.go | 2 ++ pkg/providers/discord/discord.go | 2 ++ pkg/providers/pushover/pushover.go | 2 ++ pkg/providers/slack/slack.go | 2 ++ pkg/providers/smtp/smtp.go | 2 ++ pkg/providers/teams/teams.go | 2 ++ pkg/providers/telegram/telegram.go | 2 ++ 8 files changed, 18 insertions(+) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index c33ccc4..2dddc9e 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -77,6 +77,10 @@ func (r *Runner) Run() error { switch { case hasStdin(): + if r.options.Bulk { + gologger.Error().Msgf("bulk flag is not supported with stdin") + os.Exit(1) + } inFile = os.Stdin case r.options.Data != "": diff --git a/pkg/providers/custom/custom.go b/pkg/providers/custom/custom.go index 7fb56e2..5afc664 100644 --- a/pkg/providers/custom/custom.go +++ b/pkg/providers/custom/custom.go @@ -6,6 +6,7 @@ import ( "net/http" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "github.com/projectdiscovery/notify/pkg/utils/httpreq" "go.uber.org/multierr" @@ -59,6 +60,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send custom notification for id: %s ", pr.ID)) CustomErr = multierr.Append(CustomErr, err) } + gologger.Verbose().Msgf("custom notification sent for id: %s", pr.ID) } return CustomErr } diff --git a/pkg/providers/discord/discord.go b/pkg/providers/discord/discord.go index 0b2e9b9..a105c8f 100644 --- a/pkg/providers/discord/discord.go +++ b/pkg/providers/discord/discord.go @@ -6,6 +6,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -53,6 +54,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send discord notification for id: %s ", pr.ID)) DiscordErr = multierr.Append(DiscordErr, err) } + gologger.Verbose().Msgf("discord notification sent for id: %s", pr.ID) } return DiscordErr } diff --git a/pkg/providers/pushover/pushover.go b/pkg/providers/pushover/pushover.go index b06e8b4..4ca1ca8 100644 --- a/pkg/providers/pushover/pushover.go +++ b/pkg/providers/pushover/pushover.go @@ -6,6 +6,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -45,6 +46,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send pushover notification for id: %s ", pr.ID)) PushoverErr = multierr.Append(PushoverErr, err) } + gologger.Verbose().Msgf("pushover notification sent for id: %s", pr.ID) } return PushoverErr } diff --git a/pkg/providers/slack/slack.go b/pkg/providers/slack/slack.go index 0363269..67ba7f2 100644 --- a/pkg/providers/slack/slack.go +++ b/pkg/providers/slack/slack.go @@ -6,6 +6,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -46,6 +47,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send slack notification for id: %s ", pr.ID)) SlackErr = multierr.Append(SlackErr, err) } + gologger.Verbose().Msgf("slack notification sent for id: %s", pr.ID) } return SlackErr } diff --git a/pkg/providers/smtp/smtp.go b/pkg/providers/smtp/smtp.go index 06c3b0b..59590c6 100644 --- a/pkg/providers/smtp/smtp.go +++ b/pkg/providers/smtp/smtp.go @@ -6,6 +6,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -47,6 +48,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send smtp notification for id: %s ", pr.ID)) SmtpErr = multierr.Append(SmtpErr, err) } + gologger.Verbose().Msgf("smtp notification sent for id: %s", pr.ID) } return SmtpErr } diff --git a/pkg/providers/teams/teams.go b/pkg/providers/teams/teams.go index 8ee2e5a..f75ac32 100644 --- a/pkg/providers/teams/teams.go +++ b/pkg/providers/teams/teams.go @@ -6,6 +6,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -45,6 +46,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send teams notification for id: %s ", pr.ID)) TeamsErr = multierr.Append(TeamsErr, err) } + gologger.Verbose().Msgf("teams notification sent for id: %s", pr.ID) } return TeamsErr } diff --git a/pkg/providers/telegram/telegram.go b/pkg/providers/telegram/telegram.go index c986ced..3b4c330 100644 --- a/pkg/providers/telegram/telegram.go +++ b/pkg/providers/telegram/telegram.go @@ -5,6 +5,7 @@ import ( "github.com/containrrr/shoutrrr" "github.com/pkg/errors" + "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/utils" "go.uber.org/multierr" ) @@ -43,6 +44,7 @@ func (p *Provider) Send(message, CliFormat string) error { err = errors.Wrap(err, fmt.Sprintf("failed to send telegram notification for id: %s ", pr.ID)) TelegramErr = multierr.Append(TelegramErr, err) } + gologger.Verbose().Msgf("telegram notification sent for id: %s", pr.ID) } return TelegramErr } From 521bb32e72d5a61853ea0dddab6c3acd1e6ba7eb Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 17:09:17 +0530 Subject: [PATCH 63/72] GitHub workflow updates --- .github/dependabot.yml | 5 ++- .github/workflows/build-test.yml | 27 ++++++++++++ .github/workflows/build.yaml | 39 ------------------ .github/workflows/codeql-analysis.yml | 38 +++++++++++++++++ .github/workflows/dockerhub-push.yml | 41 +++++++++++++------ .github/workflows/lint-test.yml | 19 +++++++++ .../{release.yml => release-binary.yml} | 8 ++-- 7 files changed, 122 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/build-test.yml delete mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/lint-test.yml rename .github/workflows/{release.yml => release-binary.yml} (80%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4d5617f..69d9543 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,6 +11,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" include: "scope" @@ -20,6 +21,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" include: "scope" @@ -29,6 +31,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" - include: "scope" + include: "scope" \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..3db5da8 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,27 @@ +name: 🔨 Build Test +on: + push: + pull_request: + workflow_dispatch: + + +jobs: + build: + name: Test Builds + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Check out code + uses: actions/checkout@v2 + + - name: Test + run: go test . + working-directory: cmd/notify/ + + - name: Build + run: go build . + working-directory: cmd/notify/ \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index f5cc649..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - -jobs: - golangci-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: latest - args: --timeout 5m - working-directory: . - - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.14 - - - name: Check out code - uses: actions/checkout@v2 - - - name: Test notify - run: go test . - working-directory: cmd/notify/ - - - name: Build notify - run: go build . - working-directory: cmd/notify/ \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..545cdea --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,38 @@ +name: 🚨 CodeQL Analysis + +on: + workflow_dispatch: + pull_request: + branches: + - dev + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 \ No newline at end of file diff --git a/.github/workflows/dockerhub-push.yml b/.github/workflows/dockerhub-push.yml index 4f7b62a..b0d4933 100644 --- a/.github/workflows/dockerhub-push.yml +++ b/.github/workflows/dockerhub-push.yml @@ -1,17 +1,34 @@ -# dockerhub-push pushes docker build to dockerhub automatically -# on the creation of a new release -name: Publish to Dockerhub on creation of a new release -on: +name: 🌥 Docker Push + +on: release: types: [published] + workflow_dispatch: + jobs: - build: + docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Publish to Dockerhub Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: projectdiscovery/notify - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm + push: true + tags: projectdiscovery/notify:latest \ No newline at end of file diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml new file mode 100644 index 0000000..794d073 --- /dev/null +++ b/.github/workflows/lint-test.yml @@ -0,0 +1,19 @@ +name: 🙏🏻 Lint Test +on: + push: + pull_request: + workflow_dispatch: + +jobs: + lint: + name: Lint Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: --timeout 5m + working-directory: . \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release-binary.yml similarity index 80% rename from .github/workflows/release.yml rename to .github/workflows/release-binary.yml index 70cb60a..6fe8c82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-binary.yml @@ -1,8 +1,9 @@ -name: Release +name: 🎉 Release Binary on: create: tags: - v* + workflow_dispatch: jobs: release: @@ -17,7 +18,7 @@ jobs: name: "Set up Go" uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: 1.16 - env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -25,4 +26,5 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: args: "release --rm-dist" - version: latest \ No newline at end of file + version: latest + workdir: . \ No newline at end of file From 4e417cc34cbe6cd1e4071afc83f961d3b597f8ec Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 17:15:40 +0530 Subject: [PATCH 64/72] minor update --- .goreleaser.yml | 50 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 5b8fad0..5db099b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,21 +1,33 @@ +before: + hooks: + - go mod tidy + builds: - - binary: notify - main: cmd/notify/notify.go - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - 386 - - arm - - arm64 - +- env: + - CGO_ENABLED=0 + goos: + - windows + - linux + - darwin + goarch: + - amd64 + - 386 + - arm + - arm64 + + ignore: + - goos: darwin + goarch: '386' + - goos: windows + goarch: 'arm' + + binary: '{{ .ProjectName }}' + main: cmd/notify/notify.go + archives: - - id: tgz - format: tar.gz - replacements: - darwin: macOS - format_overrides: - - goos: windows - format: zip \ No newline at end of file +- format: zip + replacements: + darwin: macOS + +checksum: + algorithm: sha256 \ No newline at end of file From db8f19f17e39da079f279eaf4abce4b81edb3c2f Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 19:34:51 +0530 Subject: [PATCH 65/72] readme update --- README.md | 218 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 131 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 82e8e40..f5045af 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,192 @@ -

- notify +

+ notify

-[![License](https://img.shields.io/badge/license-MIT-_red.svg)](https://opensource.org/licenses/MIT) -[![Go Report Card](https://goreportcard.com/badge/github.com/projectdiscovery/notify)](https://goreportcard.com/report/github.com/projectdiscovery/notify) -[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/projectdiscovery/notify/issues) -[![GitHub Release](https://img.shields.io/github/release/projectdiscovery/notify)](https://github.com/projectdiscovery/notify/releases) -[![Follow on Twitter](https://img.shields.io/twitter/follow/pdiscoveryio.svg?logo=twitter)](https://twitter.com/pdiscoveryio) -[![Chat on Discord](https://img.shields.io/discord/695645237418131507.svg?logo=discord)](https://discord.gg/KECAGdH) +

+ + + + + + + +

+ +

+ Features • + Installation • + Providers • + Usage • + Running Notify • + Notes • + Join Discord +

+ + +Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms. + +

+ notify-httpx +
+

-Notify is an helper utility written in Go that allows you to pipe the output from various tools (or read from a file) and post the same to slack, discord, telegram etc (we call them providers) +# Features + +- Supports for Slack / Discord / Telegram +- Supports for Pushover / Email / Teams +- Supports for File / Pipe output +- Supports Line by Line / Bulk Post +- Supports using Single / Multiple providers +- Supports Custom Web-hooks +- Supports Custom data formatting -# Resources -- [Resources](#resources) -- [Usage](#usage) -- [Installation Instructions](#installation-instructions) - - [From Binary](#from-binary) - - [Using go CLI](#download-using-go-cli) - - [From Source](#build-from-source) -- [Running notify](#running-notify) - - [Provider config](#provider-config) - - [Example provider config](#example-provider-config) # Usage ```sh -▶ notify -h +notify -h ``` This will display help for the tool. Here are all the switches it supports. -| Flag | Description | Example | -|------|-------------|---------| -| -config string | Notify configuration file| notify -config config.yaml -| -silent | Don't print the banner| notify -silent -| -version | Show version of notify| notify -version -| -v | Show Verbose output| notify -v -| -no-color | Don't Use colors in output| notify -no-color -| -data string | File path to read data from| notify -data test.txt -| -bulk | Read the input and send it in bulk, character limit can be set using char-limit flag| notify -bulk -| -char-limit int | Character limit for message (default 4000)| notify -char-limit 2000 -| -provider-config string | provider config path (default: $HOME/.config/notify/provider-config.yaml)| notify -provider-config testproviderconfig.yaml -| -provider string[] | provider to send the notification to (optional)| notify -provider slack -provider telegram -| -id string[] | id to send the notification to (optional)| notify -id recon - +| Flag | Description | Example | +| ----------------------- | ----------------------------------------------- | ----------------------------------------- | +| -config string | Notify configuration file | notify -config config.yaml | +| -silent | Don't print the banner | notify -silent | +| -version | Show version of notify | notify -version | +| -v | Show Verbose output | notify -v | +| -no-color | Don't Use colors in output | notify -no-color | +| -data string | File path to read data from | notify -data test.txt | +| -bulk | Read and send data in bulk from file. | notify -bulk | +| -char-limit int | Character limit for message (default 4000) | notify -char-limit 2000 | +| -provider-config string | provider config path | notify -provider providers.yaml | +| -provider string[] | provider to send the notification to (optional) | notify -provider slack -provider telegram | +| -id string[] | id to send the notification to (optional) | notify -id recon,scans | -# Installation Instructions -### From Binary -The installation is easy. You can download the pre-built binaries for your platform from the [releases](https://github.com/projectdiscovery/notify/releases/) page. Extract them using tar, move it to your `$PATH`and you're ready to go. +# Notify Installation ```sh -Download latest binary from https://github.com/projectdiscovery/notify/releases - -▶ tar -xvf notify-linux-amd64.tar -▶ mv notify-linux-amd64 /usr/local/bin/notify -▶ notify -version +GO111MODULE=on go get -v github.com/projectdiscovery/notify/cmd/notify ``` -### Download using go cli +### Provider Config + +The default provider config file can be created at `$HOME/.config/notify/provider-config.yaml` and can have the following contents: + +```yaml +slack: + - id: "recon" + slack_channel: "recon" + slack_username: "test" + slack_format: "{{data}}" + slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" + + - id: "vulns" + slack_channel: "vulns" + slack_username: "test" + slack_format: "{{data}}" + slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" + +discord: + - id: "crawl" + discord_channel: "crawl" + discord_username: "test" + discord_format: "{{data}}" + discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" + + - id: "subs" + discord_channel: "subs" + discord_username: "test" + discord_format: "{{data}}" + discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" + +telegram: + - id: "quick" + telegram_api_key: "XXXXXXXXXXXX" + telegram_chat_id: "XXXXXXXX" + telegram_format: "{{data}}" +``` + +# Running Notify -Notify requires **go1.14+** to install successfully. Run the following command to download and install notify - +Notify supports piping output of any tool or output file and send it to configured provider/s (e.g, discord, slack channel) as notification. +### Send notification using piped(stdin) output ```sh -▶ GO111MODULE=on go get -v github.com/projectdiscovery/notify/cmd/notify +subfinder -d hackerone.com | notify ``` +

+notify-subfinder + + +### Send notification using output file -### Build From Source ```sh -▶ git clone https://github.com/projectdiscovery/notify.git; cd notify/cmd/notify; go build; mv notify /usr/local/bin/; notify -version +subfinder -d hackerone.com -o h1.txt; notify -data h1.txt ``` +### Send notification using output file in bulk mode -# Running notify -Notify supports piping output of any tool and send it to configured provider/s (e.g, discord, slack channel) as notification. +```sh +subfinder -d hackerone.com -o h1.txt; notify -data h1.txt -bulk +``` + +### Send notification using output file to specific provider's -Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe for alive URLs and sends the notifications of alive URLs using [httpx](https://github.com/projectdiscovery/httpx) to configured provider/s. +```sh +subfinder -d hackerone.com -o h1.txt; notify -data h1.txt -bulk -provider discord,slack ``` -subfinder -d hackerone.com | httpx | notify + +### Send notification using output file to specific ID's + + +```sh +subfinder -d hackerone.com -o h1.txt; notify -data h1.txt -bulk -id recon,vulns,scan ``` -

- notify-httpx -
-

+### Example Uses Following command will enumerate subdomains using [SubFinder](https://github.com/projectdiscovery/subfinder) and probe alive URLs using [httpx](https://github.com/projectdiscovery/httpx), runs [Nuclei](https://github.com/projectdiscovery/nuclei) templates and send the nuclei results as a notifications to configured provider/s. +```sh +subfinder -d intigriti.com | httpx | nuclei -tags exposure -o output.txt; notify -bulk -data output.txt ``` -subfinder -d intigriti.com | httpx | nuclei -t files | notify -``` - -In similar manner, output (stdout) of any tool can be piped to **notify** for posting data into slack/discord. -# Provider config +### Provider Config -The tool tries to use the default provider config (`$HOME/.config/notify/provider-config.yaml`), it can also be specified via CLI by running. +The tool tries to use the default provider config (`$HOME/.config/notify/provider-config.yaml`), it can also be specified via CLI by using **provider-config** flag. -To run the tool just use the following command. +To run the tool with custom providers config, just use the following command. ```sh -▶ notify -provider-config path/to/testproviderconfig.yaml +notify -provider-config providers.yaml ``` -## Example provider config -The default provider config file can be created at `$HOME/.config/notify/provider-config.yal` and can have the following contents: +### Notify Config -```yaml -slack: - - id: "recon" - slack_channel: "test" - slack_username: "test" - slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" - - id: "test" - slack_channel: "test" - slack_username: "test" - slack_webhook_url: "https://hooks.slack.com/services/XXXXXX" -discord: - - id: "test" - discord_channel: "test" - discord_username: "test" - discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" -telegram: - - id: "recon" - telegram_api_key: "XXXXXXXXXXXX" - telegram_chat_id: "XXXXXXXX" -``` +Notify flags can be configured at default config (`$HOME/.config/notify/config.yaml`) or custom config can be also provided using `config` flag. +## Notes +- As default notify sends notification line by line +- **bulk** flag is supported with data flag. +- stdin/pipe input doesn't support **bulk** posting. -## References:- +## References - [Creating Slack webhook](https://slack.com/intl/en-it/help/articles/115005265063-Incoming-webhooks-for-Slack) - [Creating Discord webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) - [Creating Telegram bot](https://core.telegram.org/bots#3-how-do-i-create-a-bot) -Notify is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team. +Notify is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team. \ No newline at end of file From ad840d6b6a0d258b67d416273d2de848c63331a6 Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 19:37:08 +0530 Subject: [PATCH 66/72] misc changes --- README.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f5045af..10239da 100644 --- a/README.md +++ b/README.md @@ -51,20 +51,19 @@ notify -h This will display help for the tool. Here are all the switches it supports. -| Flag | Description | Example | -| ----------------------- | ----------------------------------------------- | ----------------------------------------- | -| -config string | Notify configuration file | notify -config config.yaml | -| -silent | Don't print the banner | notify -silent | -| -version | Show version of notify | notify -version | -| -v | Show Verbose output | notify -v | -| -no-color | Don't Use colors in output | notify -no-color | -| -data string | File path to read data from | notify -data test.txt | -| -bulk | Read and send data in bulk from file. | notify -bulk | -| -char-limit int | Character limit for message (default 4000) | notify -char-limit 2000 | -| -provider-config string | provider config path | notify -provider providers.yaml | -| -provider string[] | provider to send the notification to (optional) | notify -provider slack -provider telegram | -| -id string[] | id to send the notification to (optional) | notify -id recon,scans | - +| Flag | Description | Example | +| ---------------- | ----------------------------------------------- | --------------------------------- | +| -config | Notify configuration file | notify -config config.yaml | +| -silent | Don't print the banner | notify -silent | +| -version | Show version of notify | notify -version | +| -v | Show Verbose output | notify -v | +| -no-color | Don't Use colors in output | notify -no-color | +| -data | File path to read data from | notify -data test.txt | +| -bulk | Read and send data in bulk from file. | notify -bulk | +| -char-limit | Character limit for message (default 4000) | notify -char-limit 2000 | +| -provider-config | provider config path | notify -provider-config conf.yaml | +| -provider | provider to send the notification to (optional) | notify -provider slack,telegram | +| -id | id to send the notification to (optional) | notify -id recon,scans | # Notify Installation From 1b0c3db8737459f67e3088737e543779676f4bda Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 19:39:03 +0530 Subject: [PATCH 67/72] Added example for custom webhook support --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 10239da..e44ee8d 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,15 @@ telegram: telegram_api_key: "XXXXXXXXXXXX" telegram_chat_id: "XXXXXXXX" telegram_format: "{{data}}" + +custom: + - id: webhook + custom_webook_url: http://host/api/webhook + custom_method: GET + custom_format: '{{data}}' + custom_headers: + Content-Type: application/json + X-Api-Key: XXXXX ``` # Running Notify From d3b9e29110d46a7d1f11eba4d5397a5fa84a2f44 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Fri, 20 Aug 2021 21:54:43 +0530 Subject: [PATCH 68/72] change http client for proxy support --- pkg/providers/slack/slack_api.go | 34 +++++++------------------------- pkg/utils/httpreq/httpreq.go | 4 ++-- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/pkg/providers/slack/slack_api.go b/pkg/providers/slack/slack_api.go index 7e0dbda..5bb0743 100644 --- a/pkg/providers/slack/slack_api.go +++ b/pkg/providers/slack/slack_api.go @@ -1,13 +1,10 @@ package slack import ( - "bytes" - "encoding/json" "fmt" "net/http" - jsoniter "github.com/json-iterator/go" - "github.com/projectdiscovery/retryablehttp-go" + "github.com/projectdiscovery/notify/pkg/utils/httpreq" ) const SlackPostMessageAPI = "https://slack.com/api/chat.postMessage" @@ -20,34 +17,17 @@ func (options *Options) SendThreaded(message string) error { TS: options.SlackThreadTS, } - reqBody, err := json.Marshal(payload) - if err != nil { - return fmt.Errorf("error while sending slack message: %s ", err) - } - - r, err := retryablehttp.NewRequest(http.MethodPost, SlackPostMessageAPI, bytes.NewReader(reqBody)) - if err != nil { - return err + headers := http.Header{ + "Content-Type": {"application/json"}, + "Authorization": {fmt.Sprintf("Bearer %s", options.SlackToken)}, } - r.Header.Set("Authorization", "Bearer "+options.SlackToken) - r.Header.Set("Content-Type", "application/json") + var response *APIResponse - client := retryablehttp.NewClient(retryablehttp.DefaultOptionsSingle) - res, err := client.Do(r) + err := httpreq.NewClient().Post(SlackPostMessageAPI, &payload, headers, &response) if err != nil { - return fmt.Errorf("error while sending slack message: %s ", err) - } - - if res.StatusCode != http.StatusOK { - return fmt.Errorf("slack request failed with status code %d ", res.StatusCode) - } - - var response APIResponse - if err = jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { - return fmt.Errorf("error trying to unmarshal the response: %v", err) + return err } - if !response.Ok { return fmt.Errorf("error while sending slack message: %s ", response.Error) } diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go index 0e95c64..017d50f 100644 --- a/pkg/utils/httpreq/httpreq.go +++ b/pkg/utils/httpreq/httpreq.go @@ -30,8 +30,8 @@ func (c *Client) Get(url string, response interface{}) error { return nil } -func (c *Client) Post(url string, request interface{}, headers http.Header, response interface{}) error { - body, err := json.Marshal(request) +func (c *Client) Post(url string, requestBody interface{}, headers http.Header, response interface{}) error { + body, err := json.Marshal(requestBody) if err != nil { return fmt.Errorf("error creating payload: %v", err) } From 647a5d42e36faf5a671fd04bcaed62a495970616 Mon Sep 17 00:00:00 2001 From: sandeep Date: Fri, 20 Aug 2021 23:39:01 +0530 Subject: [PATCH 69/72] version update --- internal/runner/banner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/runner/banner.go b/internal/runner/banner.go index 4c67cce..4c4beb8 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -8,12 +8,12 @@ const banner = ` __ _ ___ ___ ___ / /_(_) _/_ __ / _ \/ _ \/ __/ / _/ // / -/_//_/\___/\__/_/_/ \_, / 0.0.2 +/_//_/\___/\__/_/_/ \_, / v1.0.0 /___/ ` // Version is the current version -const Version = `0.0.2` +const Version = `1.0.0` // showBanner is used to show the banner to the user func showBanner() { From 39c75f42332db4405e3450f285b69649816cf0cf Mon Sep 17 00:00:00 2001 From: mzack Date: Sat, 21 Aug 2021 00:43:36 +0200 Subject: [PATCH 70/72] Discarding internal shoutrrr logs --- internal/runner/runner.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 2dddc9e..73f6765 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -3,11 +3,14 @@ package runner import ( "bufio" "crypto/tls" + "io/ioutil" + "log" "net/http" "net/url" "os" "path" + "github.com/containrrr/shoutrrr" "github.com/pkg/errors" "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/notify/pkg/providers" @@ -38,13 +41,13 @@ func NewRunner(options *types.Options) (*Runner, error) { if err != nil { return nil, errors.Wrap(err, "could not open provider config file") } - if parseErr := yaml.NewDecoder(file).Decode(&providerOptions); parseErr != nil { file.Close() return nil, errors.Wrap(parseErr, "could not parse provider config file") } - file.Close() + // Discard all internal logs + shoutrrr.SetLogger(log.New(ioutil.Discard, "", 0)) prClient, err := providers.New(&providerOptions, options) if err != nil { From cb33368a34908e7eaba9366ff5002bf63d6db4eb Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 21 Aug 2021 22:57:08 +0530 Subject: [PATCH 71/72] example updates --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e44ee8d..8f81342 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ The default provider config file can be created at `$HOME/.config/notify/provide ```yaml slack: - - id: "recon" + - id: "slack" slack_channel: "recon" slack_username: "test" slack_format: "{{data}}" @@ -104,11 +104,19 @@ discord: discord_webhook_url: "https://discord.com/api/webhooks/XXXXXXXX" telegram: - - id: "quick" + - id: "tel" telegram_api_key: "XXXXXXXXXXXX" telegram_chat_id: "XXXXXXXX" telegram_format: "{{data}}" +pushover: + - id: "push" + pushover_user_key: "XXXX" + pushover_api_token: "YYYY" + pushover_format: "{{data}}" + pushover_devices: + - "iphone" + custom: - id: webhook custom_webook_url: http://host/api/webhook @@ -196,5 +204,6 @@ Notify flags can be configured at default config (`$HOME/.config/notify/config.y - [Creating Slack webhook](https://slack.com/intl/en-it/help/articles/115005265063-Incoming-webhooks-for-Slack) - [Creating Discord webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) - [Creating Telegram bot](https://core.telegram.org/bots#3-how-do-i-create-a-bot) +- [Creating Pushover Token](https://github.com/containrrr/shoutrrr/blob/main/docs/services/pushover.md) Notify is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team. \ No newline at end of file From 436e11a0fc9349a20b275e04b50d4f7e06692774 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 21 Aug 2021 23:56:39 +0530 Subject: [PATCH 72/72] more examples --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 8f81342..a4bfa3c 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,16 @@ pushover: pushover_devices: - "iphone" +smtp: + - id: email + smtp_server: mail.example.com + smtp_username: test@example.com + smtp_password: password + from_address: from@email.com + smtp_cc: + - to@email.com + smtp_format: "{{data}}" + custom: - id: webhook custom_webook_url: http://host/api/webhook