Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fetch): fix fetch failed #53

Merged
merged 1 commit into from
Jun 24, 2021
Merged

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Jun 24, 2021

What did you implement:

Fixes a bug that caused fetch to fail with the error Failed to delete: FOREIGN KEY constraint failed.

// fetch fail
// go-exploitdb checkout commit: ace20b83844f70379a7ed0c696b1170dc393b59b
$ go-exploitdb.ace20b8 fetch exploitdb
INFO[06-25|05:24:38] Fetching Offensive Security Exploit 
INFO[06-25|05:24:38] Fetching                                 URL=https://cve.mitre.org/data/downloads/allitems-cvrf.xml
INFO[06-25|05:25:25] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_shellcodes.csv
INFO[06-25|05:25:25] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_exploits.csv
INFO[06-25|05:25:25] Offensive Security Exploit               count=46825
INFO[06-25|05:25:25] Insert Exploit into go-exploitdb.        db=sqlite3
INFO[06-25|05:25:25] Inserting 46825 Exploits 
46825 / 46825 [-----------------------------------------------------------------------] 100.00% 8289 p/s
INFO[06-25|05:25:31] No CveID Exploit Count                   count=34187
INFO[06-25|05:25:31] CveID Exploit Count                      count=12638

$ go-exploitdb.ace20b8 fetch exploitdb
INFO[06-25|05:25:35] Fetching Offensive Security Exploit 
INFO[06-25|05:25:35] Fetching                                 URL=https://cve.mitre.org/data/downloads/allitems-cvrf.xml
INFO[06-25|05:26:07] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_shellcodes.csv
INFO[06-25|05:26:07] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_exploits.csv
INFO[06-25|05:26:07] Offensive Security Exploit               count=46825
INFO[06-25|05:26:07] Insert Exploit into go-exploitdb.        db=sqlite3
INFO[06-25|05:26:07] Inserting 46825 Exploits 
0 / 46825 [________________________________________________________________________________] 0.00% ? p/s
EROR[06-25|05:26:08] Failed to insert.                        dbpath=/home/mainek00n/github/github.com/MaineK00n/go-exploitdb/go-exploitdb.sqlite3 err="Failed to delete: FOREIGN KEY constraint failed"
Failed to delete: FOREIGN KEY constraint failed

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

// fetch success
// go-exploitdb checkout commit: ace20b83844f70379a7ed0c696b1170dc393b59b
$ go-exploitdb.ace20b8 fetch exploitdb
INFO[06-25|05:27:34] Fetching Offensive Security Exploit 
INFO[06-25|05:27:34] Fetching                                 URL=https://cve.mitre.org/data/downloads/allitems-cvrf.xml
INFO[06-25|05:28:03] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_shellcodes.csv
INFO[06-25|05:28:03] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_exploits.csv
INFO[06-25|05:28:03] Offensive Security Exploit               count=46825
INFO[06-25|05:28:03] Insert Exploit into go-exploitdb.        db=sqlite3
INFO[06-25|05:28:03] Inserting 46825 Exploits 
46825 / 46825 [-----------------------------------------------------------------------] 100.00% 7925 p/s
INFO[06-25|05:28:09] No CveID Exploit Count                   count=34187
INFO[06-25|05:28:09] CveID Exploit Count                      count=12638

// go-exploitdb checkout MaineK00n/fix-fetch-failed 
$ go-exploitdb fetch exploitdb
INFO[06-25|05:29:50] Fetching Offensive Security Exploit 
INFO[06-25|05:29:50] Fetching                                 URL=https://cve.mitre.org/data/downloads/allitems-cvrf.xml
INFO[06-25|05:30:21] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_shellcodes.csv
INFO[06-25|05:30:21] Fetching                                 URL=https://raw.githubusercontent.com/offensive-security/exploitdb/master/files_exploits.csv
INFO[06-25|05:30:22] Offensive Security Exploit               count=46825
INFO[06-25|05:30:22] Insert Exploit into go-exploitdb.        db=sqlite3
INFO[06-25|05:30:22] Inserting 46825 Exploits 
46825 / 46825 [------------------------------------------------------------------------] 100.00% 132 p/s
INFO[06-25|05:36:16] No CveID Exploit Count                   count=34187
INFO[06-25|05:36:16] CveID Exploit Count                      count=12638

Checklist:

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

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n changed the title [WIP] fix(fetch): fix fetch failed fix(fetch): fix fetch failed Jun 24, 2021
@kotakanbe kotakanbe merged commit dfd947e into vulsio:master Jun 24, 2021
@MaineK00n MaineK00n deleted the fix-fetch-failed branch June 24, 2021 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants