Skip to content

Instantly share code, notes, and snippets.

@pavel-odintsov
Last active August 29, 2015 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavel-odintsov/fac1c8160fd10ceb74e4 to your computer and use it in GitHub Desktop.
Save pavel-odintsov/fac1c8160fd10ceb74e4 to your computer and use it in GitHub Desktop.
Get abuse email for subnet
#!/usr/bin/python
import json
import urllib2
import sys
import pprint
if len(sys.argv) != 2:
sys.exit("Please provide params");
answer = urllib2.urlopen("https://stat.ripe.net/data/abuse-contact-finder/data.json?resource=" + sys.argv[1])
decoded_answer = json.load(answer)
try:
abuse_email = decoded_answer['data']['anti_abuse_contacts']['abuse_c'][0]['email']
print abuse_email
except (KeyError, IndexError):
print "Can't request abuse email"
@pavel-odintsov
Copy link
Author

Example:

./get_abuse_email.py 193.0.6.139
abuse@ripe.net

@spron-in
Copy link

spron-in commented Jun 3, 2015

А оно возвращает abuse email, если сеть не под RIPE? ARIN, например?
Я использовал API https://abusix.com/contactdb.html в свое время для этих целей.

@pavel-odintsov
Copy link
Author

Надо проверять :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment