Nmap Development mailing list archives

Re: Nmap tty and NSE


From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Tue, 23 Dec 2008 07:08:31 -0700

On Mon, Dec 22, 2008 at 8:48 AM, David Fifield <david () bamsoftware com> wrote:
What sort of changes? Is it possible to simply give up control of the
TTY before the debug session and regain it afterward?

I don't know exactly what must be done. I only know that the current
system of checking if a key was pressed (keyWasPressed()) is the only
official way to check input right now.

Am I right in supposing that, the method of invoking the debugger aside,
some sort of TTY changes would be needed for any kind of interactive
debugging? If the debugger were started after a certain amount of time,
or programmatically by a library watching for a certain condition.

From my experience, debug.debug() does actually work but you don't see
anything you input. This isn't unusual as apparently stdin does not
echo to stdout in Nmap like many applications (set in tty_init). We
should be able to change this without much difficulty when toggling
between modes (debugging <-> default) by modifying the terminal
attributes. Although to maintain portability, this could quickly
become a mess.

--

I have attached a patch that outputs script threads when they start
and when they finish. This is some example output with debugging = 1.

SCRIPT ENGINE: Initiating script scanning.
SCRIPT ENGINE: Script scanning 100 hosts.
SCRIPT ENGINE: Initialized 24 rules
SCRIPT ENGINE: Matching rules.
SCRIPT ENGINE: Running scripts.
SCRIPT ENGINE: Runlevel: 1.000000
Initiating SCRIPT ENGINE at 06:42
Running 14 script threads:
Starting script './scripts/robots.txt.nse' (thread 0x845ad30) against
target 95.78.76.91.
Starting script './scripts/http-auth.nse' (thread 0x84391f8) against
target 95.78.76.91.
Starting script './scripts/html-title.nse' (thread 0x843a6a8) against
target 95.78.76.91.
Starting script './scripts/ssh-hostkey.nse' (thread 0x848c3c8) against
target 129.131.227.244.
Starting script './scripts/sshv1.nse' (thread 0x8496558) against
target 129.131.227.244.
Starting script './scripts/http-auth.nse' (thread 0x849efd8) against
target 129.131.227.244.
Starting script './scripts/html-title.nse' (thread 0x84a04d0) against
target 129.131.227.244.
Starting script './scripts/sslv2.nse' (thread 0x84a12c0) against
target 129.131.227.244.
Starting script './scripts/robots.txt.nse' (thread 0x84aec68) against
target 210.136.139.173.
Starting script './scripts/http-auth.nse' (thread 0x84b3fe8) against
target 210.136.139.173.
Starting script './scripts/html-title.nse' (thread 0x84b5498) against
target 210.136.139.173.
Starting script './scripts/http-auth.nse' (thread 0x84bbc08) against
target 210.136.139.173.
Starting script './scripts/html-title.nse' (thread 0x84bd190) against
target 210.136.139.173.
Starting script './scripts/sslv2.nse' (thread 0x84bdfd0) against
target 210.136.139.173.
Finished script './scripts/http-auth.nse' (thread 0x849efd8) against
target 129.131.227.244.
SCRIPT ENGINE DEBUG: html-title.nse: 129.131.227.244 did not respond
with any data.
Finished script './scripts/html-title.nse' (thread 0x84a04d0) against
target 129.131.227.244.
Finished script './scripts/sshv1.nse' (thread 0x8496558) against
target 129.131.227.244.
Finished script './scripts/sslv2.nse' (thread 0x84a12c0) against
target 129.131.227.244.
Finished script './scripts/ssh-hostkey.nse' (thread 0x848c3c8) against
target 129.131.227.244.
Finished script './scripts/robots.txt.nse' (thread 0x84aec68) against
target 210.136.139.173.
Finished script './scripts/http-auth.nse' (thread 0x84b3fe8) against
target 210.136.139.173.
SCRIPT ENGINE DEBUG: html-title.nse: 210.136.139.173 did not respond
with any data.
Finished script './scripts/html-title.nse' (thread 0x84bd190) against
target 210.136.139.173.
Finished script './scripts/sslv2.nse' (thread 0x84bdfd0) against
target 210.136.139.173.
Finished script './scripts/http-auth.nse' (thread 0x84bbc08) against
target 210.136.139.173.
Finished script './scripts/html-title.nse' (thread 0x84b5498) against
target 210.136.139.173.
Finished script './scripts/html-title.nse' (thread 0x843a6a8) against
target 95.78.76.91.
Finished script './scripts/robots.txt.nse' (thread 0x845ad30) against
target 95.78.76.91.
Finished script './scripts/http-auth.nse' (thread 0x84391f8) against
target 95.78.76.91.
Completed SCRIPT ENGINE at 06:42, 11.57s elapsed
SCRIPT ENGINE: Script scanning completed.

Comments welcome!

Cheers,

-- 
-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."

-Will Durant

Attachment: nse_instances.patch
Description:


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

Current thread: