diff --git a/CHANGELOG b/CHANGELOG index 75f6a896c..850d848c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,13 +26,13 @@ o Reverse DNS resolution is now done in parallel rather than one at a patch was written by Doug Hoyte (doug(a)hcsw.org). o Added the --badsum option, which causes Nmap to use invalid TCP or - UDP checksums for packets sent to target hosts. Since - virtually all host IP stacks properly drop these packets, any - responses received are likely coming from a firewall or IDS that - didn't bother to verify the checksum. For more details on this - technique, see http://www.phrack.org/phrack/60/p60-0x0c.txt . The - author of that paper, Ed3f (ed3f(a)antifork.org), is also the author - of this patch. + UDP checksums for packets sent to target hosts. Since virtually all + host IP stacks properly drop these packets, any responses received + are likely coming from a firewall or IDS that didn't bother to + verify the checksum. For more details on this technique, see + http://www.phrack.org/phrack/60/p60-0x0c.txt . The author of that + paper, Ed3f (ed3f(a)antifork.org), is also the author of this patch + (which I changed it a bit). o The 26 Nmap commands that previously included an underscore (--max_rtt_timeout, --send_eth, --host_timeout, etc.) have been @@ -55,7 +55,9 @@ o Added some exception handling code to mswin32/winfix.cc to prevent Nmap from crashing mysteriously when you have WinPcap 3.0 or earlier (instead of the required 3.1). It now prints an error message instead asking you to upgrade, then reduces functionality to connect()-only - mode. + mode. I couldn't get it working with the C++ standard try/catch() + blocks, but as soon as I used the nonstandard MS conventions + (__try/__except(), everything worked fine. Shrug. o Stripped the firewall API out of the libdnet included with Nmap because Nmap doesn't use it anyway. This saves space and reduces the diff --git a/NmapOps.cc b/NmapOps.cc index 9f75f91bc..c56df19e6 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -234,6 +234,7 @@ void NmapOps::Initialize() { force = append_output = 0; memset(logfd, 0, sizeof(FILE *) * LOG_TYPES); ttl = -1; + badsum = 0; nmap_stdout = stdout; gettimeofday(&start_time, NULL); pTrace = vTrace = false; diff --git a/mswin32/nmap.vcproj b/mswin32/nmap.vcproj index 6176e9347..468a77b55 100644 --- a/mswin32/nmap.vcproj +++ b/mswin32/nmap.vcproj @@ -49,6 +49,7 @@ GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\Debug/nmap.pdb" SubSystem="1" + OptimizeForWindows98="1" TargetMachine="1"/> + + + + + + diff --git a/mswin32/winfix.cc b/mswin32/winfix.cc index 034952c5e..c5378a4c4 100644 --- a/mswin32/winfix.cc +++ b/mswin32/winfix.cc @@ -118,12 +118,6 @@ #define DLI_ERROR VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND) #endif -/* delay-load hooks only for troubleshooting */ -#ifdef _MSC_VER -static int dli_done = 0; -static FARPROC WINAPI winip_dli_fail_hook(unsigned code, PDelayLoadInfo info); -#endif - extern NmapOps o; int pcap_avail = 0; @@ -173,51 +167,28 @@ void win_init() // Try to initialize winpcap -#ifdef _MSC_VER - try -#endif + __try { ULONG len = sizeof(pcaplist); pcap_avail = 1; if(o.debugging > 2) printf("***WinIP*** trying to initialize winpcap 3.1\n"); PacketGetAdapterNames(pcaplist, &len); - if(o.debugging) - printf("Winpcap present, dynamic linked to: %s\n", pcap_lib_version()); - } -#ifdef _MSC_VER - catch(...) - { - pcap_avail = 0; - printf("WARNING: Failed to locate/load Winpcap. Nmap may not function properly until version 3.1 or later is installed! WinPcap is freely available from http://winpcap.polito.it.\n"); - } -#endif - // Check for a wpcap.dll (so we don't crash on old winpcap - // But only with VC++.NET, since old versions do not - // provide this functionality :( -#if defined(_MSC_VER) && _MSC_VER >= 1300 - if(pcap_avail) - { - try { if(FAILED(__HrLoadAllImportsForDll("wpcap.dll"))) { error("WARNING: your winpcap is too old to use. Nmap may not function.\n"); pcap_avail = 0; } - } catch (...) { + if(o.debugging) + printf("Winpcap present, dynamic linked to: %s\n", pcap_lib_version()); + } __except (1) { error("WARNING: Could not import all necessary WinPcap functions. You may need to upgrade to version 3.1 or higher from http://www.winpcap.org. Resorting to connect() mode -- Nmap may not function completely"); + pcap_avail=0; } - } -#endif o.isr00t = pcap_avail; atexit(win_cleanup); - - // Mark load as complete so that dli errors are handled -#ifdef _MSC_VER - dli_done = 1; -#endif } @@ -226,68 +197,6 @@ static void win_cleanup(void) WSACleanup(); } -typedef DWORD (__stdcall *PGBI)(IPAddr, PDWORD); - -#ifdef _MSC_VER -static FARPROC WINAPI winip_dli_fail_hook(unsigned code, PDelayLoadInfo info) -{ - if(o.debugging) - { - printf("***WinIP*** delay load error:\n"); - switch(code) - { - case dliFailLoadLib: - printf(" failed to load dll: %s\n", info->szDll); - break; - - case dliFailGetProc: - printf(" failed to load "); - if(info->dlp.fImportByName) - printf("function %s", info->dlp.szProcName + 2); - else printf("ordinal %d", info->dlp.dwOrdinal); - printf(" in dll %s\n", info->szDll); - break; - - default: - printf(" unknown error\n"); - break; - } - } - - if(dli_done) - { - printf("******* Unexpected delay-load failure *******\n"); - - switch(code) - { - case dliFailLoadLib: - printf(" failed to load dll: %s\n", info->szDll); - if(!stricmp(info->szDll, "wpcap.dll")) - printf(" this is most likely because you have" - " winpcap 2.0 (3.1 or later is required)\n" - "Get it from http://netgroup-serv.polito.it/winpcap\n"); - break; - - case dliFailGetProc: - printf(" failed to load "); - if(info->dlp.fImportByName) - printf("function %s", info->dlp.szProcName + 2); - else printf("ordinal %d", info->dlp.dwOrdinal); - printf(" in dll %s\n", info->szDll); - break; - - default: - printf(" unknown error\n"); - break; - } - } - - return 0; -} -#endif // _MSC_VER - - - int my_close(int sd) { return closesocket(sd); diff --git a/nmap.cc b/nmap.cc index 75931a98c..07539146e 100644 --- a/nmap.cc +++ b/nmap.cc @@ -328,6 +328,7 @@ int nmap_main(int argc, char *argv[]) { {"version_all", no_argument, 0, 0}, {"version-all", no_argument, 0, 0}, {"system_dns", no_argument, 0, 0}, + {"system-dns", no_argument, 0, 0}, {"dns_servers", required_argument, 0, 0}, {"dns-servers", required_argument, 0, 0}, {0, 0, 0, 0}