vulsio / go-exploitdb

Tool for searching Exploits from Exploit Databases, etc.
MIT License
249 stars 56 forks source link

fix(fetcher/exploitdb): fill in nil even if Document etc. is not found #158

Closed MaineK00n closed 1 year ago

MaineK00n commented 1 year ago

What did you implement:

If the Document provided to gitlab cannot be found, Exploit.OffensiveSecurity will be nil. If you try to search for such an exploit, you will get an error that it cannot be found. For example, like CVE-2018-11237(https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-11237), EXPLOIT-DB is referenced but the link is actually broken.

Type of change

How Has This Been Tested?

rdb

before

$ go-exploitdb fetch exploitdb
$ go-exploitdb search --type CVE --param CVE-2018-11237
Failed to get OffensiveSecurity. DB relationship may be broken, use `$ go-exploitdb fetch exploitdb` to recreate DB. err: record not found

after

$ go-exploitdb fetch exploitdb
$ go-exploitdb search --type CVE --param CVE-2018-11237

Results: 
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2018-11237
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 44750
  URL: https://www.exploit-db.com/exploits/44750
  Description: 

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: ---------------------------------------

redis

before

$ go-exploitdb fetch --dbtype redis --dbpath "redis://127.0.0.1:6379/1" exploitdb 
$ go-exploitdb search --dbtype redis --dbpath "redis://127.0.0.1:6379/1" --type CVE --param CVE-2018-11237

Results: 
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2018-11237
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 44750
  URL: https://www.exploit-db.com/exploits/44750
  Description: 

[*]Exploit Detail Info: ---------------------------------------

after

$ go-exploitdb fetch --dbtype redis --dbpath "redis://127.0.0.1:6379/1" exploitdb 
$ go-exploitdb search --dbtype redis --dbpath "redis://127.0.0.1:6379/1" --type CVE --param CVE-2018-11237

Results: 
---------------------------------------

[*]CVE-ExploitID Reference:
  CVE: CVE-2018-11237
  Exploit Type: OffensiveSecurity
  Exploit Unique ID: 44750
  URL: https://www.exploit-db.com/exploits/44750
  Description: 

[*]Exploit Detail Info: 
  [*]OffensiveSecurity: ---------------------------------------

Checklist:

You don't have to satisfy all of the following.

Is this ready for review?: YES

Reference