Making the Graphviz module
From OWASP Live CD 2008
Contents |
Get the source for Graphviz
Go to the website for Graphviz and you dig down to the source code or just go directly to the source download page where you can get the latest source and the MD5 sum. At the time of this writing, that's graphviz-2.20.3.tar.gz. We need Graphviz for the w3af GUI.
I used wget to download the source directly onto the Live CD:
# mkdir working
# cd working/
# wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.20.3.tar.gz
--2008-10-27 02:10:45-- http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.20.3.tar.gz
Resolving www.graphviz.org... 192.20.225.20
[snip]
2008-10-27 02:11:23 (350 KB/s) - `graphviz-2.20.3.tar.gz' saved [13381532/13381532]
# wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.20.3.tar.gz.md5
--2008-10-27 02:11:49-- http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.20.3.tar.gz.md5
Resolving www.graphviz.org... 192.20.225.20
[snip]
2008-10-27 02:11:50 (2.46 MB/s) - `graphviz-2.20.3.tar.gz.md5' saved [57/57]
# md5sum graphviz-2.20.3.tar.gz >> graphviz-2.20.3.tar.gz.md5
# cat graphviz-2.20.3.tar.gz.md5
4d94c4b809a5c095acfc973d8d207fa9 graphviz-2.20.3.tar.gz
4d94c4b809a5c095acfc973d8d207fa9 graphviz-2.20.3.tar.gz
Compile the source and create a Slackware package
Since we've got the source into a running version of the Live CD, we can then do the compilation there to make sure the Live CD has all the necessary dependencies. First, unpack the source and run configure to make sure we've got the needed dependencies. If that works, go ahead and run make.
# tar -xzvf graphviz-2.20.3.tar.gz
# cd graphviz-2.20.3/
# ./configure
[ no problems ]
# make
No problems so far. There was a mention of Swig not being present. From my grep through the source, it would appear that w3af isn't using the Python bindings to Graphviz. Lets hope so. Time to try checkinstall and see if it can make a Slackware package for us. If so, its quite easy to convert that to a .lzm package for SLAX & the Live CD:
# checkinstall -S --install=no
[ fails ]
Here's where things get weird. I've not been successful running checkinstall after make. It keeps dying rather quickly. However, if I do a make install then run the checkinstall command, I get a valid package. Its inelegant but it works. I've not had the free time to try and figure out why.
# make install
# checkinstall -S --install=no
[snip]
**********************************************************************
Done. The new package has been saved to
/root/working/graphviz-2.20.3/graphviz-2.20.3-i386-1.tgz
You can install it in your system anytime using:
installpkg graphviz-2.20.3-i386-1.tgz
**********************************************************************
The program 'checkinstall' will run "make install" for you and, with the command line switches above, it will create a Slackware package and not actually install the program thanks to --install=no.
Create a module from the Slackware package
This is the easy part.
# cp graphviz-2.20.3-i386-1.tgz /root # cd /root # tgz2lzm graphviz-2.20.3-i386-1.tgz graphviz-2.20.3.lzm
Copy that .lzm file off the Live CD system (USB drive, scp, ...) so that you don't loose the progress so far.
Test the new modules
Since I had to do a "make install" before I used checkinstall, I'm going to 'reboot' the Live CD to make sure it works as expected on a fresh Live CD boot. Once you've got a fresh Live CD booted, SLAX will allow you to add modules to a running system. Before going on, you should install the modules and make sure it works like expected. Check out the page Add modules to a running system to see how to do this. Verify that Graphviz works as expected:
# dot -V dot - Graphviz version 2.20.3 (Mon Oct 27 02:15:15 UTC 2008)
Since this is a big-ish package, I'm going to remove any cruft from the .lzm package:
# mkdir fakeroot # lzm2dir graphviz-2.20.3.lzm fakeroot/ # rm -rf fakeroot/var/ # rm -rf fakeroot/usr/local/share/graphviz/doc/pdf/ # rm -rf fakeroot/usr/local/share/graphviz/doc/html/ # rm -rf fakeroot/usr/doc/
I went ahead and removed the earlier module and added in the new version to make sure it was OK:
# dot -V dot - Graphviz version 2.20.3 (Mon Oct 27 02:15:15 UTC 2008)
If everything goes as expected, you'll need to add this module to the ISO image. Since we've created the module in the Live CD, you'll need to move it off to a "real" computer. I save both the .lzm modules as well as the Slackware package. The Slackware package is at /root/working/graphviz-2.20.3/graphviz-2.20.3-i386-1.tgz and the newest module will be in the same directory if you've followed the above instructions. You can use a USB drive, scp or whatever to get the files off the Live CD.
Add the modules to the ISO build directory
Also cake
$ cp -i graphviz-2.20.3.lzm ../contents/slax/base/ $ chmod 775 ../contents/slax/base/graphviz-2.20.3.lzm
This assumes your sqlite module was moved into your working directory. See How I created the live CD#Create_a_Working_Directory
Clean up and archive
Once you've got a working module, lets clean up a bit.
$ $ mkdir ./completed_modules/graphviz $ mv graphviz-2.20.3.lzm ./completed_modules/graphviz/ $ mv graphviz-2.20.3-i386-1.tgz ./completed_modules/graphviz/ $ mv temp/graphviz-2.20.3.tar.gz* ./completed_modules/graphviz/ $ rm -rf ./temp/*

