2019-01-11 14:00:25 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
from pyurlabuse import PyURLAbuse
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = argparse.ArgumentParser(description='Run a query against URL Abuse')
|
|
|
|
parser.add_argument('--url', type=str, help='URL of the instance.')
|
|
|
|
|
|
|
|
parser.add_argument('--query', help='URL to lookup')
|
2019-01-15 16:20:38 +01:00
|
|
|
parser.add_argument('--digest', action='store_true', help='Return the digest')
|
2019-01-11 14:00:25 +01:00
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
if args.url:
|
|
|
|
urlabuse = PyURLAbuse(args.url)
|
|
|
|
else:
|
|
|
|
urlabuse = PyURLAbuse()
|
|
|
|
|
2019-01-15 16:20:38 +01:00
|
|
|
response = urlabuse.run_query(args.query, args.digest)
|
|
|
|
if args.digest:
|
|
|
|
print(response['digest'][0])
|
2019-01-14 16:59:10 +01:00
|
|
|
else:
|
|
|
|
print(json.dumps(response, indent=2))
|