Skip to content

Commit

Permalink
chore(deps): bump github.com/projectdiscovery/clistats from 0.0.12 to…
Browse files Browse the repository at this point in the history
… 0.0.18 (#1190)

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

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](projectdiscovery/clistats@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 showing stats on clistat update

---------

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>
  • Loading branch information
dependabot[bot] and RamanaReddy0M authored Jun 17, 2023
1 parent 8ea85e9 commit fbf5ef2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/miekg/dns v1.1.54 // indirect
github.com/pkg/errors v0.9.1
github.com/projectdiscovery/cdncheck v1.0.9
github.com/projectdiscovery/clistats v0.0.12
github.com/projectdiscovery/clistats v0.0.18
github.com/projectdiscovery/fdmax v0.0.4
github.com/projectdiscovery/goconfig v0.0.1
github.com/projectdiscovery/goflags v0.1.9
Expand Down Expand Up @@ -102,7 +102,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/projectdiscovery/blackrock v0.0.1 // indirect
github.com/projectdiscovery/freeport v0.0.4 // indirect
github.com/projectdiscovery/freeport v0.0.5 // indirect
github.com/projectdiscovery/networkpolicy v0.0.6 // indirect
github.com/projectdiscovery/retryabledns v1.0.29 // indirect
github.com/refraction-networking/utls v1.3.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,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/cdncheck v1.0.9 h1:BS15gzj9gb5AVSKqTDzPamfSgStu7nJQOocUvrssFlg=
github.com/projectdiscovery/cdncheck v1.0.9/go.mod h1:18SSl1w7rMj53CGeRIZTbDoa286a6xZIxGbaiEo4Fxs=
github.com/projectdiscovery/clistats v0.0.12 h1:KLYJxpiwEFidduU4PbcwEcCQ2L7c5wrf7DI5IN5fZ+8=
github.com/projectdiscovery/clistats v0.0.12/go.mod h1:9luKJj+7Hjq3+a7g129sKWRYx4SbTdkUWZQxabn3H5Y=
github.com/projectdiscovery/clistats v0.0.18 h1:WLQNqLXsKvjoieDwXJO/1jlnxR0x9vdFaRUAR3gXfKQ=
github.com/projectdiscovery/clistats v0.0.18/go.mod h1:YUnUrMHFw+FHwUTIKr1KDUwz81x+SFjPU3xfLqXfzf0=
github.com/projectdiscovery/dsl v0.0.9 h1:VfznBxpbNKMn2amQd9gtRnMfK1/Sf9MwsJD9x2Et/fY=
github.com/projectdiscovery/dsl v0.0.9/go.mod h1:kdPdbbqceWxkSedXm99z0Hzh9z/DFj42A9L95GJjybo=
github.com/projectdiscovery/fastdialer v0.0.29 h1:uDy2/bXHl8ISkuRp0EpmajkfWHewL3q5oDcYxB07ME8=
github.com/projectdiscovery/fastdialer v0.0.29/go.mod h1:CBzmr7QS+Ml66h1jjuudR8Uzl6bt2YeqYmTg0IedWsI=
github.com/projectdiscovery/fdmax v0.0.4 h1:K9tIl5MUZrEMzjvwn/G4drsHms2aufTn1xUdeVcmhmc=
github.com/projectdiscovery/fdmax v0.0.4/go.mod h1:oZLqbhMuJ5FmcoaalOm31B1P4Vka/CqP50nWjgtSz+I=
github.com/projectdiscovery/freeport v0.0.4 h1:H4VrK/7hUcC1zbg46zv9iSMBACBDpUqcHkV+FUyXISw=
github.com/projectdiscovery/freeport v0.0.4/go.mod h1:PY0bxSJ34HVy67LHIeF3uIutiCSDwOqKD8ruBkdiCwE=
github.com/projectdiscovery/freeport v0.0.5 h1:jnd3Oqsl4S8n0KuFkE5Hm8WGDP24ITBvmyw5pFTHS8Q=
github.com/projectdiscovery/freeport v0.0.5/go.mod h1:PY0bxSJ34HVy67LHIeF3uIutiCSDwOqKD8ruBkdiCwE=
github.com/projectdiscovery/goconfig v0.0.1 h1:36m3QjohZvemqh9bkJAakaHsm9iEZ2AcQSS18+0QX/s=
github.com/projectdiscovery/goconfig v0.0.1/go.mod h1:CPO25zR+mzTtyBrsygqsHse0sp/4vB/PjaHi9upXlDw=
github.com/projectdiscovery/goflags v0.1.9 h1:rLtdt7YNEIwsioT1HO48j01bZrqUTj45CiXPgNflTBk=
Expand Down
20 changes: 14 additions & 6 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,18 @@ func (r *Runner) prepareInput() {
r.stats.AddCounter("hosts", 0)
r.stats.AddStatic("startedAt", time.Now())
r.stats.AddCounter("requests", 0)

err := r.stats.Start(makePrintCallback(), time.Duration(r.options.StatsInterval)*time.Second)
r.stats.AddDynamic("summary", makePrintCallback())
err := r.stats.Start()
if err != nil {
gologger.Warning().Msgf("Could not create statistics: %s\n", err)
}

r.stats.GetStatResponse(time.Duration(r.options.StatsInterval)*time.Second, func(s string, err error) error {
if err != nil && r.options.Verbose {
gologger.Error().Msgf("Could not read statistics: %s\n", err)
}
return nil
})
}
}

Expand Down Expand Up @@ -497,9 +504,9 @@ var (
lastRequestsCount float64
)

func makePrintCallback() func(stats clistats.StatisticsClient) {
func makePrintCallback() func(stats clistats.StatisticsClient) interface{} {
builder := &strings.Builder{}
return func(stats clistats.StatisticsClient) {
return func(stats clistats.StatisticsClient) interface{} {
startedAt, _ := stats.GetStatic("startedAt")
duration := time.Since(startedAt.(time.Time))

Expand Down Expand Up @@ -534,11 +541,12 @@ func makePrintCallback() func(stats clistats.StatisticsClient) {
builder.WriteRune(')')

builder.WriteRune('\n')

fmt.Fprintf(os.Stderr, "%s", builder.String())
statString := builder.String()
fmt.Fprintf(os.Stderr, "%s", statString)
builder.Reset()

lastRequestsCount = currentRequests
return statString
}
}

Expand Down

0 comments on commit fbf5ef2

Please sign in to comment.