I want to invoke nmap functionalities like OS detection in C++.
In python, import nmap
allows to use nmap functions. Similarly, is there any way I can do it in C++?
I want to invoke nmap functionalities like OS detection in C++.
In python, import nmap
allows to use nmap functions. Similarly, is there any way I can do it in C++?
You can run the nmap as an external program and read its output through a pipe using popen().
Example
FILE *pin = popen("nmap -p 123 10.0.1.0/24","r");
if ( pin ) {
while (!feof(pin)) {
const char *line = readLine(pin);
printf("%s\n", line);
}
pclose(pin);
}
The Python nmap
package simply launches the Nmap command and parses the XML output. This is certainly something you could do in C++, though you'd have to work out the parsing yourself. I'm not aware of an existing Nmap-output-parsing library in C or C++ like there are for Python, Perl, Ruby, etc.