mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +00:00
Check for WSL and warn, suggest native Windows build of Nmap.
This commit is contained in:
parent
b445faab35
commit
23ee017b95
1 changed files with 17 additions and 0 deletions
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue