chore(deps): bump github.com/projectdiscovery/clistats from 0.0.12 to 0.0.18 in /v2 (#3726)

* chore(deps): bump github.com/projectdiscovery/clistats in /v2

Bumps [github.com/projectdiscovery/clistats](https://github.com/projectdiscovery/clistats) from 0.0.12 to 0.0.18.
- [Release notes](https://github.com/projectdiscovery/clistats/releases)
- [Commits](https://github.com/projectdiscovery/clistats/compare/v0.0.12...v0.0.18)

---
updated-dependencies:
- dependency-name: github.com/projectdiscovery/clistats
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix clistat dep conflicts

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ramana Reddy <ramanaredy.manda@gmail.com>
Co-authored-by: Sandeep Singh <sandeep@projectdiscovery.io>
dev
dependabot[bot] 2023-06-22 19:18:59 +05:30 committed by GitHub
parent 442fc0f060
commit 16dd615f11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 11 deletions

View File

@ -20,7 +20,7 @@ require (
github.com/miekg/dns v1.1.55 github.com/miekg/dns v1.1.55
github.com/olekukonko/tablewriter v0.0.5 github.com/olekukonko/tablewriter v0.0.5
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/projectdiscovery/clistats v0.0.12 github.com/projectdiscovery/clistats v0.0.18
github.com/projectdiscovery/fastdialer v0.0.31 github.com/projectdiscovery/fastdialer v0.0.31
github.com/projectdiscovery/hmap v0.0.13 github.com/projectdiscovery/hmap v0.0.13
github.com/projectdiscovery/interactsh v1.1.4 github.com/projectdiscovery/interactsh v1.1.4
@ -126,7 +126,7 @@ require (
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/projectdiscovery/asnmap v1.0.4 // indirect github.com/projectdiscovery/asnmap v1.0.4 // indirect
github.com/projectdiscovery/cdncheck v1.0.6 // indirect github.com/projectdiscovery/cdncheck v1.0.6 // indirect
github.com/projectdiscovery/freeport v0.0.4 // indirect github.com/projectdiscovery/freeport v0.0.5 // indirect
github.com/refraction-networking/utls v1.3.2 // indirect github.com/refraction-networking/utls v1.3.2 // indirect
github.com/sashabaranov/go-openai v1.11.2 // indirect github.com/sashabaranov/go-openai v1.11.2 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect

View File

@ -403,16 +403,16 @@ github.com/projectdiscovery/blackrock v0.0.1 h1:lHQqhaaEFjgf5WkuItbpeCZv2DUIE45k
github.com/projectdiscovery/blackrock v0.0.1/go.mod h1:ANUtjDfaVrqB453bzToU+YB4cUbvBRpLvEwoWIwlTss= github.com/projectdiscovery/blackrock v0.0.1/go.mod h1:ANUtjDfaVrqB453bzToU+YB4cUbvBRpLvEwoWIwlTss=
github.com/projectdiscovery/cdncheck v1.0.6 h1:bjo4oxCD1Y5972ow0LWCjUpO8KOO12j6uGfPofVpC4c= github.com/projectdiscovery/cdncheck v1.0.6 h1:bjo4oxCD1Y5972ow0LWCjUpO8KOO12j6uGfPofVpC4c=
github.com/projectdiscovery/cdncheck v1.0.6/go.mod h1:NN0QRfxBzUVZJoS0lN37spElCOXHzFuvq1yg5RhTxCE= github.com/projectdiscovery/cdncheck v1.0.6/go.mod h1:NN0QRfxBzUVZJoS0lN37spElCOXHzFuvq1yg5RhTxCE=
github.com/projectdiscovery/clistats v0.0.12 h1:KLYJxpiwEFidduU4PbcwEcCQ2L7c5wrf7DI5IN5fZ+8= github.com/projectdiscovery/clistats v0.0.18 h1:WLQNqLXsKvjoieDwXJO/1jlnxR0x9vdFaRUAR3gXfKQ=
github.com/projectdiscovery/clistats v0.0.12/go.mod h1:9luKJj+7Hjq3+a7g129sKWRYx4SbTdkUWZQxabn3H5Y= github.com/projectdiscovery/clistats v0.0.18/go.mod h1:YUnUrMHFw+FHwUTIKr1KDUwz81x+SFjPU3xfLqXfzf0=
github.com/projectdiscovery/dsl v0.0.11-0.20230621170216-97e70ffb7efd h1:16DMjd4HeACrC9CkWJkkLeSh+LYPDorwNx11BlTbonU= github.com/projectdiscovery/dsl v0.0.11-0.20230621170216-97e70ffb7efd h1:16DMjd4HeACrC9CkWJkkLeSh+LYPDorwNx11BlTbonU=
github.com/projectdiscovery/dsl v0.0.11-0.20230621170216-97e70ffb7efd/go.mod h1:S72Cq/lfxzkldf64Sul1G2KFbGKNgpRFFCF/FazpznM= github.com/projectdiscovery/dsl v0.0.11-0.20230621170216-97e70ffb7efd/go.mod h1:S72Cq/lfxzkldf64Sul1G2KFbGKNgpRFFCF/FazpznM=
github.com/projectdiscovery/fastdialer v0.0.31 h1:eu0wTBCWjT8dXChmBtnQaAxoFpkLdvq0VroRxZoe/M8= github.com/projectdiscovery/fastdialer v0.0.31 h1:eu0wTBCWjT8dXChmBtnQaAxoFpkLdvq0VroRxZoe/M8=
github.com/projectdiscovery/fastdialer v0.0.31/go.mod h1:ttLvt0xnpNQAStYYQ6ElIBHfSXHuPEiXBkLH/OLbYlc= github.com/projectdiscovery/fastdialer v0.0.31/go.mod h1:ttLvt0xnpNQAStYYQ6ElIBHfSXHuPEiXBkLH/OLbYlc=
github.com/projectdiscovery/fasttemplate v0.0.2 h1:h2cISk5xDhlJEinlBQS6RRx0vOlOirB2y3Yu4PJzpiA= github.com/projectdiscovery/fasttemplate v0.0.2 h1:h2cISk5xDhlJEinlBQS6RRx0vOlOirB2y3Yu4PJzpiA=
github.com/projectdiscovery/fasttemplate v0.0.2/go.mod h1:XYWWVMxnItd+r0GbjA1GCsUopMw1/XusuQxdyAIHMCw= github.com/projectdiscovery/fasttemplate v0.0.2/go.mod h1:XYWWVMxnItd+r0GbjA1GCsUopMw1/XusuQxdyAIHMCw=
github.com/projectdiscovery/freeport v0.0.4 h1:H4VrK/7hUcC1zbg46zv9iSMBACBDpUqcHkV+FUyXISw= github.com/projectdiscovery/freeport v0.0.5 h1:jnd3Oqsl4S8n0KuFkE5Hm8WGDP24ITBvmyw5pFTHS8Q=
github.com/projectdiscovery/freeport v0.0.4/go.mod h1:PY0bxSJ34HVy67LHIeF3uIutiCSDwOqKD8ruBkdiCwE= github.com/projectdiscovery/freeport v0.0.5/go.mod h1:PY0bxSJ34HVy67LHIeF3uIutiCSDwOqKD8ruBkdiCwE=
github.com/projectdiscovery/goflags v0.1.10 h1:Gompf8JDy8y+5c4eWlc70KKtPuDH/hqFB3tMeHcMiKk= github.com/projectdiscovery/goflags v0.1.10 h1:Gompf8JDy8y+5c4eWlc70KKtPuDH/hqFB3tMeHcMiKk=
github.com/projectdiscovery/goflags v0.1.10/go.mod h1:MHEkqm3XgxBf5fK4gr3IXsj6VeLTq4qJYGC/4JRYQ74= github.com/projectdiscovery/goflags v0.1.10/go.mod h1:MHEkqm3XgxBf5fK4gr3IXsj6VeLTq4qJYGC/4JRYQ74=
github.com/projectdiscovery/gologger v1.1.10 h1:XNRdtzLTdxiFGuK9gutoL752mykzXDoii4P2yDovqck= github.com/projectdiscovery/gologger v1.1.10 h1:XNRdtzLTdxiFGuK9gutoL752mykzXDoii4P2yDovqck=

View File

@ -99,15 +99,23 @@ func (p *StatsTicker) Init(hostCount int64, rulesCount int, requestCount int64)
p.stats.AddCounter("total", uint64(requestCount)) p.stats.AddCounter("total", uint64(requestCount))
if p.active { if p.active {
var printCallbackFunc clistats.PrintCallback var printCallbackFunc clistats.DynamicCallback
if p.outputJSON { if p.outputJSON {
printCallbackFunc = printCallbackJSON printCallbackFunc = printCallbackJSON
} else { } else {
printCallbackFunc = p.makePrintCallback() printCallbackFunc = p.makePrintCallback()
} }
if err := p.stats.Start(printCallbackFunc, p.tickDuration); err != nil { p.stats.AddDynamic("summary", printCallbackFunc)
if err := p.stats.Start(); err != nil {
gologger.Warning().Msgf("Couldn't start statistics: %s", err) gologger.Warning().Msgf("Couldn't start statistics: %s", err)
} }
p.stats.GetStatResponse(p.tickDuration, func(s string, err error) error {
if err != nil {
gologger.Warning().Msgf("Could not read statistics: %s\n", err)
}
return nil
})
} }
} }
@ -145,8 +153,8 @@ func (p *StatsTicker) IncrementFailedRequestsBy(count int64) {
p.stats.IncrementCounter("errors", int(count)) p.stats.IncrementCounter("errors", int(count))
} }
func (p *StatsTicker) makePrintCallback() func(stats clistats.StatisticsClient) { func (p *StatsTicker) makePrintCallback() func(stats clistats.StatisticsClient) interface{} {
return func(stats clistats.StatisticsClient) { return func(stats clistats.StatisticsClient) interface{} {
builder := &strings.Builder{} builder := &strings.Builder{}
var duration time.Duration var duration time.Duration
@ -209,14 +217,16 @@ func (p *StatsTicker) makePrintCallback() func(stats clistats.StatisticsClient)
} }
fmt.Fprintf(os.Stderr, "%s", builder.String()) fmt.Fprintf(os.Stderr, "%s", builder.String())
return builder.String()
} }
} }
func printCallbackJSON(stats clistats.StatisticsClient) { func printCallbackJSON(stats clistats.StatisticsClient) interface{} {
builder := &strings.Builder{} builder := &strings.Builder{}
if err := json.NewEncoder(builder).Encode(metricsMap(stats)); err == nil { if err := json.NewEncoder(builder).Encode(metricsMap(stats)); err == nil {
fmt.Fprintf(os.Stderr, "%s", builder.String()) fmt.Fprintf(os.Stderr, "%s", builder.String())
} }
return builder.String()
} }
func metricsMap(stats clistats.StatisticsClient) map[string]interface{} { func metricsMap(stats clistats.StatisticsClient) map[string]interface{} {