1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Applied a patch by Kris Katterjohn which makes 14 functions static

This commit is contained in:
fyodor
2006-08-29 04:03:03 +00:00
parent fb68addf2a
commit 2140dfb00f
7 changed files with 69 additions and 66 deletions

View File

@@ -2,7 +2,9 @@
4.20ALPHA5 4.20ALPHA5
o Worked with Zhao to improve the new OS detection system with o Worked with Zhao to improve the new OS detection system with
better algorithms, some probe changes, and some bug fixes. better algorithms, some probe changes, and some bug fixes. We're
now ready to start growing the new database! If Nmap gives you
fingerprints, please submit them at the given URL.
o Nmap now supports IP options with the new --ip-options flag. You o Nmap now supports IP options with the new --ip-options flag. You
can specify any optiosn in hex, or use "R" (record route), "T" can specify any optiosn in hex, or use "R" (record route), "T"
@@ -13,6 +15,11 @@ o Nmap now supports IP options with the new --ip-options flag. You
http://seclists.org/nmap-dev/2006/q3/0052.html . Thanks to Marek http://seclists.org/nmap-dev/2006/q3/0052.html . Thanks to Marek
Majkowski for writing and sending the patch. Majkowski for writing and sending the patch.
o Integrated all 2nd quarter service detection fingerprint
submissions. Please keep them coming! We now have 3,671 signatures
representing 415 protocols. Thanks to version detection czar Doug
Hoyte for doing this.
o Nmap now uses the (relatively) new libpcap pcap_get_selectable_fd o Nmap now uses the (relatively) new libpcap pcap_get_selectable_fd
API on systems which support it. This means that we no longer need API on systems which support it. This means that we no longer need
to hack the included Pcap to better support Linux. So Nmap will now to hack the included Pcap to better support Linux. So Nmap will now
@@ -24,26 +31,23 @@ o Updated the included libpcap from 0.9.3 to 0.9.4. The changes I
use the included libpcap unless version 0.9.4 or greater is already use the included libpcap unless version 0.9.4 or greater is already
installed on the system. installed on the system.
o Applied some nsock bugfixes from Diman Todorov. These don't o Applied some nsock bugfixes from Diman Todorov. These don't affect
affect the current version of Nmap, but are important for his upcoming the current version of Nmap, but are important for his Nmap
Nmap Scripting Engine. Scripting Engine, which I hope to integrate into mainline Nmap in
September.
o Fixed a bug which would occasionally cause Nmap to crash with the o Fixed a bug which would occasionally cause Nmap to crash with the
message "log_vwrite: write buffer not large enough". I thought I message "log_vwrite: write buffer not large enough". I thought I
conquered it in a previous release -- thanks to Doug Hoyte for finding a conquered it in a previous release -- thanks to Doug Hoyte for finding a
corner case which proved me wrong. corner case which proved me wrong.
o Integrated all 2nd quarter service detection fingerprint
submissions. Please keep them coming! We now have 3,671 signatures
representing 415 protocols. Thanks to version detection czar Doug
Hoyte for doing this.
o Fixed a bug in the rDNS system which prevented us from querying o Fixed a bug in the rDNS system which prevented us from querying
certain authoritative DNS servers which have recursion explicitly certain authoritative DNS servers which have recursion explicitly
disabled. Thanks to Doug Hoyte for the patch. disabled. Thanks to Doug Hoyte for the patch.
o --packet-trace now reports TCP options (thanks to Zhao Lei for the o --packet-trace now reports TCP options (thanks to Zhao Lei for the
patch). patch). Thanks to the --ip-options addition also found in this
release, IP options are printed too.
o Cleaned up Nmap DNS reporting to be a little more useful and o Cleaned up Nmap DNS reporting to be a little more useful and
concise. Thanks to Doug Hoyte for the patch. concise. Thanks to Doug Hoyte for the patch.

View File

