akme / lsofgraph-python

python version of lsof to graphviz parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python version of zevv/lsofgraph

A small utility to convert Unix lsof output to a graph showing FIFO and UNIX interprocess communication.

Generate graph:

sudo lsof -n -F | python lsofgraph.py | dot -Tjpg > /tmp/a.jpg
    OR
sudo lsof -n -F | python lsofgraph.py | dot -T svg > /tmp/a.svg

or add unflatten to the chain for a better layout:

sudo lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T jpg > /tmp/a.jpg
    OR
sudo lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T svg > /tmp/a.svg

example output

Install and use on MacOS

Graphviz contains utilities dot and unflatten

brew install Graphviz
git clone https://github.com/akme/lsofgraph-python.git
cd lsofgraph-python
lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T jpg > /tmp/a.jpg && open /tmp/a.jpg
lsof -n -F | python lsofgraph.py | unflatten -l 1 -c 6 | dot -T svg > /tmp/a.jpg && open -a Safari.app '/tmp/a.svg'

About

python version of lsof to graphviz parser

License:MIT License


Languages

Language:Python 100.0%