mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
added get_dns_servers() to nmap_dns.cc/.h
This commit is contained in:
18
nmap_dns.cc
18
nmap_dns.cc
@@ -1326,3 +1326,21 @@ void nmap_mass_rdns(Target **targets, int num_targets) {
|
|||||||
|
|
||||||
firstrun=0;
|
firstrun=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns a list of known DNS servers
|
||||||
|
std::list<std::string> get_dns_servers() {
|
||||||
|
// if, for example, run with -n, list is not initialized,
|
||||||
|
// run empty nmap_mass_rdns to do so
|
||||||
|
if(servs.size() == 0 && firstrun) {
|
||||||
|
nmap_mass_rdns(NULL, 0);
|
||||||
|
}
|
||||||
|
std::list<dns_server *>::iterator servI;
|
||||||
|
std::list<std::string> serverList;
|
||||||
|
dns_server *tpserv;
|
||||||
|
for(servI = servs.begin(); servI != servs.end(); servI++) {
|
||||||
|
tpserv = *servI;
|
||||||
|
serverList.push_back(inet_ntoa(tpserv->addr.sin_addr));
|
||||||
|
}
|
||||||
|
return serverList;
|
||||||
|
}
|
||||||
|
|||||||
@@ -103,3 +103,4 @@ const char *lookup_cached_host(u32 ip);
|
|||||||
void free_dns_servers();
|
void free_dns_servers();
|
||||||
void free_etchosts();
|
void free_etchosts();
|
||||||
|
|
||||||
|
std::list<std::string> get_dns_servers();
|
||||||
|
|||||||
Reference in New Issue
Block a user