@@ -128,7 +128,7 @@ static inline int MACTableHash(int prefix, int table_capacity) {
return prefix % table_capacity; return prefix % table_capacity;
} }
void mac_prefix_init() { static void mac_prefix_init() {
static int initialized = 0; static int initialized = 0;
if (initialized) return; if (initialized) return;
initialized = 1; initialized = 1;

View File

@@ -291,7 +291,7 @@ static ScanProgressMeter *SPM;
//------------------- Prototypes and macros --------------------- //------------------- Prototypes and macros ---------------------
void put_dns_packet_on_wire(request *req); static void put_dns_packet_on_wire(request *req);
#define ACTION_FINISHED 0 #define ACTION_FINISHED 0
#define ACTION_CNAME_LIST 1 #define ACTION_CNAME_LIST 1
@@ -391,7 +391,7 @@ static void write_evt_handler(nsock_pool nsp, nsock_event evt, void *req_v) {
// Takes a DNS request structure and actually puts it on the wire // Takes a DNS request structure and actually puts it on the wire
// (calls nsock_write()). Does various other tasks like recording // (calls nsock_write()). Does various other tasks like recording
// the time for the timeout. // the time for the timeout.
void put_dns_packet_on_wire(request *req) { static void put_dns_packet_on_wire(request *req) {
char packet[512]; char packet[512];
int plen=0; int plen=0;
u32 ip; u32 ip;
@@ -593,7 +593,7 @@ static u32 parse_inaddr_arpa(unsigned char *buf, int maxlen) {
// Turns a DNS packet encoded name (see the RFC) and turns it into // Turns a DNS packet encoded name (see the RFC) and turns it into
// a normal decimal separated hostname. // a normal decimal separated hostname.
// ASSUMES NAME LENGTH/VALIDITY HAS ALREADY BEEN VERIFIED // ASSUMES NAME LENGTH/VALIDITY HAS ALREADY BEEN VERIFIED
int encoded_name_to_normal(unsigned char *buf, char *output, int outputsize){ static int encoded_name_to_normal(unsigned char *buf, char *output, int outputsize){
while (buf[0]) { while (buf[0]) {
if (buf[0] >= outputsize-1) return -1; if (buf[0] >= outputsize-1) return -1;
memcpy(output, buf+1, buf[0]); memcpy(output, buf+1, buf[0]);
@@ -834,7 +834,7 @@ void free_dns_servers() {
// Creates a new nsi for each DNS server // Creates a new nsi for each DNS server
void connect_dns_servers() { static void connect_dns_servers() {
std::list<dns_server *>::iterator serverI; std::list<dns_server *>::iterator serverI;
dns_server *s; dns_server *s;

View File

@@ -156,6 +156,37 @@ static void skid_output(char *s)
} }
} }
/* Remove all "\nSF:" from fingerprints */
static char* xml_sf_convert (const char* str) {
char *temp = (char *) safe_malloc(strlen(str) + 1);
char *dst = temp, *src = (char *)str;
char *ampptr = 0;
int charcount = 0;
while(*src && charcount < 2035) { /* 2048 - 14 */
if (strncmp(src, "\nSF:", 4) == 0) {
src += 4;
continue;
}
/* Needed so "&something;" is not truncated midway */
if (*src == '&') {
ampptr = dst;
}
else if (*src == ';') {
ampptr = 0;
}
*dst++ = *src++;
charcount++;
}
if (ampptr != 0) {
*ampptr = '\0';
}
else {
*dst = '\0';
}
return temp;
}
// Creates an XML <service> element for the information given in // Creates an XML <service> element for the information given in
// serviceDeduction. It will be 0-length if none is neccessary. // serviceDeduction. It will be 0-length if none is neccessary.
@@ -749,37 +780,6 @@ void log_vwrite(int logt, const char *fmt, va_list ap) {
return; return;
} }
/* Remove all "\nSF:" from fingerprints */
char* xml_sf_convert (const char* str) {
char *temp = (char *) safe_malloc(strlen(str) + 1);
char *dst = temp, *src = (char *)str;
char *ampptr = 0;
int charcount = 0;
while(*src && charcount < 2035) { /* 2048 - 14 */
if (strncmp(src, "\nSF:", 4) == 0) {
src += 4;
continue;
}
/* Needed so "&something;" is not truncated midway */
if (*src == '&') {
ampptr = dst;
}
else if (*src == ';') {
ampptr = 0;
}
*dst++ = *src++;
charcount++;
}
if (ampptr != 0) {
*ampptr = '\0';
}
else {
*dst = '\0';
}
return temp;
}
/* Write some information (printf style args) to the given log stream(s). /* Write some information (printf style args) to the given log stream(s).
Remember to watch out for format string bugs. */ Remember to watch out for format string bugs. */
void log_write(int logt, const char *fmt, ...) void log_write(int logt, const char *fmt, ...)

View File

@@ -203,5 +203,4 @@ void printStatusMessage();
void printfinaloutput(); void printfinaloutput();
char* xml_convert (const char* str); char* xml_convert (const char* str);
char* xml_sf_convert (const char* str);
#endif /* OUTPUT_H */ #endif /* OUTPUT_H */

View File

@@ -255,10 +255,10 @@ struct substargs {
}; };
/******************** PROTOTYPES *******************/ /******************** PROTOTYPES *******************/
void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *mydata); static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *mydata);
void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *mydata); static void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *mydata);
void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *mydata); static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *mydata);
void end_svcprobe(nsock_pool nsp, enum serviceprobestate probe_state, ServiceGroup *SG, ServiceNFO *svc, nsock_iod nsi); static void end_svcprobe(nsock_pool nsp, enum serviceprobestate probe_state, ServiceGroup *SG, ServiceNFO *svc, nsock_iod nsi);
ServiceProbeMatch::ServiceProbeMatch() { ServiceProbeMatch::ServiceProbeMatch() {
deflineno = -1; deflineno = -1;
@@ -1138,7 +1138,7 @@ void parse_nmap_service_probe_file(AllProbes *AP, char *filename) {
// Parses the nmap-service-probes file, and adds each probe to // Parses the nmap-service-probes file, and adds each probe to
// the already-created 'probes' vector. // the already-created 'probes' vector.
void parse_nmap_service_probes(AllProbes *AP) { static void parse_nmap_service_probes(AllProbes *AP) {
char filename[256]; char filename[256];
if (nmap_fetchfile(filename, sizeof(filename), "nmap-service-probes") == -1){ if (nmap_fetchfile(filename, sizeof(filename), "nmap-service-probes") == -1){
@@ -1893,7 +1893,7 @@ static void handleHostIfDone(ServiceGroup *SG, Target *target) {
// A simple helper function to cancel further work on a service and // A simple helper function to cancel further work on a service and
// set it to the given probe_state pass NULL for nsi if you don't want // set it to the given probe_state pass NULL for nsi if you don't want
// it to be deleted (for example, if you already have done so). // it to be deleted (for example, if you already have done so).
void end_svcprobe(nsock_pool nsp, enum serviceprobestate probe_state, ServiceGroup *SG, ServiceNFO *svc, nsock_iod nsi) { static void end_svcprobe(nsock_pool nsp, enum serviceprobestate probe_state, ServiceGroup *SG, ServiceNFO *svc, nsock_iod nsi) {
list<ServiceNFO *>::iterator member; list<ServiceNFO *>::iterator member;
Target *target = svc->target; Target *target = svc->target;
@@ -1982,7 +1982,7 @@ static int launchSomeServiceProbes(nsock_pool nsp, ServiceGroup *SG) {
} }
void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *mydata) { static void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *mydata) {
nsock_iod nsi = nse_iod(nse); nsock_iod nsi = nse_iod(nse);
enum nse_status status = nse_status(nse); enum nse_status status = nse_status(nse);
enum nse_type type = nse_type(nse); enum nse_type type = nse_type(nse);
@@ -2042,7 +2042,7 @@ void servicescan_connect_handler(nsock_pool nsp, nsock_event nse, void *mydata)
return; return;
} }
void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *mydata) { static void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *mydata) {
enum nse_status status = nse_status(nse); enum nse_status status = nse_status(nse);
nsock_iod nsi; nsock_iod nsi;
ServiceNFO *svc = (ServiceNFO *)mydata; ServiceNFO *svc = (ServiceNFO *)mydata;
@@ -2092,7 +2092,7 @@ void servicescan_write_handler(nsock_pool nsp, nsock_event nse, void *mydata) {
return; return;
} }
void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *mydata) { static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *mydata) {
nsock_iod nsi = nse_iod(nse); nsock_iod nsi = nse_iod(nse);
enum nse_status status = nse_status(nse); enum nse_status status = nse_status(nse);
enum nse_type type = nse_type(nse); enum nse_type type = nse_type(nse);

View File

@@ -887,8 +887,8 @@ static int sendconnecttcpqueries(Target *hostbatch[], struct tcpqueryinfo *tqi,
return 0; return 0;
} }
int sendrawudppingquery(int rawsd, struct eth_nfo *eth, Target *target, u16 probe_port, static int sendrawudppingquery(int rawsd, struct eth_nfo *eth, Target *target, u16 probe_port,
u16 seq, struct timeval *time, struct pingtune *pt) { u16 seq, struct timeval *time, struct pingtune *pt) {
int trynum = 0; int trynum = 0;
unsigned short sportbase; unsigned short sportbase;
@@ -910,8 +910,8 @@ else {
return 0; return 0;
} }
int sendrawtcppingquery(int rawsd, struct eth_nfo *eth, Target *target, int pingtype, u16 probe_port, static int sendrawtcppingquery(int rawsd, struct eth_nfo *eth, Target *target, int pingtype, u16 probe_port,
u16 seq, struct timeval *time, struct pingtune *pt) { u16 seq, struct timeval *time, struct pingtune *pt) {
int trynum = 0; int trynum = 0;
int myseq; int myseq;
unsigned short sportbase; unsigned short sportbase;
@@ -948,8 +948,8 @@ else {
return 0; return 0;
} }
int sendrawtcpudppingqueries(int rawsd, eth_t *ethsd, Target *target, int pingtype, u16 seq, static int sendrawtcpudppingqueries(int rawsd, eth_t *ethsd, Target *target, int pingtype, u16 seq,
struct timeval *time, struct pingtune *pt) { struct timeval *time, struct pingtune *pt) {
int i; int i;
struct eth_nfo eth; struct eth_nfo eth;
struct eth_nfo *ethptr = NULL; struct eth_nfo *ethptr = NULL;
@@ -1114,10 +1114,10 @@ static int sendpingqueries(int sd, int rawsd, eth_t *ethsd, Target *target,
} }
int get_connecttcpscan_results(struct tcpqueryinfo *tqi, static int get_connecttcpscan_results(struct tcpqueryinfo *tqi,
Target *hostbatch[], Target *hostbatch[],
struct timeval *time, struct pingtune *pt, struct timeval *time, struct pingtune *pt,
struct timeout_info *to) { struct timeout_info *to) {
int res, res2; int res, res2;
int tm; int tm;