Skip to content

Collect a set of ranges from a variety of As a Service services

License

Notifications You must be signed in to change notification settings

fartbagxp/aas-cidr-ranges

Repository files navigation

Overview

Last Run master

This is currently a Work-In-Progress.

The goal of this project is to be able to quickly determine what Software-as-a-Service (SaaS) owns a particular IP address or range of IP addresses.

Input: Provided an IP address: 213.199.183.0 or an IP range in CIDR notation: 213.199.183.0/24, try to provide whether this IP address or range belongs to a SaaS provider.

Result : {"error": "", "data": {"region": "", "platform": "Azure", "systemService": "", "cloud": "Public"}}

Requirements

For coding and running locally, the following is required:

How to run locally

  1. Download the code:

    git clone git@github.com:fartbagxp/aas-cidr-ranges.git

  2. Setup dependencies:

    python -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
  3. Run the code to test it out:

    • python test.py

Upgrading old dependencies

I'm of the opinion that third party packages should be locked down to version and updated manually for production builds, which is why the requirements.txt file is locked down to version.

Python does not offer a default way of updating this file natively, so one way to work around it is to run the following to trick the requirements.txt file into upper versions and reinstalling the setup, and freezing a locked down dependency upon completion.

sed -i 's/[~=]=/>=/' requirements.txt
pip install --upgrade --force-reinstall -r requirements.txt
pip freeze > requirements.txt

Deployment

  1. Install deployment dependencies:
    npm install

  2. Package the serverless build:
    npm run package

  3. Run the deployment:
    npm run deploy

  4. The endpoint URL will be published as part of the deployment logs.

  5. Test it out!
    curl https://<lambda endpoint>.execute-api.<aws-datacenter>.amazonaws.com/dev/belong?ip=213.199.183.0

    Results:
    {"error": "", "data": {"region": "", "platform": "Azure", "systemService": "", "cloud": "Public"}}

Helpful links for reading

About

Collect a set of ranges from a variety of As a Service services

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published