Giter Club home page Giter Club logo

dnscloud's Introduction

dnsCloud

Program to create word clouds of DNS traffic.

Quick start:

./pysniff.py eth0 dnslookups.txt 

./cloud.py dnslookups.txt dnslookups.png 

Install

You will need to install some prereqs.

  • pip3 install wordcloud
  • pip3 install matplotlib
  • pip3 install pcapy
  • pip3 install scapy

Use

First you will want to create a list of DNS lookups. To do that run sniff.py INTERFACE OUTFILE

dnsCloud joe$ ./pysniff.py  --help 
usage: pysniff.py [-h] [--pid] interface outfile

DNS Word Cloud Image Generation

positional arguments:
  interface   Network Interface
  outfile     DNS log file

optional arguments:
  -h, --help  show this help message and exit
  --pid       Create a pid file in /var/run/pysniff.pid

To listen on en0 and create a file with DNS lookups called dnslookups.txt run:

dnsCloud joe$ sudo ./sniff.py en0 dnslookups.txt

You can then create a word cloud using cloud.py INFILE OUTFILE .

dnsCloud joe$ ./cloud.py -h
usage: cloud.py [-h] [--bgimage BGIMAGE] infile outfile

DNS Word Cloud Image Generation

positional arguments:
  infile             Source file
  outfile            Destination image file

optional arguments:
  -h, --help         show this help message and exit
  --bgimage BGIMAGE  Optional image filei to shape around

To create a wordcloud using the file dnslookups.txt and an image dnslookups.png run:

dnsCloud joe$ ./cloud.py dnslookups.txt dnslookups.png
Source file: dnslookups.txt
Output file: dnslookups.png

Automate

I run this out of cron. first create your crontab.

$crontab -e
*/5 * * * * /home/joe/cloud.py /data/dnsqueries.txt /var/www/html/dnscloud/wordcloud.png

Then have sniff.py start on boot.

$vi /usr/lib/systemd/system/pysniff.service #Startup file for pysniff.pif #run systemctl enable pysniff.service

[Unit]
Description=Python DNS Sniffing Service
After=multi-user.target

[Service]
type=oneshot
PIDFile=/var/run/pysniff.pid
WorkingDirectory=/root
ExecStart=/root/pysniff.py eno2 /data/dnsqueries.txt --pid
RestartSec=10s
Restart=always
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target

dnscloud's People

Contributors

joemcmanus avatar

Stargazers

 avatar William Stearns avatar

Watchers

James Cloos avatar  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.