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

feat(inthewild): support inTheWild PoCs #78

Merged
merged 2 commits into from
Mar 24, 2022

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Feb 17, 2022

What did you implement:

Fixes vulsio/go-kev#5

Add inTheWild as a new data source.
https://github.com/gmatuz/inthewilddb

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

fetch

$ go-exploitdb fetch inthewild
INFO[02-18|06:36:56] Fetching inTheWild Poc Exploit 
INFO[02-18|06:36:58] inTheWild Poc Exploit                    count=70378
INFO[02-18|06:36:58] Insert Exploit into go-exploitdb.        db=sqlite3
INFO[02-18|06:36:58] Inserting 70378 Exploits 
INFO[02-18|06:36:58] Inserting new Exploits 
70378 / 70378 [-------------------------------------------------------------------------------------------------------] 100.00% 162670 p/s
INFO[02-18|06:36:58] No CveID Exploit Count                   count=0
INFO[02-18|06:36:58] CveID Exploit Count                      count=70378

$ wget "https://github.com/gmatuz/inthewilddb/blob/master/inthewild.db?raw=true" -O inthewild.db
$ sqlite3 inthewild.db
sqlite> SELECT COUNT(id) FROM exploits;
70378

$ sqlite3 go-exploitdb.sqlite3
sqlite> SELECT count(exploit_unique_id) FROM exploits;
70378
sqlite> SELECT count(DISTINCT(exploit_unique_id)) FROM exploits;
70378

diff test

$ patch -p1 < test.patch
$ make clean-integration && make build-integration
$ make fetch-rdb && make fetch-redis
$ make diff-server-rdb-redis
  • test.patch
diff --git a/GNUmakefile b/GNUmakefile
index ec24e54..2f82cca 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -70,13 +70,13 @@ clean:
 PWD := $(shell pwd)
 BRANCH := $(shell git symbolic-ref --short HEAD)
 build-integration:
-	@ git stash save
+	# @ git stash save
 	$(GO) build -ldflags "$(LDFLAGS)" -o integration/exploitdb.new
-	git checkout $(shell git describe --tags --abbrev=0)
-	@git reset --hard
-	$(GO) build -ldflags "$(LDFLAGS)" -o integration/exploitdb.old
-	git checkout $(BRANCH)
-	@ git stash apply stash@{0} && git stash drop stash@{0}
+	# git checkout $(shell git describe --tags --abbrev=0)
+	# @git reset --hard
+	# $(GO) build -ldflags "$(LDFLAGS)" -o integration/exploitdb.old
+	# git checkout $(BRANCH)
+	# @ git stash apply stash@{0} && git stash drop stash@{0}
 
 clean-integration:
 	-pkill exploitdb.old
@@ -87,28 +87,28 @@ clean-integration:
 	-docker rm redis-old redis-new
 
 fetch-rdb:
-	integration/exploitdb.old fetch awesomepoc --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
-	integration/exploitdb.old fetch exploitdb --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
-	integration/exploitdb.old fetch githubrepos --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
-	integration/exploitdb.old fetch inthewild --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
-
-	integration/exploitdb.new fetch awesomepoc --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
-	integration/exploitdb.new fetch exploitdb --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
-	integration/exploitdb.new fetch githubrepos --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
+	# integration/exploitdb.old fetch awesomepoc --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
+	# integration/exploitdb.old fetch exploitdb --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
+	# integration/exploitdb.old fetch githubrepos --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
+	# integration/exploitdb.old fetch inthewild --dbpath=$(PWD)/integration/go-exploitdb.old.sqlite3
+
+	# integration/exploitdb.new fetch awesomepoc --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
+	# integration/exploitdb.new fetch exploitdb --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
+	# integration/exploitdb.new fetch githubrepos --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
 	integration/exploitdb.new fetch inthewild --dbpath=$(PWD)/integration/go-exploitdb.new.sqlite3
 
 fetch-redis:
-	docker run --name redis-old -d -p 127.0.0.1:6379:6379 redis
+	# docker run --name redis-old -d -p 127.0.0.1:6379:6379 redis
 	docker run --name redis-new -d -p 127.0.0.1:6380:6379 redis
 	
-	integration/exploitdb.old fetch awesomepoc --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
-	integration/exploitdb.old fetch exploitdb --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
-	integration/exploitdb.old fetch githubrepos --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
-	integration/exploitdb.old fetch inthewild --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
-
-	integration/exploitdb.new fetch awesomepoc --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
-	integration/exploitdb.new fetch exploitdb --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
-	integration/exploitdb.new fetch githubrepos --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
+	# integration/exploitdb.old fetch awesomepoc --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
+	# integration/exploitdb.old fetch exploitdb --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
+	# integration/exploitdb.old fetch githubrepos --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
+	# integration/exploitdb.old fetch inthewild --dbtype redis --dbpath "redis://127.0.0.1:6379/0"
+
+	# integration/exploitdb.new fetch awesomepoc --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
+	# integration/exploitdb.new fetch exploitdb --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
+	# integration/exploitdb.new fetch githubrepos --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
 	integration/exploitdb.new fetch inthewild --dbtype redis --dbpath "redis://127.0.0.1:6380/0"
 
 diff-cveid:

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 self-assigned this Feb 17, 2022
@MaineK00n MaineK00n force-pushed the MaineK00n/support-inthewild branch 3 times, most recently from dee0e5b to 9861a4b Compare February 17, 2022 22:25
@MaineK00n MaineK00n marked this pull request as ready for review February 17, 2022 22:30
@MaineK00n MaineK00n force-pushed the MaineK00n/support-inthewild branch 2 times, most recently from a7dd170 to 07f28bd Compare February 17, 2022 22:40
@MaineK00n MaineK00n force-pushed the MaineK00n/support-inthewild branch from 3516252 to ba0a3e4 Compare March 2, 2022 21:10
@kotakanbe kotakanbe self-requested a review March 24, 2022 20:54
Copy link
Collaborator

@kotakanbe kotakanbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kotakanbe kotakanbe merged commit 8af7dcb into master Mar 24, 2022
@kotakanbe kotakanbe deleted the MaineK00n/support-inthewild branch March 24, 2022 20:56
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.

add support for inTheWild
2 participants