In this PR, I would like to add information about offensive-security/exploitdb-papers to fetch exploitdb. exploitdb-papers contains information about papers and so on.
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
The offensive_security_id used in WHERE when searching for documents, shell_codes, (papers) has been changed to use the correct one.
The upstream/master only uses offensive_securities.id:7449. The query should use both 7449 and 7500. It has been fixed as such.
sqlite> SELECT id FROM "exploits" WHERE ("exploits"."exploit_unique_id" = '6560');
id
7449
7450
sqlite> SELECT * FROM "offensive_securities" WHERE ("offensive_securities"."exploit_unique_id" = '6560');
id|exploit_id|exploit_unique_id
7449|7449|6560
7450|7450|6560
// PR
$ go-exploitdb search --type ID --param 6560 --debug-sql
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:53)
[2021-06-28 12:38:47] [0.05ms] PRAGMA foreign_keys = ON
[0 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:181)
[2021-06-28 12:38:47] [8.18ms] SELECT * FROM "exploits" WHERE ("exploits"."exploit_unique_id" = '6560')
[2 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.70ms] SELECT * FROM "offensive_securities" WHERE ("offensive_securities"."exploit_id" = 7449) ORDER BY "offensive_securities"."id" ASC LIMIT 1
[1 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [6.43ms] SELECT * FROM "documents" WHERE ("offensive_security_id" IN (7449)) ORDER BY "documents"."id" ASC
[0 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.24ms] SELECT * FROM "shell_codes" WHERE ("offensive_security_id" IN (7449)) ORDER BY "shell_codes"."id" ASC
[0 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.30ms] SELECT * FROM "papers" WHERE ("offensive_security_id" IN (7449)) ORDER BY "papers"."id" ASC
[0 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.38ms] SELECT * FROM "offensive_securities" WHERE ("offensive_securities"."exploit_id" = 7450) ORDER BY "offensive_securities"."id" ASC LIMIT 1
[1 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [9.16ms] SELECT * FROM "documents" WHERE ("offensive_security_id" IN (7450)) ORDER BY "documents"."id" ASC
[1 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.36ms] SELECT * FROM "shell_codes" WHERE ("offensive_security_id" IN (7450)) ORDER BY "shell_codes"."id" ASC
[0 rows affected or returned ]
(/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/db/rdb.go:186)
[2021-06-28 12:38:47] [0.44ms] SELECT * FROM "papers" WHERE ("offensive_security_id" IN (7450)) ORDER BY "papers"."id" ASC
[0 rows affected or returned ]
// upstream/master
$ go-exploitdb search --type ID --param 6560 --debug-sql
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:54)
[2021-06-28 12:37:43] [0.06ms] PRAGMA foreign_keys = ON
[0 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:152)
[2021-06-28 12:37:43] [8.77ms] SELECT * FROM "exploits" WHERE ("exploits"."exploit_unique_id" = '6560')
[2 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [0.19ms] SELECT * FROM "offensive_securities" WHERE ("offensive_securities"."exploit_unique_id" = '6560') ORDER BY "offensive_securities"."id" ASC LIMIT 1
[1 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [5.25ms] SELECT * FROM "documents" WHERE ("offensive_security_id" IN (7449))
[0 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [0.32ms] SELECT * FROM "shell_codes" WHERE ("offensive_security_id" IN (7449))
[0 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [0.15ms] SELECT * FROM "offensive_securities" WHERE ("offensive_securities"."exploit_unique_id" = '6560') ORDER BY "offensive_securities"."id" ASC LIMIT 1
[1 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [6.34ms] SELECT * FROM "documents" WHERE ("offensive_security_id" IN (7449))
[0 rows affected or returned ]
(/home/mainek00n/go/src/github.com/mozqnet/go-exploitdb/db/rdb.go:157)
[2021-06-28 12:37:43] [0.33ms] SELECT * FROM "shell_codes" WHERE ("offensive_security_id" IN (7449))
[0 rows affected or returned ]
Checklist:
You don't have to satisfy all of the following.
[ ] Write tests
[ ] Write documentation
[x] Check that there aren't other open pull requests for the same issue/feature
[x] Format your source code by make fmt
[x] Pass the test by make test
[x] Provide verification config / commands
[x] Enable "Allow edits from maintainers" for this PR
What did you implement:
The current
fetch exploitdb
inserts Exploits and Shellcodes information from offensive-security/exploitdb.In this PR, I would like to add information about offensive-security/exploitdb-papers to
fetch exploitdb
. exploitdb-papers contains information about papers and so on.Type of change
How Has This Been Tested?
Search by CVE-ID
Search by ExploitUniqueID
Query modification
The
offensive_security_id
used in WHERE when searching fordocuments
,shell_codes
, (papers
) has been changed to use the correct one. The upstream/master only uses offensive_securities.id:7449. The query should use both 7449 and 7500. It has been fixed as such.Checklist:
You don't have to satisfy all of the following.
make fmt
make test
Is this ready for review?: YES
Reference