From be24e6d5c4004fa0807b3cbe17e5ad20f2932b47 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 19 Jun 2012 17:10:58 +0000 Subject: [PATCH] Catch exceptions when running a sub-Nmap in the profile editor. --- CHANGELOG | 3 +++ zenmap/zenmapGUI/ScriptInterface.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 6532be847..d1fe6de4c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [Zenmap] Fixed a crash in the profile editor that would happen when + the nmap binary couldn't be found. [David Fifield] + o Made the various Makefiles' treatment of makefile.dep uniform: "make clean" keeps the file and "make distclean" deletes it. [Michael McTernan] diff --git a/zenmap/zenmapGUI/ScriptInterface.py b/zenmap/zenmapGUI/ScriptInterface.py index de2aacce4..d316c2e25 100644 --- a/zenmap/zenmapGUI/ScriptInterface.py +++ b/zenmap/zenmapGUI/ScriptInterface.py @@ -251,7 +251,12 @@ There was an error getting the list of scripts from Nmap. Try upgrading Nmap.\ stderr = tempfile.TemporaryFile(mode = "rb", prefix = APP_NAME + "-script-help-stderr-") log.debug("Script interface: running %s" % repr(command_string)) nmap_process = NmapCommand(command_string) - nmap_process.run_scan(stderr = stderr) + try: + nmap_process.run_scan(stderr = stderr) + except Exception, e: + callback(False, None) + stderr.close() + return stderr.close() self.script_list_widget.set_sensitive(False)