Giter Site home page Giter Site logo

simpleipprobe's Introduction

simpleIPprobe

This script is for a Google Cloud Function that allows users to look up information about a given IP address using the ipwhois library. This can be used in existing automation when logging traffic for systems to detect potentially malicious traffic.

Features

  • Accepts an IP address via a POST request.
  • Retrieves ownership and other related details about the IP address.
  • Returns the information in a JSON format.

Prerequisites

  • Python 3.x
  • Google Cloud SDK (if deploying to Google Cloud Functions)

Dependencies

The required dependencies are:

  • Flask
  • ipwhois

You can install these using:

pip install Flask ipwhois

Local Testing

  1. Navigate to the directory containing the script.

  2. Run the script:

python main.py
  1. Send a POST request with the IP address:
curl -X POST http://127.0.0.1:5000/lookup-ip -H "Content-Type: application/json" -d '{"ip":"8.8.8.8"}'

Deployment to Google Cloud Functions

  1. Ensure you have the Google Cloud SDK installed and are authenticated.

  2. Deploy the function:

gcloud functions deploy lookup_ip \
   --runtime python310 \
   --trigger-http \
   --allow-unauthenticated \
   --entry-point lookup_ip \
   --source=.

(Note: Omit the --allow-unauthenticated flag if you want to secure your function.)

  1. After deployment, Google Cloud Functions will provide a URL endpoint. Use this URL to send POST requests.

Usage

Send a POST request with a JSON payload containing the IP address you want to look up:

{
    "ip": "8.8.8.8"
}

๐Ÿ” by psykrat

simpleipprobe's People

Contributors

psykrat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.