asn-check


Nameasn-check JSON
Version 1.1.3 PyPI version JSON
download
home_pageNone
SummaryCheck ASNs and metadata for a list of IPs
upload_time2024-11-10 14:42:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords asn-lookup click ipv4 ipv6 ripe
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ASN Check
=========

[![PyPI version](https://badge.fury.io/py/asn-check.svg)](https://badge.fury.io/py/asn-check)
[![Python](https://img.shields.io/pypi/pyversions/asn_check)](https://img.shields.io/pypi/pyversions/asn_check)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)

Given a list of IPs the tool returns their AS numbers and names.

Data sources:

  - [ASN ranges IPv4- Thyme APNIC](https://thyme.apnic.net/current/data-raw-table),
  - [ASN ranges IPv6- Thyme APNIC](https://thyme.apnic.net/current/ipv6-raw-table),
  - [AS names - ripe.net](https://ftp.ripe.net/ripe/asnames/asn.txt),
  - [RFC #6890](https://www.rfc-editor.org/rfc/rfc6890.txt).

Features:

  - Caching the data from sources - first run may take a long time,
  - Binary IP network search for high throughput,
  - Returns AS Number, AS Name and a country code for each IP address,
  - Supports both IPv4 and IPv6,
  - Reserved ranges included,
  - Also available as a lib!


Installation
------------

    pip install asn-check


Options
-------

      --input-file FILENAME           Input file with one IPv4 per line  [default:STDIN]
      --output-file FILENAME          Output file - csv, header: ip,asn,name,country_code  [default: STDOUT]
      --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL] Set logging level.  [default: WARNING]
      --help                          Show this message and exit.


Example CLI
-----------

    $ echo '250.254.147.119
        12.154.0.67
        41.13.122.240
        176.218.30.1078
        128.105.177.84
        85.227.158.196
        74.74.207.74
        2a03:2880:f077::1' | asn-check 

Output:

    ip,asn,name,country_code
    250.254.147.119,rfc6890-t15,Reserved for Future Use,IANA
    12.154.0.67,7018,ATT-INTERNET4,US
    41.13.122.240,29975,VODACOM-,ZA
    128.105.177.84,59,WISC-MADISON-AS,US
    85.227.158.196,2119,TELENOR-NEXTEL Telenor Norge AS,NO
    74.74.207.74,11351,TWC-11351-NORTHEAST,US
    2a03:2880:f077::1,32934,FACEBOOK,US
 

Example Lib Usage
-----------------

    from ipaddress import ip_address
    from asn_check import ASNChecker
    
    checker = ASNChecker() 
    print(checker.search(ip_address("12.154.0.67")))

Output:

    {'ip': IPv4Address('12.154.0.67'), 'asn': '7018', 'name': 'ATT-INTERNET4', 'country_code': 'US'}

Note: If you'd like to use your own data sources, theoretically you can, but they need to follow the same format as the APNIC sources (and the format is not consistent!) - check out the constructor options `asn_routes_url_v4, asn_routes_url_v6, asn_names_url`. I'd recommend sticking to the defaults.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "asn-check",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "asn-lookup, click, ipv4, ipv6, ripe",
    "author": null,
    "author_email": "Miloslav Homer <miloslav.homer@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/cc/acaea3d5036e42997471f76584e226653af7266118895dd919066c6bbe4f/asn_check-1.1.3.tar.gz",
    "platform": null,
    "description": "ASN Check\n=========\n\n[![PyPI version](https://badge.fury.io/py/asn-check.svg)](https://badge.fury.io/py/asn-check)\n[![Python](https://img.shields.io/pypi/pyversions/asn_check)](https://img.shields.io/pypi/pyversions/asn_check)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)\n\nGiven a list of IPs the tool returns their AS numbers and names.\n\nData sources:\n\n  - [ASN ranges IPv4- Thyme APNIC](https://thyme.apnic.net/current/data-raw-table),\n  - [ASN ranges IPv6- Thyme APNIC](https://thyme.apnic.net/current/ipv6-raw-table),\n  - [AS names - ripe.net](https://ftp.ripe.net/ripe/asnames/asn.txt),\n  - [RFC #6890](https://www.rfc-editor.org/rfc/rfc6890.txt).\n\nFeatures:\n\n  - Caching the data from sources - first run may take a long time,\n  - Binary IP network search for high throughput,\n  - Returns AS Number, AS Name and a country code for each IP address,\n  - Supports both IPv4 and IPv6,\n  - Reserved ranges included,\n  - Also available as a lib!\n\n\nInstallation\n------------\n\n    pip install asn-check\n\n\nOptions\n-------\n\n      --input-file FILENAME           Input file with one IPv4 per line  [default:STDIN]\n      --output-file FILENAME          Output file - csv, header: ip,asn,name,country_code  [default: STDOUT]\n      --log-level [DEBUG|INFO|WARNING|ERROR|CRITICAL] Set logging level.  [default: WARNING]\n      --help                          Show this message and exit.\n\n\nExample CLI\n-----------\n\n    $ echo '250.254.147.119\n        12.154.0.67\n        41.13.122.240\n        176.218.30.1078\n        128.105.177.84\n        85.227.158.196\n        74.74.207.74\n        2a03:2880:f077::1' | asn-check \n\nOutput:\n\n    ip,asn,name,country_code\n    250.254.147.119,rfc6890-t15,Reserved for Future Use,IANA\n    12.154.0.67,7018,ATT-INTERNET4,US\n    41.13.122.240,29975,VODACOM-,ZA\n    128.105.177.84,59,WISC-MADISON-AS,US\n    85.227.158.196,2119,TELENOR-NEXTEL Telenor Norge AS,NO\n    74.74.207.74,11351,TWC-11351-NORTHEAST,US\n    2a03:2880:f077::1,32934,FACEBOOK,US\n \n\nExample Lib Usage\n-----------------\n\n    from ipaddress import ip_address\n    from asn_check import ASNChecker\n    \n    checker = ASNChecker() \n    print(checker.search(ip_address(\"12.154.0.67\")))\n\nOutput:\n\n    {'ip': IPv4Address('12.154.0.67'), 'asn': '7018', 'name': 'ATT-INTERNET4', 'country_code': 'US'}\n\nNote: If you'd like to use your own data sources, theoretically you can, but they need to follow the same format as the APNIC sources (and the format is not consistent!) - check out the constructor options `asn_routes_url_v4, asn_routes_url_v6, asn_names_url`. I'd recommend sticking to the defaults.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Check ASNs and metadata for a list of IPs",
    "version": "1.1.3",
    "project_urls": {
        "Documentation": "https://github.com/ArcHound/asn-check#readme",
        "Issues": "https://github.com/ArcHound/asn-check/issues",
        "Source": "https://github.com/ArcHound/asn-check"
    },
    "split_keywords": [
        "asn-lookup",
        " click",
        " ipv4",
        " ipv6",
        " ripe"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "55745821386bb6dbc77a092af51ac178ec96cb504eede60d617f0dfefdcc0da0",
                "md5": "29c750900570558c6ce9b85061efdf6f",
                "sha256": "1b560cda3464759aa9927e3e1ae8ab1ea7dd26015c768280f642864fe36c22b6"
            },
            "downloads": -1,
            "filename": "asn_check-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29c750900570558c6ce9b85061efdf6f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 21112,
            "upload_time": "2024-11-10T14:42:08",
            "upload_time_iso_8601": "2024-11-10T14:42:08.848223Z",
            "url": "https://files.pythonhosted.org/packages/55/74/5821386bb6dbc77a092af51ac178ec96cb504eede60d617f0dfefdcc0da0/asn_check-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "42ccacaea3d5036e42997471f76584e226653af7266118895dd919066c6bbe4f",
                "md5": "6368ec8da1013730d0c1437c9df8acd1",
                "sha256": "9aa28857256cc80962293b983197906e421abb90595b69e6ca1480bb127b6455"
            },
            "downloads": -1,
            "filename": "asn_check-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6368ec8da1013730d0c1437c9df8acd1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 23488,
            "upload_time": "2024-11-10T14:42:10",
            "upload_time_iso_8601": "2024-11-10T14:42:10.764120Z",
            "url": "https://files.pythonhosted.org/packages/42/cc/acaea3d5036e42997471f76584e226653af7266118895dd919066c6bbe4f/asn_check-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-10 14:42:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ArcHound",
    "github_project": "asn-check#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "asn-check"
}
        
Elapsed time: 0.49998s