Contents:
Make sure you have installed all the requirements on your system (specified in README.md). Afterwards you can clone this project:
$ git clone https://github.com/nullsecuritynet/netgrafio
$ cd netgrafio
Now you’ll need to setup a isolated python environment using virtualenv:
$ virtualenv env
Using base prefix '/usr'
New python executable in env/bin/python3
Also creating executable in env/bin/python
Installing setuptools, pip...done.
Make sure to activate the virtual environment:
$ source env/bin/activate
Having set the virtualenv environment let’s install some missing packages:
$ pip install -r env/requirements.pip
Now you’re ready to start netgrafion and have some fun.
These are the basic parameters:
$ python netgrafio.py -h
usage: netgrafio.py [-h] [--tcp-port TCP_PORT] [--ws-port WS_PORT]
[--web-port WEB_PORT] [--host HOST]
netgrafio - visualize your network
optional arguments:
-h, --help show this help message and exit
--tcp-port TCP_PORT Specify TCP port to listen for JSON packets (default:
8081)
--ws-port WS_PORT Specify WebSocket port to send JSON data to (default:
8080)
--web-port WEB_PORT Specify web port to server web application (default:
5000)
--host HOST Specify host to bind socket on (default: 127.0.0.1)
If you start netgrafio without any arguments, then you’ll have a
After starting netgrafio:
$ python netgrafio.py
2014-04-24 16:18:12,984 - INFO - [WebSocketServer] - Starting WebSocket server on port 8080
2014-04-24 16:18:12,984 - INFO - [WebSocketServer] - Start collector server
2014-04-24 16:18:12,985 - INFO - [WebSocketServer] - Waiting for incoming data ...
2014-04-24 16:18:12,989 - INFO - [WebServer] - Listening on 5000
2014-04-24 16:18:12,989 - INFO - [TCPServer] - Listening on 8081
Now open your browser and navigate to http://localhost:5000
This section describes the basic API of d3.graph.min.js. It describes how to build a graph using D3.
Create a new D3 graph.
Arguments: |
|
---|---|
Returns: | Instance of class D3Graph (SVG element) |
Example:
myGraph = new D3Graph("#myElement");
Initialize the graph.
Example:
myGraph.init()
Start the graph.
Example:
myGraph.start()
Control the D3 graph.
Arguments: |
|
---|---|
Returns: | Instance of class D3GraphController |
Example:
myGraph = new D3Graph("#myElement");
graphController = new D3GraphController(myGraph);
Add new node to the graph.
Arguments: |
|
---|
Example:
nodeObject = {
"id": "some_unique_id"
,"class": "blue"
,"name": "This is my fancy name"
};
graphController.addNode(nodeObject);
Find node by ID.
Arguments: |
|
---|---|
Returns: | If found the node object is returned. |
Add new link between 2 nodes.
Arguments: |
|
---|
Example:
// Add nodes
nodeObjectA = {
"id": "A"
,"class": "A"
,"name": "B"
};
nodeObjectB = {
"id": "B"
,"class": "B"
,"name": "B"
};
// Add link
var linkObject = {
"source": nodeObjectA.id,
"target": nodeObjectB.id,
"linkclass": "dotted"
}
graphController.addNode(nodeObjectA);
graphController.addNode(nodeObjectB);
graphController.addLink(linkObject);
Find link by link object.
Arguments: |
|
---|---|
Returns: | If found the link object is returned. |
Example:
nodeObjectA = {"id": "A"}
nodeObjectB = {"id": "B"}
...
var linkObject = {"source": nodeObjectA, "target": nodeObjectB}
searched_link = findLink(linkObject)
...
Get array of nodes.
Returns: | Array containing all node objects |
---|
Get array of links.
Returns: | Array containing all link objects |
---|
Update graph. Wrapper for D3Graph.update().
Start graph. Wrapper for D3Graph.start().
TCP Server waiting for JSON packets
Starts JSON server
Custom TCP server
Tornado application
Default index page handler. Not implemented yet.
Handle default WebSocket connections
Connection was closed
Data income event callback
New connection has been established
Create tornado HTTP server serving our application
Note
Uses tornado as backend.
Wait for data in individual thread
Process incoming data and send it to all available clients
Starts the server
Note
The server will listen for incoming JSON packets and pass them to all clients connected to the WebSocket.
Starts collecting packages
Starts the HTTP server
Create new Flask application using Tornado’s WSGIContainer
Simple http server using Tornado
Server will start a new thread and listen for incoming connections
Dummy request handler
Do a traceroute using netgrafio
Analyze your network traffic (LIVE!)
Visualize your NMap scanning results