{"id":20331192,"url":"https://github.com/comcast/rapid-ip-checker","last_synced_at":"2025-04-11T21:07:34.779Z","repository":{"id":47690992,"uuid":"388879005","full_name":"Comcast/rapid-ip-checker","owner":"Comcast","description":"A GPU accelerated tool to compare large lists of IPv4/IPv6 addresses.","archived":false,"fork":false,"pushed_at":"2024-08-20T13:14:56.000Z","size":38,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-11T21:07:28.140Z","etag":null,"topics":["cuda","ipv4","ipv6","numba","parallel"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Comcast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-23T17:34:28.000Z","updated_at":"2024-05-26T23:48:28.000Z","dependencies_parsed_at":"2022-09-19T10:41:32.770Z","dependency_job_id":null,"html_url":"https://github.com/Comcast/rapid-ip-checker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Frapid-ip-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Frapid-ip-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Frapid-ip-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Frapid-ip-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Comcast","download_url":"https://codeload.github.com/Comcast/rapid-ip-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480434,"owners_count":21110937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","ipv4","ipv6","numba","parallel"],"created_at":"2024-11-14T20:19:11.844Z","updated_at":"2025-04-11T21:07:34.747Z","avatar_url":"https://github.com/Comcast.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rapid-ip-checker (ric)\n\nric (Rapid IP Checker) is a tool that can be used to check whether a list of input Host/Network IP addresses (IPv4 and IPv6), is part of a large list of network ranges, using the parallel computing capabilities of general purpose graphics processing units (GP-GPUs).\n\nric leverages the following for this :\n* *Python 3*\n* *Compute Unified Device Architecture (CUDA) :*\u003cbr/\u003eNvidia's parallel computing platform and application programming interface, which is an extension of C, with special constructs to support parallel programming.\n* *Numba :*\u003cbr/\u003eA JIT compiler for Python, that supports CUDA by directly compiling a restricted subset of Python code into CUDA kernels.\n* *RAPIDS APIS and Libraries (https://rapids.ai/) :* \u003cbr/\u003eAn opensource GPU data science framework.\n\n### The Cuda Kernel :\nThe task that is compiled as GPU code, and run in parallel across the GPU cores (the Cuda Kernel), is the checking of whether a single IP address is within a network CIDR.\n\nIP addresses can be represented as an integer using the dotted decimal format :\n\n| Dotted Decimal Format | Integer Equivalent |\n|:-:\t|:-:\t|\n| 0.0.0.0 \t| 0 |\n| 0.0.0.1 \t| 1 |\n| 0.0.0.2 \t| 2 |\n| ... \t| ... |\n| 255.255.255.255 | 4294967295 |\n\nThe mask can be indicate the number of hosts in a network :\n\n```(2**(32-mask))-1```\n\nNow, checking if an IP is in a network, becomes an integer comparison problem. This comparison is implemented as a Cuda Kernel, using Numba, that is run in parallel on the GPU cores.\n\n## Setup :\n### Create a conda environment \"ric-rapids-0.19\" :\n`conda create -n ric-rapids-0.19 -c rapidsai -c nvidia -c conda-forge -c defaults cudf=0.19 python=3.7 cudatoolkit=11.0 numba numpy`\n\n### Activate the environment :\n`conda activate ric-rapids-0.19`\n\n### Create a bash alias for the program :\n```\nalias ric=\"python ./ric.py\"; source ~/.bashrc ; alias \u003e ~/.bash_aliases\nalias ric6=\"python ./ric6.py\"; source ~/.bashrc ; alias \u003e ~/.bash_aliases\n```\n\n### Run the Program :\nFor IPv4 addresses : `ric -i input_ipv4_file.txt -t target_ipv4_file.txt`\u003cbr /\u003e\nFor IPv6 addresses : `ric6 -i input_ipv6_file.txt -t target_ipv6_file.txt`\n\n### Backup the environment :\n`conda env export \u003e environment.yml`\n\n## Usage :\n* Create a list of input  and target ranges in two text files (new line seperated). IPv6 addresses can be in the abbreviated format.\n* Pass that file as an argument to ric :\u003cbr/\u003e```ric -i input_ips.txt -t test_target.txt```\n\n## Sample Output : \n```\n$ ric -i input_ips.txt -t test_target.txt -v\n### Device in use :  NVIDIA Tesla V100-PCIE-16GB\n### Number Input IPs :  10 ; Target Size :  1000003\n### Grid Dimensions of input init : ( 1 : 1024 )\n### Grid Dimensions of target init : ( 977 : 1024 )\n### Grid Dimensions of comparison :  (1, 32259) : (31, 31) )\n3.1.1.0/24##Found in 3.1.0.0/16\n1.1.1.1/32##Not_Found\n10.0.1.1/32##Found in 10.0.0.0/8\n10.65.1.1/32##Found in 10.64.0.0/10\n192.168.255.255/32##Found in 192.168.0.0/16\n10.0.1.0/24##Found in 10.0.0.0/8\n172.25.24.0/23##Found in 172.16.0.0/12\n192.168.0.0/32##Found in 192.168.0.0/16\n255.255.255.255/32##Found in 255.255.0.0/16\n0.0.0.0/0##Found in 192.168.0.0/16\n###--- 2.6708738803863525 seconds ---\n```\n```\n$ ric6 -i input_ips_v6.txt -t test_target_v6.txt -v\n### Device in use :  NVIDIA Tesla V100-PCIE-16GB\n### Number Input IPs :  5 ; Target Size :  4\n### Grid Dimensions of input mask operations : ( 1 : 1024 )\n### Grid Dimensions of target mask operations : ( 1 : 1024 )\n### Grid Dimensions of comparison :  (1, 1) : (31, 31) )\n2000:1:0000:0000:0000:0000:0000:/120 ##Found in 2000:0000:0000:0000:0000:0000:0000:/3\n2000:0000:0000:0000:0000:0000:0000:1/128 ##Found in 2000:0000:0000:0000:0000:0000:0000:/3\nff01:0000:0000:0000:0000:0000:0000:1/128 ##Found in ff00:0000:0000:0000:0000:0000:0000:/8\nff00:0000:0000:0000:0000:0000:0000:2/127 ##Found in ff00:0000:0000:0000:0000:0000:0000:/8\n0000:0000:0000:0000:0000:0000:0000:/8 ##Not_Found\n###--- 6.19579553604126 seconds ---\n```\n\n## License\n\n`rapid-ip-checker` is licensed under [Apache License 2.0](/LICENSE). \n\n## Code of Conduct\n\nWe take our [code of conduct](CODE_OF_CONDUCT.md) very seriously. Please abide \nby it.\n\n## Contributing\n\nPlease read our [contributing guide](CONTRIBUTING.md) for details on how to \ncontribute to our project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Frapid-ip-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomcast%2Frapid-ip-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Frapid-ip-checker/lists"}