1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 23:49:03 +00:00

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
This commit is contained in:
fyodor
2009-11-25 01:23:34 +00:00
parent 5e9c3dea5a
commit b8d10b7154

View File

@@ -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");