GitXplorerGitXplorer
n

abuse_whois

public
31 stars
4 forks
1 issues

Commits

List of commits on branch main.
Verified
67e88011172e93b66a1237e155456c4f829ca3e7

Merge pull request #74 from ninoseki/renew

nninoseki committed a month ago
Unverified
4266b3627bebbc844633a6e6d98459bf0db67a01

refactor: renew project

nninoseki committed a month ago
Verified
8bfc2be4a689485666b70eb4d20f623ce4058c47

Merge pull request #73 from ninoseki/update-azuma

nninoseki committed 6 months ago
Unverified
b65da55b238fb7fe65febe460f2b3f497a5dd1cf

chore: update azuma

nninoseki committed 6 months ago
Verified
a1c0033b860d732dbccfaf7b6766a80a37f751b2

Merge pull request #72 from ninoseki/remove-rule-extensions

nninoseki committed 7 months ago
Unverified
86c2ee97e8185380ff89d686785b2f6269ebe05d

refactor: remove rule extensions

nninoseki committed 7 months ago

README

The README file for this repository.

abuse_whois

PyPI version Python CI Coverage Status

A Sigma and RDAP/Whois based abuse contacts finder.

img

This tool is highly inspired from the following libraries:

How It Works

  • Query a given address via RDAP (fallback to Whois is if RDAP fails)
  • Check a query result with Sigma rules and find contacts (fallback to regex if there is no match)

Requirements

  • Python 3.10+

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

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

As a CLI tool

abuse_whois 1.1.1.1
abuse_whois example.com
abuse_whois foo@example.com
abuse_whois http://example.com

As a REST API

$ uvicorn abuse_whois.api.main: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

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.
QUERY_TIMEOUT int 10 Timeout value for whois lookup (seconds)
QUERY_CACHE_SIZE int 1024 Cache size for whois lookup
QUERY_CACHE_TTL int 3600 Cache TTL value for whois lookup (seconds)
QUERY_MAX_RETRIES int 3 Max retries on timeout error
ADDITIONAL_WHOIS_RULE_DIRECTORY str Additional contains contain whois rule files
ADDITIONAL_SHARED_HOSTING_RULE_DIRECTORY str Additional directory contains shared hosting rule files

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.