Skip to main content

Find where to report a domain for abuse

Project description

abuse_whois

PyPI version Python CI Coverage Status

Yet another way to find where to report an abuse.

img

This tool is highly inspired from the following libraries:

Requirements

  • Python 3.7+
  • whois

Installation

pip install abuse_whois

# or if you want to use built-in REST API
pip install abuse_whois[api]

Usage

As a library

from abuse_whois import get_abuse_contacts

get_abuse_contacts("1.1.1.1")
get_abuse_contacts("github.com")
get_abuse_contacts("https://github.com")
get_abuse_contacts("foo@example.com")

As a CLI tool

$ abuse_whois 1.1.1.1 | jq .
{
  "address": "1.1.1.1",
  "hostname": "1.1.1.1",
  "ipAddress": "1.1.1.1",
  "sharedHostingProvider": null,
  "registrar": null,
  "hostingProvider": {
    "provider": "Cloudflare",
    "address": "https://www.cloudflare.com/abuse/form",
    "type": "form"
  }
}

As a REST API

$ uvicorn abuse_whois.api.app:app
INFO:     Started server process [2283]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

$ http localhost:8000/api/whois/ address=https://github.com
{
    "address": "https://github.com",
    "hostingProvider": {
        "address": "abuse@amazonaws.com",
        "provider": "",
        "type": "email"
    },
    "hostname": "github.com",
    "ipAddress": "52.192.72.89",
    "registrar": {
        "address": "abusecomplaints@markmonitor.com",
        "provider": "MarkMonitor, Inc.",
        "type": "email"
    },
    "sharedHostingProvider": null
}

With Docker

git clone https://github.com/ninoseki/abuse_whois
cd abuse_whois
docker build . -t abuse-whois
docker run -i -d -p 8000:8000 abuse-whois

Settings

All settings can be done via environment variables or .env file.

Name Type Default Desc.
WHOIS_LOOKUP_TIMEOUT int 10 Timeout value for whois lookup (seconds)
WHOIS_LOOKUP_CACHE_SIZE int 1024 Cache size for whois lookup
WHOIS_LOOKUP_CACHE_TTL int 3600 Cache TTL value for whois lookup (seconds)
IP_ADDRESS_LOOKUP_TIMEOUT int 10 Timeout value for IP address lookup (seconds)
IP_ADDRESS_LOOKUP_CACHE_SIZE int 1024 Cache size for IP address lookup
IP_ADDRESS_LOOKUP_CACHE_TTL int 3600 Cache TTL value for IP address lookup (seconds)

Contributions

abuse_whois works based on a combination of static rules and a parsing result of whois response.

Please submit a PR (or submit a feature request) if you find something missing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abuse_whois-0.3.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

abuse_whois-0.3.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file abuse_whois-0.3.1.tar.gz.

File metadata

  • Download URL: abuse_whois-0.3.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.6 Darwin/21.5.0

File hashes

Hashes for abuse_whois-0.3.1.tar.gz
Algorithm Hash digest
SHA256 14d7d5f439bdfb42e37f29b42c3e2cabf120c77102f7afd5f88339a7cacb8790
MD5 a424cbf4d9776ebc8e01a14ad8dc5318
BLAKE2b-256 50f75f8e80ca55ab99e3e5b0c887850c348f1172ac29a4e8b2a7df970fc2445e

See more details on using hashes here.

File details

Details for the file abuse_whois-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: abuse_whois-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.6 Darwin/21.5.0

File hashes

Hashes for abuse_whois-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7199aba8c0b72ccdd2769cf8a104af3881d7511f9c6f4f103dc89c5fb58d14ea
MD5 3de65407e0b33df8f26613b430076b37
BLAKE2b-256 0290217b1ef7b14a00dac743424687539f2ff80ca222d2a49f552f45d705f23f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page