From b8d10b71543e7b06f8aa24e2c5de71e9664dc607 Mon Sep 17 00:00:00 2001 From: fyodor Date: Wed, 25 Nov 2009 01:23:34 +0000 Subject: [PATCH] Reduce the first level of NSE indention to 2 spaces rather than three. This corresponds to the 2 spaces now used in Ron's stdnse.format_output function for further levels of indentation. The first level is still special in that it contains "| " or "|_" rather than just spaces. Here is example output from before this change: 2049/tcp open rpcbind 8080/tcp open http Apache httpd 2.2.13 ((Fedora)) |_ http-favicon: Unknown favicon MD5: 5A49412557709B4EDF6BBA9A1710B418 |_ html-title: Insecure.Org - Nmap Free Security Scanner, Tools & Hacking res... |_ http-open-proxy: Proxy might be redirecting requests 8081/tcp open http Apache httpd 2.2.13 ((Fedora)) | html-title: 302 Found |_ Did not follow redirect to http://seclists.org/ 8082/tcp open http Apache httpd 2.2.13 ((Fedora)) |_ html-title: Nmap - Free Security Scanner For Network Exploration & Securit... |_ http-favicon: Apache Web Server (seen on SuSE, Linux Tux favicon) Device type: general purpose [...] ost script results: | smb-os-discovery: | OS: Unix (Samba 3.4.2-0.42.fc11) | Name: Unknown\Unknown |_ System time: 2009-11-24 17:18:49 UTC-8 |_ smbv2-enabled: Server doesn't support SMBv2 protocol And after the change: 2049/tcp open rpcbind 8080/tcp open http Apache httpd 2.2.13 ((Fedora)) |_html-title: Insecure.Org - Nmap Free Security Scanner, Tools & Hacking res... |_http-favicon: Unknown favicon MD5: 5A49412557709B4EDF6BBA9A1710B418 8081/tcp open http Apache httpd 2.2.13 ((Fedora)) | html-title: 302 Found |_Did not follow redirect to http://seclists.org/ 8082/tcp open http Apache httpd 2.2.13 ((Fedora)) |_http-favicon: Apache Web Server (seen on SuSE, Linux Tux favicon) |_html-title: Nmap - Free Security Scanner For Network Exploration & Securit... Device type: general purpose ... Host script results: | smb-os-discovery: | OS: Unix (Samba 3.4.2-0.42.fc11) | Name: Unknown\Unknown |_ System time: 2009-11-24 17:19:21 UTC-8 |_smbv2-enabled: Server doesn't support SMBv2 protocol --- output.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output.cc b/output.cc index 9433986ea..88a6b876c 100644 --- a/output.cc +++ b/output.cc @@ -500,7 +500,7 @@ static char *formatScriptOutput(ScriptResult sr) { char *c_result, *c_output = new char[output.length() + 1]; strncpy(c_output, output.c_str(), output.length() + 1); int line = 0; - std::string line_prfx = "| "; + std::string line_prfx = "| "; char *token = strtok(c_output, "\n"); @@ -516,7 +516,7 @@ static char *formatScriptOutput(ScriptResult sr) { // fix the last line pos = result.rfind(line_prfx); - result.replace(pos, 3, "|_ "); + result.replace(pos, 2, "|_"); // delete the unwanted trailing newline pos = result.rfind("\n");