Skip to main content

python wrapper for abuseipdb API

Project description

Info

  • python wrapper for abuseipdb API -> https://docs.abuseipdb.com/#introduction

  • one way API - only gets info about IP address abuse

  • particulary info - data section from API response is parsed and extended with abuseipdb related url

  • aimed to local db usage, quick query and response

Install

pip install abuseipdb_wrapper

or

pip install git+https://github.com/streanger/abuseipdb_wrapper.git

Example usage

  • init `AbuseIPDB` object

    Init AbuseIPDB object using API KEY created on https://www.abuseipdb.com/. Optionally you can provide db_file for your local database. It is recommended becasue this project aims on storing data for further quick access without need of another requests.

    from abuseipdb_wrapper import AbuseIPDB
    API_KEY = 'YOUR_API_KEY'
    abuse = AbuseIPDB(API_KEY=API_KEY, db_file='abuseipdb.json')  # provide API KEY and local db filename
    abuse.colors_legend()  # show colors legend
  • check list of IP’s

    Specify list of IP’s to check and apply them using add_ip_list method. Next step run check method and wait.

    ips = ['1.2.3.4', '5.6.7.8', '9.10.11.12', '13.14.15.16']
    abuse.add_ip_list(ips)
    abuse.check()
  • show local db

    To display collected information use show_db call. Data table should be displayed on terminal. Alternatively call print on your AbuseIPDB object. Before showing db you can specifiy columns to be displayed. Do it using apply_columns_order method.

    abuse.apply_columns_order(['ipAddress', 'abuseConfidenceScore', 'totalReports', 'countryCode', 'domain', 'isp'])
    print(abuse)
    abuse.show_db(matched_only=False, table_view=True)
  • db viewer

    For interactive viewing of IP’s and checking them as well use viewer method. It let you to provide list of IP’s or single one. Use help for more information.

    abuse.viewer()

Screenshots

https://raw.githubusercontent.com/streanger/abuseipdb_wrapper/main/screenshots/colors_legend.png
https://raw.githubusercontent.com/streanger/abuseipdb_wrapper/main/screenshots/check_example.png
https://raw.githubusercontent.com/streanger/abuseipdb_wrapper/main/screenshots/viewer_example1.png
https://raw.githubusercontent.com/streanger/abuseipdb_wrapper/main/screenshots/viewer_example2.png

Update/Todo

todo/to consider

  • add last_checked column with containing timestamp

  • wrap text in table cells (juster/justify modification needed)

  • allow for justify/center table (consider)

  • allow for db sorting (specified by user)

  • IP ranges for viewer -> 1.2.3.0/24

  • make console script (consider)

  • think of more info than ‘data’ section in api response: reports -> comments, categories

  • check subnet 1.2.3.4/24 -> https://www.abuseipdb.com/check-block/1.2.3.4/24

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abuseipdb_wrapper-0.1.2-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file abuseipdb_wrapper-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: abuseipdb_wrapper-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for abuseipdb_wrapper-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8b08618334585a8d86982e5f5d720fc064fbe83fe4be883ad537110e0cb171ed
MD5 7c6c10052a545d30f66eaeffb9bd86f8
BLAKE2b-256 299418c2b7ae77cd6a3b3edc477f19898ece21166c4a387514648223dc36e115

See more details on using hashes here.

Supported by

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