GithubHelp home page GithubHelp logo

evilbotnet / openpimap Goto Github PK

View Code? Open in Web Editor NEW
50.0 8.0 6.0 630 KB

Python3 and Raspberry Pi based NetFlow Traffic Analysis leveraging Shodan's API, Twilio, GeoIP, and Folium to produce interactive maps and threat intelligence data.

Python 7.62% HTML 80.62% JavaScript 11.66% CSS 0.10%
netflow-v5 python3 raspberry-pi geoip shodan-api

openpimap's Introduction

OpenPiMap

OpenPiMap is an open source NetFlow protocol analyzer written entirely in Python 3 designed to provide insights on botnet and network traffic analysis in a small business or home network. It was designed and tested on a Windows 10 computer and then ran continuously on a Raspberry Pi 1 Model B (and should work flawlessly on a Pi2 or Pi3). The netflow_collector.py is designed to be run in the background (as a cron job) continuously and will listen for NetFlow v5 traffic (generated by PfSense, Cisco, etc.). The openipmap.py script can be run daily, weekly, or as needed. There are lots of incomplete and commented features so be sure to follow the code to see what it is doing. The script is designed to follow this path:

  1. Parse NetFlow data retrieved from the netflow_collector.py script.
  2. Retrieve multiple IP blacklists and determine the public IP address of the host that it is running on. (Or can be hardcoded for running offline)
  3. Correlate inbound and outbound IP addresses and potentially malicious IP addresses, ports, etc. to determine any kind of "bad" activity.
  4. For every IP address that is identified as suspicious, it will query Shodan.io for current services, hostname, etc. This can be immensely useful in determining if the device is part of a botnet, an IoT device, or other infected system on the internet. All of this data can then be used for trend analysis, reporting, incident tracking, etc.
  5. Finally, the script saves the map as an HTML file and pushes out an SMS message with the number of "bad" IPs that were detected.

The script has built in functionality to do data consumption statistics, top ports/services charts, and 24 hour / weekly / monthly queries. However, Shodan.io has a rate limit on their free API usage!! Looking up hundreds or thousands of unique IPs will take a LONG time!! This doesn't break anything.. but be prepared to wait a few hours if you are running monthly reports.

alt text

alt text

Notes

The code isn't quite complete. However, it has been running for 6+ months on my Raspberry Pi 1 Model B without any hiccups. Be sure to check out the API keys required for Shodan and Twilio functions to work (all requests are well within the free API limits). You will also need a local copy of the GeoIP database for offline geolocation of IP addresses.

Credit goes to Lalit Patel (http://codestacking.blogspot.com/2017/02/netflow-version-5-collector-in-python.html) for the NetFlow Collector. I made a few changes required to save the raw data to a CSV file for later processing and logging, but his collector was a great place to start.

openpimap's People

Contributors

evilbotnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openpimap's Issues

Errors running

can you do a pip freeze on your working install.. having issues with things not working likely due to different python environment and different versions

please pip freeze and maybe add to a requirements.txt?

Thanks!

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.