jreisinger / checkip

Get (security) info about IP addresses
MIT License
230 stars 24 forks source link

Add censys, onyphe checks and select checks by tag or config file #45

Closed yvesago closed 3 months ago

yvesago commented 3 months ago

Thx for your nice tool

here a pull request with censys and onyphe checks

and ability to selects checks by flag or in config file with a CHECKS key CHECKS: BlockList, CinsScore,

Usage of checkip [-flag] IP [IP liste]
  -a    run all available checks
  -c int
        IP addresses being checked concurrently (default 5)
  -j    output all results in JSON
  -t string
        list of checks
  * All checks : MaxMind, OTX, PhishStats, Shodan, UrlScan, IPtoASN, Firehol, DnsMX, IsOnAWS, Onyphe, Tls, VirusTotal, CinsScore, BlockList, Censys, DBip, DnsName, IPSum, Ping, SansISC, AbuseIPDB, 
  * Default checks : Ping, Tls, DnsName, Firehol, IPtoASN, IsOnAWS, OTX, BlockList, CinsScore, DBip, IPSum, Shodan
$ cat ~/.checkip.yaml
CHECKS: Shodan, Onyphe, Tls
jreisinger commented 3 months ago

Hi @yvesago, thanks for your effort! Your tests are failing though:

$ go test ./...
?       github.com/jreisinger/checkip/cli   [no test files]
?       github.com/jreisinger/checkip/cmd/checkip   [no test files]
ok      github.com/jreisinger/checkip   0.085s
2024/06/06 16:16:17 downloading http://127.0.0.1:56325
--- FAIL: TestOnyphe (0.00s)
    --- FAIL: TestOnyphe/given_valid_response_then_result_and_no_error_is_returned (0.00s)
        onyphe_test.go:37:
                Error Trace:    onyphe_test.go:37
                Error:          Not equal:
                                expected: true
                                actual  : false
                Test:           TestOnyphe/given_valid_response_then_result_and_no_error_is_returned
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x104ce5e28]

goroutine 86 [running]:
testing.tRunner.func1.2({0x104dbf820, 0x105026730})
    /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
    /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1634 +0x33c
panic({0x104dbf820?, 0x105026730?})
    /opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/panic.go:770 +0x124
github.com/jreisinger/checkip/check.TestOnyphe.func1(0x14000201380)
    /Users/jozef.reisinger/github.com/yvesago/checkip/check/onyphe_test.go:38 +0x1e8
testing.tRunner(0x14000201380, 0x104e1da58)
    /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 85
    /opt/homebrew/Cellar/go/1.22.3/libexec/src/testing/testing.go:1742 +0x318
FAIL    github.com/jreisinger/checkip/check 0.131s
FAIL
yvesago commented 3 months ago

a stupid error with the api key name, is now fixed onyphe publish network port in number or string format :-/ here is a more robust way to manage this weird behavior

jreisinger commented 3 months ago

Thanks for your code @yvesago! I merged the censys code. I didn't merge onyphe code because they have draconic rules for registration (you must use company email address). Also I don't want to complicate the tool's interface - I want to have a minimal numbers of flags. Thanks again 👍.