Skip to content

Commit

Permalink
Fixed the problem where criminalip was not working (#641)
Browse files Browse the repository at this point in the history
* small typo in readme (#233)

* fix typo (#247)

* chore(deps): bump golang.org/x/net from 0.14.0 to 0.17.0 (#308)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.14.0 to 0.17.0.
- [Commits](golang/net@v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#367)

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](golang/crypto@v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 (#383)

Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](cloudflare/circl@v1.3.3...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (#384)

Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.38.1 to 0.38.2.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md)
- [Commits](quic-go/quic-go@v0.38.1...v0.38.2)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump google.golang.org/protobuf from 1.31.0 to 1.33.0 (#437)

Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/quic-go/quic-go from 0.38.2 to 0.42.0 (#454)

Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.38.2 to 0.42.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md)
- [Commits](quic-go/quic-go@v0.38.2...v0.42.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* version update

* fix: Fixed the problem where criminalip was not working

See also: #193

* chore(criminalip): `gofmt`'ed

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Pj Metz <65838556+MetzinAround@users.noreply.github.com>
Co-authored-by: Xc1Ym <xuedongyuming2233@gmail.com>
Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dwi Siswanto <git@dw1.io>
  • Loading branch information
6 people authored Jan 31, 2025
1 parent 6748d93 commit c32497c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions sources/agent/criminalip/criminalip.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
)

const (
URL = "https://api.criminalip.io/v1/banner/search?query=%s&offset=%d"
URL = "https://api.criminalip.io/v1/banner/search?query=%s&offset=%d"
offsetStep = 10
maxOffset = 9900
)

type Agent struct{}
Expand All @@ -31,7 +33,8 @@ func (agent *Agent) Query(session *sources.Session, query *sources.Query) (chan
defer close(results)

numberOfResults := 0
currentPage := 1
currentPage := 0

for {
criminalipRequest := &CriminalIPRequest{
Query: query.Query,
Expand All @@ -44,7 +47,14 @@ func (agent *Agent) Query(session *sources.Session, query *sources.Query) (chan
}

numberOfResults += len(criminalipResponse.Data.Result)
currentPage++

nextOffset := currentPage + offsetStep

if nextOffset > maxOffset {
break
}

currentPage = nextOffset

if numberOfResults > query.Limit || criminalipResponse.Data.Count == 0 || len(criminalipResponse.Data.Result) == 0 {
break
Expand Down

0 comments on commit c32497c

Please sign in to comment.