dorneanu / netgrafio

netgrafio - Visualize your network
Other
328 stars 20 forks source link

Displaying netgrafio on remote server #1

Closed jmillxyz closed 10 years ago

jmillxyz commented 10 years ago

Running netgrafio works perfectly when run on localhost. But when sending the same commands to a remote server, nothing is displayed. I can see that the remote server receives the data (same tornado logs as localhost, attached) but on both Chrome and Firefox, the graph isn't updated. The command I'm using is your nmap example, but netcatted to the remote server. The remote server's instance of netgrafio.py has been tested with both "--host 0.0.0.0" and "--host [public IP]". image

dorneanu commented 10 years ago

Hi! On which port (on the server) does netgrafio listens for incoming JSON packets? Default is 8081. Make sure you send your JSON data to the right port:

$ [...] | nc <remote server> 8081

I'll definitely have a look at it these days.

jmillxyz commented 10 years ago

Yep, 8081 -- you can see my SSH session above and the server receiving the data. I can private message you the login for the server I'm testing on if you like (it's digital ocean, I can just spin up a new one). What's your best contact info?

And server details: Ubuntu 12.04 x86, Python 3.4, 512 MB RAM

dorneanu commented 10 years ago

You could also easily setup some local port forwarding using SSH. But if you want me to, I could have a look at your setup on the remote server.

You could drop me an e-email at: info _äääät_ dornea DOOOT nu

dorneanu commented 10 years ago

This is what I did:

1) I've logged in to your server using:

$ ssh -D 9999 root@<ip>

2) Launched new netgrafio instance

$ tmux
$ cd netgrafio
$ python3.4 netgrafio.py --host 0.0.0.0
...

3) Connected my browser to the netgrafio instance using Sock5 proxy I've created using "ssh -D 9999" (I used firefox along with foxyproxy)

4) On my local machine I did:

$ cd work/repos/github/dorneanu/netgrafio
$ tshark -l -i wlan0 -T fields -e ip.src_host -e ip.dst_host > /dev/null 2>&1 | stdbuf -oL awk -f web/mod_netanalyzer/scripts/src-dst.awk | egrep -v --line-buffered "Capturing" |  stdbuf -oL sed 's/"/\\"/g' | xargs -n 1 -I % sh -c "echo '%' | nc <ip of remote machine> 8081; sleep 0.2"

Then I could see the traffic on my local machine in the browser.

The Tmux session is still running on the server. And BTW:

root@muffin:~/netgrafio# netstat -ptan 
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN      9841/python3.4  
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      9841/python3.4  
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      9841/python3.4  
...

The TCP- and Web-Sockets are listening on 0.0.0.0.