问题
I have a list of URLs in a file (one URL per line) that I want to check their health against Google safe browsing database. I am following google's documentation on GitHub. I prefer to load the database locally as it is a huge list that will exhaust the rate limit of 10000 queries per day.
I followed the instructions until this step:
Once the Go environment is setup, run the following command with your API key:
go get github.com/google/safebrowsing/cmd/sbserver
sbserver -apikey $APIKEY
After executing the above commands which include my key, what I see in my command line (I use Ubuntu 18.04) is the following:
safebrowsing: 2019/06/27 10:21:47 database.go:111: no database file specified
safebrowsing: 2019/06/27 10:21:48 database.go:389: database is now healthy
safebrowsing: 2019/06/27 10:21:48 safebrowser.go:557: Next update in 30m11s
Starting server at localhost:8080
Now, the questions are:
1) Does that mean the database is UPDATED and SUCCESSFULLY LOADED? If not, how to?
2) How to query my list of URLs? I tried this command example based on the documentation (in a new terminal, as the previous terminal has a cursor blinking)):
127.0.0.1:8080/r?url=http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/
bash: 127.0.0.1:8080/r?url=http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/: No such file or directory
But unfortunately I get this output:
bash: 127.0.0.1:8080/r?url=http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/: No such file or directory
Can you please help me set up an updated version of the google safe browsing database locally, and query a list of URLs (read from a file) against the database? unfortunately, the documentation is not very clear to me.
EDIT:
I performed a test as instructed in the GitHub page and I got this result:
go test github.com/google/safebrowsing -v -run TestSafeBrowser -apikey mykey
=== RUN TestSafeBrowser
--- PASS: TestSafeBrowser (0.24s)
PASS
ok github.com/google/safebrowsing 0.245s
回答1:
Your list of queries (item 2) i.e
127.0.0.1:8080/r?url=http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/
Try them on your browser first. If you make everything right in step 1, it should work when you test the URL on a browser. Then you can jump to the implementation.
Step 1 creates a local proxy so you can you use safebrowsing.
Hope it helps! BR, Monique
来源:https://stackoverflow.com/questions/56788050/how-to-check-a-list-of-urls-against-google-safe-browsing-database