mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
added get_dns_servers() to nmap_dns.cc/.h
This commit is contained in:
parent
3c9833b57c
commit
a5b421e67c
2 changed files with 19 additions and 0 deletions
18
nmap_dns.cc
18
nmap_dns.cc
|
|
@ -1326,3 +1326,21 @@ void nmap_mass_rdns(Target **targets, int num_targets) {
|
|||
|
||||
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_etchosts();
|
||||
|
||||
std::list<std::string> get_dns_servers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue