Skip to content

Better Script for Getting Clean Output Regarding your Queries #1

@TheSecMaven

Description

@TheSecMaven

I am using this Repo in my work. Only problem I had was that the output of your test script within readme is unreadable to those who are using this. I cleaned up the output in a way that is useful.

Not a big deal but still an improvement. Also this will let you query using a URL provided as a command line argument, making it easier to use.

Hoping this can be added to the repo as the query script in some form or fashion! Thanks so much, have a great day.

import safebrowsing 
import sys
apikey = 'YOUR_API_KEY'
sb = safebrowsing.LookupAPI(apikey)
resp = sb.threat_matches_find(str(sys.argv[1]))
if(resp == {}):
    print "Site Status: Clean"
else:
    print "Url: " + resp['matches'][0]['threat']['url']
    print "Threat Category: " + resp['matches'][0]['threatType']
    print "Platform Category: " + resp['matches'][0]['platformType']
                                                                        `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions