Making Maltego CE module

From OWASP Live CD 2008

Jump to: navigation, search

Contents

Get the binary for Maltego CE

Go to the Maltego CE website and there are links to download Maltego CE for various platforms. We'll need the latest one for Linux which is 2-210 currently. The download is a jar file which is really an installer from IzPack - a very nice GPL'ed installer.

Since this is a binary with an installer, we're going to do everything on a running Live CD and then create a module based on what the installer leaves behind. The method I use can be done for any installation that doesn't use the native package management system so its just all around handy. Another thing to note is that this is a departure from the rest of the software on the OWASP Live CD. Unfortunately, there are no other competing products with an open source license. Just so you know, here's what the vendors site says about the CE version:

  • A 15 second nag screen
  • Save and Export has been disabled
  • Limited zoom levels
  • Can only run transforms on a single entity at a time
  • Cannot copy and paste text from detailed view
  • Transforms limited to 75 per day
  • Throttled client to TAS communication

Do an install inside a running OWASP Live CD

This is the easy part. First, get a list of what the file system looks like before the install, then run the installer: Note: I told the installer to install into /opt/owasp/maltego to make my life easier.

 # find / > pre-maltego
 # java -jar MaltegoInstaller-v2-210-CE.jar
     [wow a GUI installer and everything ; ) ]
 # find / > post-maltego
 # diff pre-maltego post-maltego > diff-maltego
 # cat diff-maltego | grep changes > maltego-install
 # vi maltego-install
     [remove any cruft and modify to copy the installed files to /root/fakeroot]
 # cat maltego-install
mkdir -p /root/fakeroot/opt/owasp
cp -a /opt/owasp/MaltegoCE /root/fakeroot/opt/owasp
# manually pull one these and create my own .desktop file
#> /mnt/live/memory/changes/root/.local/share/applications/Maltego CE-1233173677071.desktop
#> /mnt/live/memory/changes/root/.local/share/applications/Maltego CE-1233173676875.desktop
#> /mnt/live/memory/changes/root/.local/share/applications/Maltego CE-1233173676629.desktop

So the install is pretty clean. There's a ton of stuff in /opt/owasp/MaltegoCE and three .desktop files - which ironically are all the same. Shame on you installer.

Create the needed directories in fakeroot

Eventually, we'll use dir2lzm to make the module, so lets get the directories created that we need:

 # mkdir -p ./fakeroot/opt/owasp/
 # mkdir -p ./fakeroot/usr/bin
 # mkdir -p ./fakeroot/usr/share/aplications

Create and put the module's files into the fakeroot directory

Since we most of the application's files are in /opt/owasp/MaltegoCE, lets move those first:

 # mv /opt/owasp/MaltegoCD fakeroot/opt/owasp/

Next, well need a script to start MaltegoCE in fakeroot/usr/bin. This one is very easy:

 # vi fakeroot/usr/bin/maltego
   [create script]
 # cat fakeroot/usr/bin/maltego
#!/bin/sh

/opt/owasp/MaltegoCE/bin/maltego

Maltego's install gave us 3 example menu files so we're going to copy one - making minor changes where it makes sense:

 # cp .local/share/applications/Maltego\ CE-1233173676629.desktop fakeroot/usr/share/applications/maltego.desktop
#  vi fakeroot/usr/share/applications/maltego.desktop
   [create the file]
 $ cat fakeroot/usr/share/applications/maltego.desktop 
[Desktop Entry]
Categories=Application;Network
Comment=Maltego CE
Encoding=UTF-8
Exec=/opt/owasp/MaltegoCE/bin/maltego 
GenericName=Maltego CE
Icon=/opt/owasp/MaltegoCE/res/Icon32.png
MimeType=
Name=Information Gathering
Path=/opt/owasp/MaltegoCE/bin
Type=Application
X-KDE-StartupNotify=True
X-KDE-SubstituteUID=falser

The icon came with the install so nothing to do there.

Everything is in place to create the modules, a quick final check:

find fakeroot
fakeroot/
fakeroot/opt
fakeroot/opt/owasp
fakeroot/opt/owasp/MaltegoCE
 ...

Generate the .lzm module

This is the easy part.

 $ ./dir2lzm ./fakeroot maltego-CE-2-210.lzm

Add the modules to the ISO build directory

Also cake

 $ cp -i maltego-CE-2-210.lzm ../contents/slax/base/
 $ chmod 775 ../contents/slax/base/maltego-CE-2-210.lzm

Test the new module

I like scp'ing the new modules into a running Live CD and using the Module Manager to Add modules to a running system. I typically have the Live CD running in a VM while I create modules so its already up and ready.

You can also gen a new ISO and run it in a VM of your choice.

 $ cd ../contents/slax/
$  ./make_iso.sh /home/mtesauro/isos/new-owasp.iso

If anything doesn't work as expected, make the changes needed to ./fakeroot and try again.

Clean up and archive

Once you've got a working module, lets clean up a bit.

 $ $ mkdir ./completed_modules/maltego
 $ mv maltego-CE-2-210.lzm ./completed_modules/maltego/
 $ mv temp/MaltegoInstaller-v2-210-CE.jar ./completed_modules/maltego/
 $ rm -rf ./temp/*

I usually delete anything under ./fakeroot also.

 $ rm -rf ./fakeroot/*