mirror of
https://github.com/nmap/nmap.git
synced 2026-01-20 13:19:01 +00:00
Check for WSL and warn, suggest native Windows build of Nmap.
This commit is contained in:
17
nmap.cc
17
nmap.cc
@@ -197,6 +197,11 @@
|
||||
#endif
|
||||
#define DNET_VERSION VERSION
|
||||
|
||||
#ifdef LINUX
|
||||
/* Check for Windows Subsystem for Linux (WSL) */
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
@@ -1815,6 +1820,18 @@ int nmap_main(int argc, char *argv[]) {
|
||||
struct sockaddr_storage ss;
|
||||
size_t sslen;
|
||||
|
||||
#ifdef LINUX
|
||||
/* Check for WSL and warn that things may not go well. */
|
||||
struct utsname uts;
|
||||
if (!uname(&uts)) {
|
||||
if (strstr(uts.release, "Microsoft") != NULL) {
|
||||
error("Warning: %s may not work correctly on Windows Subsystem for Linux.\n"
|
||||
"For best performance and accuracy, use the native Windows build from %s/download.html#windows.",
|
||||
NMAP_NAME, NMAP_URL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
now = time(NULL);
|
||||
local_time = localtime(&now);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user