mirror of
https://github.com/nmap/nmap.git
synced 2026-01-10 00:19:02 +00:00
Some minor misc. fixes from Marek Majkowski and Kris Katterjohn
This commit is contained in:
@@ -28,9 +28,15 @@ o Fixed a bug in the rDNS system which prevented us from querying
|
||||
certain authoritative DNS servers which have recursion explicitly
|
||||
disabled. Thanks to Doug Hoyte for the patch.
|
||||
|
||||
o --packet-trace now reports TCP options (thanks to Zhao Lei for the
|
||||
patch).
|
||||
|
||||
o Cleaned up Nmap DNS reporting to be a little more useful and
|
||||
concise. Thanks to Doug Hoyte for the patch.
|
||||
|
||||
o Applied a bunch of small internal cleanup patches by Kris Katterjohn
|
||||
(kjak(a)ispwest.com).
|
||||
|
||||
o Fixed the 'distclean' make target to be more comprehensive. Thanks
|
||||
to Thomas Buchanan (Thomas.Buchanan(a)thecompassgrp.net) for the
|
||||
patch.
|
||||
|
||||
@@ -153,6 +153,7 @@ void mac_prefix_init() {
|
||||
fp = fopen(filename, "r");
|
||||
if (!fp) {
|
||||
error("Unable to open %s. Ethernet vendor correlation will not be performed ", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
while(fgets(line, sizeof(line), fp)) {
|
||||
|
||||
@@ -254,8 +254,8 @@ static int ipid_distance(int seqclass , u16 startid, u16 endid) {
|
||||
|
||||
if (seqclass == IPID_SEQ_BROKEN_INCR) {
|
||||
/* Convert to network byte order */
|
||||
startid = (startid >> 8) + ((startid & 0xFF) << 8);
|
||||
endid = (endid >> 8) + ((endid & 0xFF) << 8);
|
||||
startid = htons(startid);
|
||||
endid = htons(endid);
|
||||
return endid - startid;
|
||||
}
|
||||
|
||||
|
||||
32
nmap_tty.cc
32
nmap_tty.cc
@@ -175,14 +175,12 @@ static int tty_getchar()
|
||||
|
||||
static void tty_done()
|
||||
{
|
||||
int fd;
|
||||
|
||||
if (!tty_fd) return;
|
||||
|
||||
fd = tty_fd; tty_fd = 0;
|
||||
tcsetattr(fd, TCSANOW, &saved_ti);
|
||||
tcsetattr(tty_fd, TCSANOW, &saved_ti);
|
||||
|
||||
close(fd);
|
||||
close(tty_fd);
|
||||
tty_fd = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -192,28 +190,26 @@ static void tty_done()
|
||||
*/
|
||||
void tty_init()
|
||||
{
|
||||
int fd;
|
||||
struct termios ti;
|
||||
|
||||
if ((fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) return;
|
||||
if (tty_fd)
|
||||
return;
|
||||
|
||||
if ((tty_fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) return;
|
||||
|
||||
#ifndef __CYGWIN32__
|
||||
if (tcgetpgrp(fd) != getpid()) {
|
||||
close(fd); return;
|
||||
if (tcgetpgrp(tty_fd) != getpid()) {
|
||||
close(tty_fd); return;
|
||||
}
|
||||
#endif
|
||||
|
||||
tcgetattr(fd, &ti);
|
||||
if (tty_fd == 0)
|
||||
saved_ti = ti;
|
||||
tcgetattr(tty_fd, &ti);
|
||||
saved_ti = ti;
|
||||
ti.c_lflag &= ~(ICANON | ECHO);
|
||||
ti.c_cc[VMIN] = 1;
|
||||
ti.c_cc[VTIME] = 0;
|
||||
tcsetattr(fd, TCSANOW, &ti);
|
||||
tcsetattr(tty_fd, TCSANOW, &ti);
|
||||
|
||||
if (tty_fd == 0)
|
||||
tty_fd = fd;
|
||||
|
||||
atexit(tty_done);
|
||||
}
|
||||
|
||||
@@ -251,10 +247,10 @@ bool keyWasPressed()
|
||||
log_write(LOG_STDOUT, "Debugging Decreased to %d.\n", o.debugging);
|
||||
} else if (c == 'p') {
|
||||
o.setPacketTrace(true);
|
||||
log_write(LOG_STDOUT, "Packet Tracing enabled\n.");
|
||||
log_write(LOG_STDOUT, "Packet Tracing enabled.\n");
|
||||
} else if (c == 'P') {
|
||||
o.setPacketTrace(false);
|
||||
log_write(LOG_STDOUT, "Packet Tracing disabled\n.");
|
||||
log_write(LOG_STDOUT, "Packet Tracing disabled.\n");
|
||||
} else if (c == '?') {
|
||||
log_write(LOG_STDOUT,
|
||||
"Interactive keyboard commands:\n"
|
||||
|
||||
@@ -2841,6 +2841,8 @@ OsScanInfo::OsScanInfo(vector<Target *> &Targets) {
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
numInitialTargets=0;
|
||||
|
||||
/* build up incompleteHosts list */
|
||||
for(targetno = 0; targetno < Targets.size(); targetno++) {
|
||||
/* check if Targets[targetno] is good to be scanned
|
||||
|
||||
@@ -268,7 +268,6 @@ int Port::getServiceDeductions(struct serviceDeductions *sd) {
|
||||
char* Port::cstringSanityCheck(const char* string, int len) {
|
||||
char* result;
|
||||
int slen;
|
||||
unsigned char *p;
|
||||
|
||||
if(!string)
|
||||
return NULL;
|
||||
@@ -278,10 +277,7 @@ char* Port::cstringSanityCheck(const char* string, int len) {
|
||||
result = (char *) safe_malloc(slen + 1);
|
||||
memcpy(result, string, slen);
|
||||
result[slen] = '\0';
|
||||
p = (unsigned char *) result;
|
||||
while(*p) {
|
||||
if (!isprint((int)*p)) *p = '.';
|
||||
p++;
|
||||
replacenonprintable(result, strlen(result), '.');
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
2
tcpip.cc
2
tcpip.cc
@@ -714,7 +714,7 @@ void PacketTrace::traceConnect(u8 proto, const struct sockaddr *sock,
|
||||
assert(sin->sin_family == AF_INET6);
|
||||
if (inet_ntop(sin->sin_family, (char *) &sin6->sin6_addr, targetipstr,
|
||||
sizeof(targetipstr)) == NULL)
|
||||
fatal("Failed to convert target IPv4 address to presentation format!?!");
|
||||
fatal("Failed to convert target IPv6 address to presentation format!?!");
|
||||
targetport = ntohs(sin6->sin6_port);
|
||||
#else
|
||||
assert(0);
|
||||
|
||||
Reference in New Issue
Block a user