aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--read-proc.scm4
-rwxr-xr-xrun.sh1
-rw-r--r--sample.svg303
4 files changed, 312 insertions, 3 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..953e96a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+File Descriptor Graph
+=====================
+
+Generates a graphviz graph which displays all processes and their open files,
+and draws the graph of all connections.
+
+[![Sample output from a system with barely anything running](../plain/sample.svg)](../plain/sample.svg)
diff --git a/read-proc.scm b/read-proc.scm
index 9eda8d1..a09463e 100644
--- a/read-proc.scm
+++ b/read-proc.scm
@@ -122,8 +122,8 @@
)
loser-files)
-(gv.layout g "neato")
-(gv.render g "dot" "out.dot")
+(gv.layout g "sfdp")
+(gv.render g "svg" "out.svg")
;; (gv.render g "png" "out.png")
diff --git a/run.sh b/run.sh
index c24585b..b6f2568 100755
--- a/run.sh
+++ b/run.sh
@@ -1,3 +1,2 @@
#!/bin/bash
sudo GUILE_LOAD_PATH=. guile -s read-proc.scm
-sfdp -Tsvg out.dot > out.svg
diff --git a/sample.svg b/sample.svg
new file mode 100644
index 0000000..2172e76
--- /dev/null
+++ b/sample.svg
@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 7.1.0 (0)
+ -->
+<!-- Title: test&#45;graph Pages: 1 -->
+<svg width="1626pt" height="1292pt"
+ viewBox="0.00 0.00 1625.93 1291.97" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1287.97)">
+<title>test&#45;graph</title>
+<polygon fill="white" stroke="none" points="-4,4 -4,-1287.97 1621.93,-1287.97 1621.93,4 -4,4"/>
+<!-- /dev/pts/0 -->
+<g id="node1" class="node">
+<title>/dev/pts/0</title>
+<ellipse fill="none" stroke="black" cx="911.94" cy="-437.04" rx="56.59" ry="18"/>
+<text text-anchor="middle" x="911.94" y="-433.34" font-family="Times,serif" font-size="14.00">/dev/pts/0</text>
+</g>
+<!-- 5631: guile -->
+<g id="node2" class="node">
+<title>5631: guile</title>
+<polygon fill="none" stroke="black" points="1031.75,-701.21 934.75,-701.21 934.75,-665.21 1031.75,-665.21 1031.75,-701.21"/>
+<text text-anchor="middle" x="983.25" y="-679.51" font-family="Times,serif" font-size="14.00">5631: guile</text>
+</g>
+<!-- /dev/pts/0&#45;&#45;5631: guile -->
+<g id="edge1" class="edge">
+<title>/dev/pts/0&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M909.78,-455.17C914.39,-500.68 948.39,-618.98 969.69,-664.79"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5631: guile -->
+<g id="edge2" class="edge">
+<title>/dev/pts/0&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M925.29,-455.01C946.54,-500.38 980.64,-618.88 985.38,-664.77"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5631: guile -->
+<g id="edge3" class="edge">
+<title>/dev/pts/0&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M917.19,-455.14C930.34,-500.55 964.64,-618.95 977.9,-664.75"/>
+</g>
+<!-- 5630: sudo -->
+<g id="node3" class="node">
+<title>5630: sudo</title>
+<polygon fill="none" stroke="black" points="372.44,-609.19 277.44,-609.19 277.44,-573.19 372.44,-573.19 372.44,-609.19"/>
+<text text-anchor="middle" x="324.94" y="-587.49" font-family="Times,serif" font-size="14.00">5630: sudo</text>
+</g>
+<!-- /dev/pts/0&#45;&#45;5630: sudo -->
+<g id="edge4" class="edge">
+<title>/dev/pts/0&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M857.79,-442.89C741.29,-465.81 469.12,-537.51 365.74,-572.78"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5630: sudo -->
+<g id="edge5" class="edge">
+<title>/dev/pts/0&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M880.4,-452.23C783.3,-486.78 488.71,-564.48 372.64,-586.59"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5630: sudo -->
+<g id="edge6" class="edge">
+<title>/dev/pts/0&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M867.82,-448.62C760.1,-476.91 484.37,-549.32 372.84,-578.61"/>
+</g>
+<!-- 5629: /bin/bash -->
+<g id="node4" class="node">
+<title>5629: /bin/bash</title>
+<polygon fill="none" stroke="black" points="980.83,-143.96 853.83,-143.96 853.83,-107.96 980.83,-107.96 980.83,-143.96"/>
+<text text-anchor="middle" x="917.33" y="-122.26" font-family="Times,serif" font-size="14.00">5629: /bin/bash</text>
+</g>
+<!-- /dev/pts/0&#45;&#45;5629: /bin/bash -->
+<g id="edge7" class="edge">
+<title>/dev/pts/0&#45;&#45;5629: /bin/bash</title>
+<path fill="none" stroke="black" d="M919.01,-419.09C928.95,-364.26 931.81,-199.4 923.78,-144.2"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5629: /bin/bash -->
+<g id="edge8" class="edge">
+<title>/dev/pts/0&#45;&#45;5629: /bin/bash</title>
+<path fill="none" stroke="black" d="M905.5,-418.85C897.48,-363.85 900.3,-199.63 910.19,-144.36"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;5629: /bin/bash -->
+<g id="edge9" class="edge">
+<title>/dev/pts/0&#45;&#45;5629: /bin/bash</title>
+<path fill="none" stroke="black" d="M912.26,-418.97C913.21,-363.99 916.06,-199.13 917.02,-144.08"/>
+</g>
+<!-- 1: /bin/bash -->
+<g id="node5" class="node">
+<title>1: /bin/bash</title>
+<polygon fill="none" stroke="black" points="1279.93,-443.55 1179.93,-443.55 1179.93,-407.55 1279.93,-407.55 1279.93,-443.55"/>
+<text text-anchor="middle" x="1229.93" y="-421.85" font-family="Times,serif" font-size="14.00">1: /bin/bash</text>
+</g>
+<!-- /dev/pts/0&#45;&#45;1: /bin/bash -->
+<g id="edge10" class="edge">
+<title>/dev/pts/0&#45;&#45;1: /bin/bash</title>
+<path fill="none" stroke="black" d="M953.37,-449.66C1011.44,-455.32 1116.91,-451.92 1179.48,-442.72"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;1: /bin/bash -->
+<g id="edge11" class="edge">
+<title>/dev/pts/0&#45;&#45;1: /bin/bash</title>
+<path fill="none" stroke="black" d="M946.71,-422.48C1003.07,-411.85 1114.63,-407.19 1179.65,-412.17"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;1: /bin/bash -->
+<g id="edge12" class="edge">
+<title>/dev/pts/0&#45;&#45;1: /bin/bash</title>
+<path fill="none" stroke="black" d="M964.62,-429.95C1024.32,-425.67 1120.94,-422.21 1179.64,-422.29"/>
+</g>
+<!-- /dev/pts/0&#45;&#45;1: /bin/bash -->
+<g id="edge13" class="edge">
+<title>/dev/pts/0&#45;&#45;1: /bin/bash</title>
+<path fill="none" stroke="black" d="M967.89,-440.3C1027.81,-440.16 1122.03,-436.69 1179.67,-432.46"/>
+</g>
+<!-- /dev/null -->
+<g id="node6" class="node">
+<title>/dev/null</title>
+<ellipse fill="none" stroke="black" cx="1468.98" cy="-1207.38" rx="50.89" ry="18"/>
+<text text-anchor="middle" x="1468.98" y="-1203.68" font-family="Times,serif" font-size="14.00">/dev/null</text>
+</g>
+<!-- 254: gpg&#45;agent -->
+<g id="node7" class="node">
+<title>254: gpg&#45;agent</title>
+<polygon fill="none" stroke="black" points="1388.67,-1082.55 1263.67,-1082.55 1263.67,-1046.55 1388.67,-1046.55 1388.67,-1082.55"/>
+<text text-anchor="middle" x="1326.17" y="-1060.85" font-family="Times,serif" font-size="14.00">254: gpg&#45;agent</text>
+</g>
+<!-- /dev/null&#45;&#45;254: gpg&#45;agent -->
+<g id="edge14" class="edge">
+<title>/dev/null&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1462.23,-1189.28C1443.45,-1161.64 1393.7,-1110.63 1359.63,-1082.9"/>
+</g>
+<!-- /dev/null&#45;&#45;254: gpg&#45;agent -->
+<g id="edge15" class="edge">
+<title>/dev/null&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1439.85,-1192.5C1405.84,-1165.79 1352.6,-1111.58 1332.97,-1082.72"/>
+</g>
+<!-- /dev/null&#45;&#45;254: gpg&#45;agent -->
+<g id="edge16" class="edge">
+<title>/dev/null&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1451.75,-1190.16C1424.6,-1163 1372.09,-1110.48 1344.36,-1082.74"/>
+</g>
+<!-- pipe:[3631200] -->
+<g id="node8" class="node">
+<title>pipe:[3631200]</title>
+<ellipse fill="none" stroke="black" cx="1017.26" cy="-824.74" rx="81.49" ry="18"/>
+<text text-anchor="middle" x="1017.26" y="-821.04" font-family="Times,serif" font-size="14.00">pipe:[3631200]</text>
+</g>
+<!-- pipe:[3631200]&#45;&#45;5631: guile -->
+<g id="edge17" class="edge">
+<title>pipe:[3631200]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M1017.57,-806.31C1013.89,-779.09 1001.8,-728.48 992.57,-701.4"/>
+</g>
+<!-- pipe:[3631200]&#45;&#45;5631: guile -->
+<g id="edge18" class="edge">
+<title>pipe:[3631200]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M1007.92,-806.49C998.69,-779.39 986.62,-728.87 982.94,-701.66"/>
+</g>
+<!-- pipe:[3630410] -->
+<g id="node9" class="node">
+<title>pipe:[3630410]</title>
+<ellipse fill="none" stroke="black" cx="81.24" cy="-660.86" rx="81.49" ry="18"/>
+<text text-anchor="middle" x="81.24" y="-657.16" font-family="Times,serif" font-size="14.00">pipe:[3630410]</text>
+</g>
+<!-- pipe:[3630410]&#45;&#45;5630: sudo -->
+<g id="edge19" class="edge">
+<title>pipe:[3630410]&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M144.06,-649.08C186.69,-638.17 242.04,-622.17 280.23,-609.62"/>
+</g>
+<!-- pipe:[3630410]&#45;&#45;5630: sudo -->
+<g id="edge20" class="edge">
+<title>pipe:[3630410]&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M119.53,-644.57C162.12,-630.27 231,-610.48 277.11,-599.22"/>
+</g>
+<!-- pipe:[3627382] -->
+<g id="node10" class="node">
+<title>pipe:[3627382]</title>
+<ellipse fill="none" stroke="black" cx="1040.29" cy="-912.76" rx="81.49" ry="18"/>
+<text text-anchor="middle" x="1040.29" y="-909.06" font-family="Times,serif" font-size="14.00">pipe:[3627382]</text>
+</g>
+<!-- pipe:[3627382]&#45;&#45;5631: guile -->
+<g id="edge21" class="edge">
+<title>pipe:[3627382]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M1039.66,-894.6C1033.04,-851.74 1006.52,-744.76 991.92,-701.64"/>
+</g>
+<!-- pipe:[3627382]&#45;&#45;5631: guile -->
+<g id="edge22" class="edge">
+<title>pipe:[3627382]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M1031.7,-894.54C1017.12,-851.6 990.57,-744.52 983.9,-701.51"/>
+</g>
+<!-- pipe:[3627383] -->
+<g id="node11" class="node">
+<title>pipe:[3627383]</title>
+<ellipse fill="none" stroke="black" cx="970.83" cy="-868.75" rx="81.49" ry="18"/>
+<text text-anchor="middle" x="970.83" y="-865.05" font-family="Times,serif" font-size="14.00">pipe:[3627383]</text>
+</g>
+<!-- pipe:[3627383]&#45;&#45;5631: guile -->
+<g id="edge23" class="edge">
+<title>pipe:[3627383]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M976.3,-850.57C982.03,-815.14 987.24,-737.22 986.24,-701.61"/>
+</g>
+<!-- pipe:[3627383]&#45;&#45;5631: guile -->
+<g id="edge24" class="edge">
+<title>pipe:[3627383]&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M967.84,-850.34C966.85,-814.83 972.02,-737.24 977.74,-701.68"/>
+</g>
+<!-- anon_inode:inotify -->
+<g id="node12" class="node">
+<title>anon_inode:inotify</title>
+<ellipse fill="none" stroke="black" cx="1301.78" cy="-1265.97" rx="95.58" ry="18"/>
+<text text-anchor="middle" x="1301.78" y="-1262.27" font-family="Times,serif" font-size="14.00">anon_inode:inotify</text>
+</g>
+<!-- anon_inode:inotify&#45;&#45;254: gpg&#45;agent -->
+<g id="edge25" class="edge">
+<title>anon_inode:inotify&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1308.19,-1247.52C1316.36,-1209.16 1326.98,-1121.21 1328.02,-1082.92"/>
+</g>
+<!-- anon_inode:inotify&#45;&#45;254: gpg&#45;agent -->
+<g id="edge26" class="edge">
+<title>anon_inode:inotify&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1299.92,-1247.61C1300.97,-1209.25 1311.63,-1121 1319.81,-1082.76"/>
+</g>
+<!-- socket:[3574623] -->
+<g id="node13" class="node">
+<title>socket:[3574623]</title>
+<ellipse fill="none" stroke="black" cx="1153.25" cy="-1170.14" rx="90.98" ry="18"/>
+<text text-anchor="middle" x="1153.25" y="-1166.44" font-family="Times,serif" font-size="14.00">socket:[3574623]</text>
+</g>
+<!-- socket:[3574623]&#45;&#45;254: gpg&#45;agent -->
+<g id="edge27" class="edge">
+<title>socket:[3574623]&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1181.8,-1152.71C1213.36,-1133.44 1263.97,-1102.53 1296.12,-1082.9"/>
+</g>
+<!-- /etc/sudoers -->
+<g id="node14" class="node">
+<title>/etc/sudoers</title>
+<ellipse fill="none" stroke="black" cx="92.68" cy="-611.86" rx="67.69" ry="18"/>
+<text text-anchor="middle" x="92.68" y="-608.16" font-family="Times,serif" font-size="14.00">/etc/sudoers</text>
+</g>
+<!-- /etc/sudoers&#45;&#45;5630: sudo -->
+<g id="edge28" class="edge">
+<title>/etc/sudoers&#45;&#45;5630: sudo</title>
+<path fill="none" stroke="black" d="M157.38,-606.1C195.36,-602.72 242.55,-598.52 277.16,-595.44"/>
+</g>
+<!-- socket:[3574621] -->
+<g id="node15" class="node">
+<title>socket:[3574621]</title>
+<ellipse fill="none" stroke="black" cx="1526.94" cy="-1043.18" rx="90.98" ry="18"/>
+<text text-anchor="middle" x="1526.94" y="-1039.48" font-family="Times,serif" font-size="14.00">socket:[3574621]</text>
+</g>
+<!-- socket:[3574621]&#45;&#45;254: gpg&#45;agent -->
+<g id="edge29" class="edge">
+<title>socket:[3574621]&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1446.15,-1051.78C1427.08,-1053.81 1407.03,-1055.94 1388.9,-1057.87"/>
+</g>
+<!-- socket:[3574624] -->
+<g id="node16" class="node">
+<title>socket:[3574624]</title>
+<ellipse fill="none" stroke="black" cx="1135.99" cy="-995.64" rx="90.98" ry="18"/>
+<text text-anchor="middle" x="1135.99" y="-991.94" font-family="Times,serif" font-size="14.00">socket:[3574624]</text>
+</g>
+<!-- socket:[3574624]&#45;&#45;254: gpg&#45;agent -->
+<g id="edge30" class="edge">
+<title>socket:[3574624]&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1180.1,-1011.63C1208.52,-1021.92 1245.56,-1035.35 1275.24,-1046.1"/>
+</g>
+<!-- /dev/urandom -->
+<g id="node17" class="node">
+<title>/dev/urandom</title>
+<ellipse fill="none" stroke="black" cx="1435.13" cy="-895.23" rx="74.99" ry="18"/>
+<text text-anchor="middle" x="1435.13" y="-891.53" font-family="Times,serif" font-size="14.00">/dev/urandom</text>
+</g>
+<!-- /dev/urandom&#45;&#45;254: gpg&#45;agent -->
+<g id="edge31" class="edge">
+<title>/dev/urandom&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1423.47,-913.35C1402.55,-945.85 1358.89,-1013.71 1337.91,-1046.3"/>
+</g>
+<!-- /root/file&#45;descriptor&#45;graph/run.sh -->
+<g id="node18" class="node">
+<title>/root/file&#45;descriptor&#45;graph/run.sh</title>
+<ellipse fill="none" stroke="black" cx="911.43" cy="-18" rx="163.27" ry="18"/>
+<text text-anchor="middle" x="911.43" y="-14.3" font-family="Times,serif" font-size="14.00">/root/file&#45;descriptor&#45;graph/run.sh</text>
+</g>
+<!-- /root/file&#45;descriptor&#45;graph/run.sh&#45;&#45;5629: /bin/bash -->
+<g id="edge32" class="edge">
+<title>/root/file&#45;descriptor&#45;graph/run.sh&#45;&#45;5629: /bin/bash</title>
+<path fill="none" stroke="black" d="M912.43,-36.31C913.52,-56.17 915.24,-87.67 916.33,-107.56"/>
+</g>
+<!-- #f -->
+<g id="node19" class="node">
+<title>#f</title>
+<ellipse fill="none" stroke="black" cx="1087.07" cy="-868.75" rx="27" ry="18"/>
+<text text-anchor="middle" x="1087.07" y="-865.05" font-family="Times,serif" font-size="14.00">#f</text>
+</g>
+<!-- #f&#45;&#45;5631: guile -->
+<g id="edge33" class="edge">
+<title>#f&#45;&#45;5631: guile</title>
+<path fill="none" stroke="black" d="M1077.49,-851.63C1057.97,-816.73 1013.71,-737.64 993.58,-701.66"/>
+</g>
+<!-- socket:[3574622] -->
+<g id="node20" class="node">
+<title>socket:[3574622]</title>
+<ellipse fill="none" stroke="black" cx="1261.38" cy="-873" rx="90.98" ry="18"/>
+<text text-anchor="middle" x="1261.38" y="-869.3" font-family="Times,serif" font-size="14.00">socket:[3574622]</text>
+</g>
+<!-- socket:[3574622]&#45;&#45;254: gpg&#45;agent -->
+<g id="edge34" class="edge">
+<title>socket:[3574622]&#45;&#45;254: gpg&#45;agent</title>
+<path fill="none" stroke="black" d="M1267.59,-891.37C1279.98,-927.98 1307.61,-1009.67 1319.98,-1046.24"/>
+</g>
+</g>
+</svg>