Fix Nmap Script Engine Runtime Error in Ubuntu

August 18, 2009

in Security,ubuntu

I’m sure many of us have installed nmap straight from the Ubuntu repositories.

After running a couple of network scans you noticed it spitting out ugly Script Engine runtime errors. You can temporarily get rid of these errors by disabling the script scan but it requires more work to fix this bug.

I’ve searched online and found that I wasn’t the only person annoyed with this problem. Nmap in the Ubuntu repository is messed up right now. You can view the launchpad thread here. There is a minor revision fix that a user has supplied in a debdiff. What I’m going to show you here is a combination of two things, resolving the nmap script engine runtime error in Ubuntu and also install a debdiff file in Ubuntu. Most of these instructions are derived from Ubuntu wiki.

First step is to install the necessary tools for building packages. Use this command in Ubuntu if you’ve never built a package before:

sudo apt-get install build-essential fakeroot devscripts

From your /tmp directory I would create a temporary staging directory for nmap:

 mkdir nmap

and enter that directory,

cd nmap

then you download the debdiff file from launchpad into the nmap directory we just created:

wget http://launchpadlibrarian.net/21515655/nmap_4.76-0ubuntu2.dsc.debdiff

From here we will download the source code for nmap from the Ubuntu repository,

sudo apt-get source nmap

Then type in this command after you’ve downloaded the source code for nmap:

sudo apt-get build-dep nmap

Now this is where we start adding the changes in the debdiff file.

Enter this command:

cd nmap-*

The asterisk will be dependent on the version of nmap you are working with in Ubuntu. In my case the folder I was changing directories was nmap-4.76

This command will patch the debdiff to the source,

patch p1 < ../nmap_*.debdiff

Now read carefully. After the < ../ You will have to type in the debdiff file here. In my case I am using < ../nmap_4.76-0ubuntu5.debdiff

After that step we will build the the new source package,

sudo debuild -uc -us

Finally, we install the package:

sudo dkpg -i ../nmap_4.76-0ubuntu5_i386.deb

Note that the deb package will be dependent on your version number so please change accordingly.

Here’s an example for my nmap_4.76 installation:


sudo apt-get install fakeroot devscripts
mkdir nmap
cd nmap
wget http://launchpadlibrarian.net/21515655/nmap_4.76-0ubuntu2.dsc.debdiff
sudo apt-get source nmap
sudo apt-get build-dep nmap
cd nmap-4.76
patch p1 < ../nmap_4.76-0ubuntu5.debdiff
sudo debuild -uc -us
sudo dkpg -i ../nmap_4.76-0ubuntu5_i386.deb
Share and Enjoy:
  • Twitter
  • Facebook
  • del.icio.us
  • Digg
  • Google Bookmarks
  • Print
  • email

Related posts:

  1. How To Install GNS3 in Ubuntu 9.04
  2. How To Install Adobe Air in Ubuntu
  3. Ubuntu Notification System Tray Gone

  • vctorgab
    Hello, thanks for this post. I got a problem after the step "cd nmap-*". My version, like yours, is 4.76 but I try to go to the next step and happen this: "bash: ../nmap_4.76-0ubuntu5.debdiff: No existe el fichero ó directorio". I use ls comand for see what i have in the directory nmap-4.76 and i do not have the file: "nmap_4.76-0ubuntu5.debdiff" I have this:

    acinclude.m4 Makefile.in nse_bit.cc portreasons.h
    aclocal.m4 missing nse_bit.h protocols.cc
    CHANGELOG mswin32 nse_debug.cc protocols.h
    charpool.cc nbase nse_debug.h README-WIN32
    charpool.h nmap-4.76-1.spec nse_fs.cc scan_engine.cc
    config.guess nmap_amigaos.h nse_fs.h scan_engine.h
    config.sub nmap.cc nse_hash.cc scripts
    configure nmap_config.h.in nse_hash.h service_scan.cc
    configure.ac nmap_dns.cc nse_init.cc service_scan.h
    COPYING nmap_dns.h nse_init.h services.cc
    COPYING.OpenSSL nmap_error.cc nselib services.h
    debian nmap_error.h nse_macros.h shtool
    depcomp nmap.h nse_main.cc Target.cc
    docs nmap-mac-prefixes nse_main.h TargetGroup.cc
    FingerPrintResults.cc NmapOps.cc nse_nmaplib.cc TargetGroup.h
    FingerPrintResults.h NmapOps.h nse_nmaplib.h Target.h
    global_structures.h nmap-os-db nse_nsock.cc targets.cc
    HACKING NmapOutputTable.cc nse_nsock.h targets.h
    idle_scan.cc NmapOutputTable.h nse_pcrelib.cc tcpip.cc
    idle_scan.h nmap-protocols nse_pcrelib.h tcpip.h
    INSTALL nmap-rpc nsock timing.cc
    libdnet-stripped nmap_rpc.cc osscan2.cc timing.h
    liblua nmap_rpc.h osscan2.h traceroute.cc
    libpcap nmap-service-probes osscan.cc traceroute.h
    libpcre nmap-services osscan.h utils.cc
    ltmain.sh nmap_tty.cc output.cc utils.h
    MACLookup.cc nmap_tty.h output.h zenmap
    MACLookup.h nmap_winconfig.h portlist.cc zenmap-4.76-1.spec
    macosx nse_binlib.cc portlist.h
    main.cc nse_binlib.h portreasons.cc

    But if I use the 'ls' comand in the nmap dir I have this:

    nmap-4.76 nmap_4.76-0ubuntu4.dsc
    nmap_4.76-0ubuntu2.dsc.debdiff nmap_4.76.orig.tar.gz
    nmap_4.76-0ubuntu4.diff.gz

    And I see this file: nmap_4.76-0ubuntu2.dsc.debdiff is the most similar to the file to patch but have the dsc adition. When I try to change the comand for my ubuntu i wrote this:
    patch p1 < ../nmap_4.76-0ubuntu2.dsc.debdiff but did not work.

    Can you help me, please?
  • Thank you for this walk through, it solve the problem I was having and is very easy to follow.
    The only things I had to do a little different were:
    1. I had to download nmap_4.76-0ubuntu5.debdiff
    wget http://launchpadlibrarian.net/29586712/nmap_4.7...
    2. For some reason I had to run the patch command with the "-":
    patch -p1 < ../nmap_4.76-0ubuntu5.debdiff

    With those two minor additions, everything here worked.

    Thanks again!
  • Hi Chris,

    I'm glad it helped you out! Thanks for posting your updates to the walkthrough. Hopefully, the problem will be patched in a newer version.
blog comments powered by Disqus

Previous post:

Next post: