mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Change default output mode to show TTL info with --reason directly (no need of --reason -v). Also, remove TTL column and move TTL info to REASON column. See http://seclists.org/nmap-dev/2014/q3/289 for discussion on this
This commit is contained in:
@@ -346,7 +346,6 @@ void NmapOps::Initialize() {
|
||||
gettimeofday(&start_time, NULL);
|
||||
pTrace = vTrace = false;
|
||||
reason = false;
|
||||
show_ttl = false;
|
||||
adler32 = false;
|
||||
if (datadir) free(datadir);
|
||||
datadir = NULL;
|
||||
|
||||
@@ -366,7 +366,6 @@ class NmapOps {
|
||||
|
||||
bool traceroute;
|
||||
bool reason;
|
||||
bool show_ttl;
|
||||
bool adler32;
|
||||
FILE *excludefd;
|
||||
char *exclude_spec;
|
||||
|
||||
3
nmap.cc
3
nmap.cc
@@ -1465,9 +1465,6 @@ void apply_delayed_options() {
|
||||
if (o.verbose > 1)
|
||||
o.reason = true;
|
||||
|
||||
if (o.verbose && o.reason)
|
||||
o.show_ttl = true;
|
||||
|
||||
// ISO 8601 date/time -- http://www.cl.cam.ac.uk/~mgk25/iso-time.html
|
||||
if (strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M %Z", local_time) <= 0)
|
||||
fatal("Unable to properly format time");
|
||||
|
||||
25
output.cc
25
output.cc
@@ -553,7 +553,6 @@ void printportoutput(Target *currenths, PortList *plist) {
|
||||
int servicecol = -1; // service or protocol name
|
||||
int versioncol = -1;
|
||||
int reasoncol = -1;
|
||||
int ttlcol = -1;
|
||||
int colno = 0;
|
||||
unsigned int rowno;
|
||||
int numrows;
|
||||
@@ -666,8 +665,6 @@ void printportoutput(Target *currenths, PortList *plist) {
|
||||
servicecol = colno++;
|
||||
if (o.reason)
|
||||
reasoncol = colno++;
|
||||
if (o.show_ttl)
|
||||
ttlcol = colno++;
|
||||
if (o.servicescan)
|
||||
versioncol = colno++;
|
||||
|
||||
@@ -696,8 +693,6 @@ void printportoutput(Target *currenths, PortList *plist) {
|
||||
Tbl->addItem(0, versioncol, false, "VERSION", 7);
|
||||
if (reasoncol > 0)
|
||||
Tbl->addItem(0, reasoncol, false, "REASON", 6);
|
||||
if (ttlcol > 0)
|
||||
Tbl->addItem(0, ttlcol, false, "TTL", 3);
|
||||
|
||||
log_write(LOG_MACHINE, "\t%s: ", (o.ipprotscan) ? "Protocols" : "Ports");
|
||||
|
||||
@@ -710,10 +705,13 @@ void printportoutput(Target *currenths, PortList *plist) {
|
||||
log_write(LOG_MACHINE, ", ");
|
||||
else
|
||||
first = 0;
|
||||
if (o.reason)
|
||||
if (o.reason) {
|
||||
if (current->reason.ttl)
|
||||
Tbl->addItemFormatted(rowno, reasoncol, false, "%s ttl %d",
|
||||
port_reason_str(current->reason), current->reason.ttl);
|
||||
else
|
||||
Tbl->addItem(rowno, reasoncol, true, port_reason_str(current->reason));
|
||||
if (o.show_ttl)
|
||||
Tbl->addItemFormatted(rowno, ttlcol, false, "%d", current->reason.ttl);
|
||||
}
|
||||
state = statenum2str(current->state);
|
||||
proto = nmap_getprotbynum(current->portno);
|
||||
Snprintf(portinfo, sizeof(portinfo), "%s", proto ? proto->p_name : "unknown");
|
||||
@@ -772,10 +770,13 @@ void printportoutput(Target *currenths, PortList *plist) {
|
||||
Tbl->addItem(rowno, portcol, true, portinfo);
|
||||
Tbl->addItem(rowno, statecol, false, state);
|
||||
Tbl->addItem(rowno, servicecol, true, serviceinfo);
|
||||
if (o.reason)
|
||||
if (o.reason) {
|
||||
if (current->reason.ttl)
|
||||
Tbl->addItemFormatted(rowno, reasoncol, false, "%s ttl %d",
|
||||
port_reason_str(current->reason), current->reason.ttl);
|
||||
else
|
||||
Tbl->addItem(rowno, reasoncol, true, port_reason_str(current->reason));
|
||||
if (o.show_ttl)
|
||||
Tbl->addItemFormatted(rowno, ttlcol, false, "%d", current->reason.ttl);
|
||||
}
|
||||
|
||||
sd.populateFullVersionString(fullversion, sizeof(fullversion));
|
||||
if (*fullversion && versioncol > 0)
|
||||
@@ -1484,7 +1485,7 @@ void write_host_status(Target *currenths) {
|
||||
log_write(LOG_PLAIN, "Host is up");
|
||||
if (o.reason)
|
||||
log_write(LOG_PLAIN, ", %s", target_reason_str(currenths));
|
||||
if (o.show_ttl)
|
||||
if (o.reason && currenths->reason.ttl)
|
||||
log_write(LOG_PLAIN, " TTL %d", currenths->reason.ttl);
|
||||
if (currenths->to.srtt != -1)
|
||||
log_write(LOG_PLAIN, " (%ss latency)",
|
||||
|
||||
Reference in New Issue
Block a user