Nmap Development mailing list archives

Re: [nmap-svn] r18592 - in nmap-exp/kirubakaran/zenmap: zenmapCore zenmapGUI


From: David Fifield <david () bamsoftware com>
Date: Mon, 5 Jul 2010 12:53:10 -0600

On Mon, Jul 05, 2010 at 11:36:17AM -0700, commit-mailer () insecure org wrote:
Author: kirubakaran
Date: Mon Jul  5 11:36:17 2010
New Revision: 18592

Log:
scriptinterface is addeda new feature to update its widgets by parsing the commandline.When user opens up a profile 
for editing,previous script rules are evaluated using --script-list,then the corresponding check boxesare checked

Modified:
   nmap-exp/kirubakaran/zenmap/zenmapCore/scriptmetadata.py
   nmap-exp/kirubakaran/zenmap/zenmapGUI/ScanHostsView.py
   nmap-exp/kirubakaran/zenmap/zenmapGUI/ScriptInterface.py

Modified: nmap-exp/kirubakaran/zenmap/zenmapGUI/ScriptInterface.py
==============================================================================
--- nmap-exp/kirubakaran/zenmap/zenmapGUI/ScriptInterface.py  (original)
+++ nmap-exp/kirubakaran/zenmap/zenmapGUI/ScriptInterface.py  Mon Jul  5 11:36:17 2010
@@ -1,6 +1,7 @@
 import gtk
 import sys
 import pygtk
+import re
 from zenmapGUI.higwidgets.higwindows import HIGWindow
 from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox, HIGSpacer, hig_box_space_holder
 from zenmapGUI.higwidgets.higlabels import HIGSectionLabel, HIGEntryLabel
@@ -10,27 +11,70 @@
 from zenmapGUI.higwidgets.higtables import HIGTable
 from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog, HIGDialog
 from zenmapCore.scriptmetadata import *
+from zenmapCore.NmapCommand import NmapCommand
+
+def get_script_list(rules):
+    """ Invokes nmap command with --script-list option and retrieves the list of 
+        scripts from given specification"""
+    script_list = []
+    script_expr = re.compile("[0-9a-zA-Z\-]*\.nse")
+    if rules is not None:
+        command_string = "nmap --script "+rules+" --script-list"
+        command = NmapCommand(command_string)
+        command.run_scan()

This looks good. When building the command line, please use NmapOptions
to build the command. Like this:

ops = NmapOptions()
ops["--script"] = rules
ops["--script-list"] = True
command_list = ops.render_string()

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: