1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-20 06:29:02 +00:00

vcproj for nmap

This commit is contained in:
fyodor
2005-08-08 05:48:49 +00:00
parent 3f301ba19c
commit bdf2caa2a4
40 changed files with 795 additions and 359 deletions

View File

@@ -2564,6 +2564,9 @@ o Added XML output (-oX). Hopefully this will help those of you
emphasize that XML is now the preferred machine-readable output
format. But don't worry if your tool uses -oM , that format (and
the deprecated -oM flag) won't go away any time soon (if ever).
Thanks to Stou Sandalski (tangui(a)cell2000.net) and Fredrick Paul
Eisele (phreed(a)gmail.com) for sending proposals that inspired the
format used.
o Applied patch from Stefan Rapp (s.rapp(a)hrz.uni-dortmund.de) which
fixes a variable argument integer promotion problem in the new

View File

@@ -1,4 +1,4 @@
export NMAP_VERSION = 3.83.DC13
export NMAP_VERSION = 3.83.DC15
NMAP_NAME= nmap
NMAP_URL= http://www.insecure.org/nmap/
NMAP_PLATFORM=@host@

View File

@@ -1,4 +1,4 @@
Nmap 3.83.DC13 Usage: nmap [Scan Type(s)] [Options] <host or net list>
Nmap 3.83.DC15 Usage: nmap [Scan Type(s)] [Options] <host or net list>
Some Common Scan Types ('*' options require root privileges)
* -sS TCP SYN stealth port scan (default if privileged (root))
-sT TCP connect() port scan (default for unprivileged users)

View File

@@ -1,7 +1,7 @@
$Id$
This is Dug Song's excellent Libdnet networking library version 1.10.
It has been stripped down for inclusion within Nmap as follows:
It has been stripped down for inclusion within Nmap and modified as follows:
o Removed the following directories:
python, test, man
@@ -20,6 +20,21 @@ o Replaced config.guess config.sub and missing in config dir with
o Added this NMAP_MODIFICATIONS file.
o Added include/winconfig.h, which is a modified config.h to better support
Windows compilation via Visual Studio. Added conditional includes
for it to a bunch of the dnet source files.
o A number of portability changes to remove errors/warnings during
Win32 Visual Studio.Net compilation. This was mostly a matter of
adding casts and a few extra include files.
o Added libdnet-stripped.vcproj -- A Visual Studio.Net project file
for dnet.
o Changed eth_open() in eth-win32.c to more frequently consider the
results of PacketGetAdapterNames() to be in single-char format rather
than 2-byte wide characters.
o Made some code changes to intf.c (the patch below). This does the following:
o Preserve the alias qualifier from interface name in more cases

View File

@@ -23,7 +23,11 @@
typedef u_short uint16_t;
typedef u_int uint32_t;
# ifndef __CYGWIN__
typedef long ssize_t;
typedef unsigned int ssize_t;
# endif
#if !defined(__GNUC__)
#define snprintf _snprintf
#define vsnprintf _vsnprintf
# endif
#else
# include <sys/param.h>
@@ -118,8 +122,8 @@
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define __flexarr []
# elif defined(_WIN32)
/* MS VC++ */
# define __flexarr []
/* MS VC++ -- using just [] may work, but gives a non-standard extension warning */
# define __flexarr [1]
# else
/* Some other non-C99 compiler. Approximate with [1]. */
# define __flexarr [1]

View File

@@ -0,0 +1,278 @@
/* include/dnet_winconfig.h -- Windows configuration #defines. It is modified
from the config.h generated by configure on other platforms. */
/* Define if arpreq struct has arp_dev. */
#define HAVE_ARPREQ_ARP_DEV 1
/* Define if you have the Berkeley Packet Filter. */
/* #undef HAVE_BSD_BPF */
/* Define if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define if you have the `err' function. */
#define HAVE_ERR 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <hpsecurity.h> header file. */
/* #undef HAVE_HPSECURITY_H */
/* Define if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have arp(7) ioctls. */
#define HAVE_IOCTL_ARP 1
/* Define if you have the <Iphlpapi.h> header file. */
/* #undef HAVE_IPHLPAPI_H */
/* Define if you have the <ip_compat.h> header file. */
/* #undef HAVE_IP_COMPAT_H */
/* Define if you have the <ip_fil_compat.h> header file. */
/* #undef HAVE_IP_FIL_COMPAT_H */
/* Define if you have the <ip_fil.h> header file. */
/* #undef HAVE_IP_FIL_H */
/* Define if you have the `iphlpapi' library (-liphlpapi). */
/* #undef HAVE_LIBIPHLPAPI */
/* Define if you have the `nm' library (-lnm). */
/* #undef HAVE_LIBNM */
/* Define if you have the `nsl' library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define if you have the `str' library (-lstr). */
/* #undef HAVE_LIBSTR */
/* Define if you have the `ws2_32' library (-lws2_32). */
/* #undef HAVE_LIBWS2_32 */
/* Define if you have the <linux/if_tun.h> header file. */
#define HAVE_LINUX_IF_TUN_H 1
/* Define if you have the <linux/ip_fwchains.h> header file. */
/* #undef HAVE_LINUX_IP_FWCHAINS_H */
/* Define if you have the <linux/ip_fw.h> header file. */
/* #undef HAVE_LINUX_IP_FW_H */
/* Define if you have the <linux/netfilter_ipv4/ipchains_core.h> header file.
*/
#define HAVE_LINUX_NETFILTER_IPV4_IPCHAINS_CORE_H 1
/* Define if you have Linux PF_PACKET sockets. */
#define HAVE_LINUX_PF_PACKET 1
/* Define if you have the Linux /proc filesystem. */
#define HAVE_LINUX_PROCFS 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <netinet/in_var.h> header file. */
/* #undef HAVE_NETINET_IN_VAR_H */
/* Define if you have the <netinet/ip_compat.h> header file. */
/* #undef HAVE_NETINET_IP_COMPAT_H */
/* Define if you have the <netinet/ip_fil_compat.h> header file. */
/* #undef HAVE_NETINET_IP_FIL_COMPAT_H */
/* Define if you have the <netinet/ip_fil.h> header file. */
/* #undef HAVE_NETINET_IP_FIL_H */
/* Define if you have the <netinet/ip_fw.h> header file. */
/* #undef HAVE_NETINET_IP_FW_H */
/* Define if you have the <net/bpf.h> header file. */
/* #undef HAVE_NET_BPF_H */
/* Define if you have the <net/if_arp.h> header file. */
#define HAVE_NET_IF_ARP_H 1
/* Define if you have the <net/if_dl.h> header file. */
/* #undef HAVE_NET_IF_DL_H */
/* Define if you have the <net/if.h> header file. */
// #define HAVE_NET_IF_H 1
/* Define if you have the <net/if_tun.h> header file. */
/* #undef HAVE_NET_IF_TUN_H */
/* Define if you have the <net/if_var.h> header file. */
/* #undef HAVE_NET_IF_VAR_H */
/* Define if you have the <net/pfilt.h> header file. */
/* #undef HAVE_NET_PFILT_H */
/* Define if you have the <net/pfvar.h> header file. */
/* #undef HAVE_NET_PFVAR_H */
/* Define if you have the <net/radix.h> header file. */
/* #undef HAVE_NET_RADIX_H */
/* Define if you have the <net/raw.h> header file. */
/* #undef HAVE_NET_RAW_H */
/* Define if you have the <net/route.h> header file. */
#define HAVE_NET_ROUTE_H 1
/* Define if you have cooked raw IP sockets. */
/* #undef HAVE_RAWIP_COOKED */
/* Define if raw IP sockets require host byte ordering for ip_off, ip_len. */
/* #undef HAVE_RAWIP_HOST_OFFLEN */
/* Define if <net/route.h> has rt_msghdr struct. */
/* #undef HAVE_ROUTE_RT_MSGHDR */
/* Define if <netinet/in.h> has sockaddr_in6 struct. */
// #define HAVE_SOCKADDR_IN6 1
/* Define if sockaddr struct has sa_len. */
/* #undef HAVE_SOCKADDR_SA_LEN */
/* Define if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have SNMP MIB2 STREAMS. */
/* #undef HAVE_STREAMS_MIB2 */
/* Define if you have route(7) STREAMS. */
/* #undef HAVE_STREAMS_ROUTE */
/* Define if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the `strlcat' function. */
/* #undef HAVE_STRLCAT */
/* Define if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define if you have the <stropts.h> header file. */
#define HAVE_STROPTS_H 1
/* Define if you have the `strsep' function. */
#define HAVE_STRSEP 1
/* Define if you have the <sys/bufmod.h> header file. */
/* #undef HAVE_SYS_BUFMOD_H */
/* Define if you have the <sys/dlpihdr.h> header file. */
/* #undef HAVE_SYS_DLPIHDR_H */
/* Define if you have the <sys/dlpi_ext.h> header file. */
/* #undef HAVE_SYS_DLPI_EXT_H */
/* Define if you have the <sys/dlpi.h> header file. */
/* #undef HAVE_SYS_DLPI_H */
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/mib.h> header file. */
/* #undef HAVE_SYS_MIB_H */
/* Define if you have the <sys/ndd_var.h> header file. */
/* #undef HAVE_SYS_NDD_VAR_H */
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
/* Define if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <winsock2.h> header file. */
/* #undef HAVE_WINSOCK2_H */
/* Name of package */
#define PACKAGE "libdnet"
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.10"
/* Define for faster code generation. */
/* #undef WIN32_LEAN_AND_MEAN */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
/* #undef inline */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* Use MingW32's internal snprintf */
/* #undef snprintf */
#include <sys/types.h>
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# include <windows.h>
#endif
#ifdef __svr4__
# define BSD_COMP 1
#endif
#if defined(__osf__) && !defined(_SOCKADDR_LEN)
# define _SOCKADDR_LEN 1
#endif
#ifndef HAVE_INET_PTON
int inet_pton(int, const char *, void *);
#endif
#ifndef HAVE_STRLCAT
int strlcat(char *, const char *, int);
#endif
#ifndef HAVE_STRLCPY
int strlcpy(char *, const char *, int);
#endif
#ifndef HAVE_STRSEP
char *strsep(char **, const char *);
#endif

View File

@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="dnet"
ProjectGUID="{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="Debug"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="include;&quot;..\mswin32\pcap-include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libdnet-stripped.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="."
IntermediateDirectory="Release"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libdnet-stripped.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\src\addr-util.c">
</File>
<File
RelativePath=".\src\addr.c">
</File>
<File
RelativePath=".\src\arp-win32.c">
</File>
<File
RelativePath=".\src\err.c">
</File>
<File
RelativePath=".\src\eth-win32.c">
</File>
<File
RelativePath=".\src\intf-win32.c">
</File>
<File
RelativePath=".\src\ip-util.c">
</File>
<File
RelativePath=".\src\ip-win32.c">
</File>
<File
RelativePath=".\src\ip6.c">
</File>
<File
RelativePath=".\src\route-win32.c">
</File>
<File
RelativePath=".\src\strlcat.c">
</File>
<File
RelativePath=".\src\strlcpy.c">
</File>
<File
RelativePath=".\src\strsep.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\include\dnet\addr.h">
</File>
<File
RelativePath=".\include\dnet\arp.h">
</File>
<File
RelativePath=".\include\config.h">
</File>
<File
RelativePath=".\include\dnet.h">
</File>
<File
RelativePath=".\include\err.h">
</File>
<File
RelativePath=".\include\dnet\eth.h">
</File>
<File
RelativePath=".\include\dnet\icmp.h">
</File>
<File
RelativePath=".\include\dnet\intf.h">
</File>
<File
RelativePath=".\include\dnet\ip.h">
</File>
<File
RelativePath=".\include\dnet\ip6.h">
</File>
<File
RelativePath=".\include\dnet\os.h">
</File>
<File
RelativePath=".\include\queue.h">
</File>
<File
RelativePath=".\include\dnet\route.h">
</File>
<File
RelativePath=".\include\dnet\tcp.h">
</File>
<File
RelativePath=".\include\dnet\udp.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -6,7 +6,11 @@
* $Id: addr-util.c,v 1.4 2005/01/23 07:36:54 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@@ -8,7 +8,11 @@
* $Id: addr.c,v 1.33 2005/01/23 07:36:54 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <sys/types.h>
#ifdef HAVE_NET_IF_H

View File

@@ -6,8 +6,13 @@
* $Id: arp-win32.c,v 1.12 2005/01/23 07:36:54 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>

View File

@@ -6,7 +6,11 @@
* $Id: blob.c,v 1.4 2002/08/20 05:18:49 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <ctype.h>
#include <stdarg.h>

View File

@@ -6,12 +6,16 @@
* $Id: eth-win32.c,v 1.11 2005/02/15 06:37:06 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
/* XXX - VC++ 6.0 bogosity */
#define sockaddr_storage sockaddr
/* XXX - VC++ 6.0 bogosity
#define sockaddr_storage sockaddr */
#include <Packet32.h>
#undef sockaddr_storage
/* #undef sockaddr_storage */
#include <Ntddndis.h>
#include <errno.h>
@@ -40,7 +44,7 @@ eth_open(const char *device)
WCHAR *name, wbuf[2048];
ULONG wlen;
char *desc, *namea;
int i, j, alen;
int i, j, alen, rc;
OSVERSIONINFO osvi;
intf_t *intf;
@@ -56,13 +60,15 @@ eth_open(const char *device)
alen = sizeof(alist) / sizeof(alist[0]);
wlen = sizeof(wbuf) / sizeof(wbuf[0]);
PacketGetAdapterNames((char *)wbuf, &wlen);
rc = PacketGetAdapterNames((char *)wbuf, &wlen);
if (rc == 0) return (NULL);
/* Determine Windows version */
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
/* Added the 0 below for testing -- may need to find new expression */
if (0 && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
(osvi.dwMajorVersion >= 4)) {
for (name = wbuf, i = 0; *name != '\0' && i < alen; i++) {
wcstombs(alist[i].name, name, sizeof(alist[0].name));
@@ -113,9 +119,9 @@ eth_open(const char *device)
ssize_t
eth_send(eth_t *eth, const void *buf, size_t len)
{
PacketInitPacket(eth->pkt, (void *)buf, len);
PacketInitPacket(eth->pkt, (void *)buf, (UINT) len);
PacketSendPacket(eth->lpa, eth->pkt, TRUE);
return (len);
return ((ssize_t) len);
}
eth_t *

View File

@@ -6,17 +6,23 @@
* $Id: intf-win32.c,v 1.24 2005/02/15 06:37:06 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <winsock2.h>
#include <windows.h>
#include <iphlpapi.h>
#include <dnet.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dnet.h"
struct ifcombo {
DWORD *idx;
@@ -150,7 +156,7 @@ _ifrow_to_entry(intf_t *intf, MIB_IFROW *ifrow, struct intf_entry *entry)
}
}
}
entry->intf_len = (u_char *)ap - (u_char *)entry;
entry->intf_len = (unsigned int) ((u_char *)ap - (u_char *)entry);
}
static int

View File

@@ -6,7 +6,11 @@
* $Id: intf.c,v 1.55 2005/02/10 16:57:35 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <sys/param.h>
#include <sys/types.h>

View File

@@ -6,7 +6,11 @@
* $Id: ip-cooked.c,v 1.17 2005/01/25 21:30:40 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#ifndef _WIN32
#include <netinet/in.h>

View File

@@ -6,7 +6,11 @@
* $Id: ip-util.c,v 1.9 2005/02/17 02:55:56 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <errno.h>
#include <stdlib.h>
@@ -36,10 +40,10 @@ ip_add_option(void *buf, size_t len, int proto,
hl = tcp->th_off << 2;
p = (u_char *)tcp + hl;
}
datalen = ntohs(ip->ip_len) - (p - (u_char *)buf);
datalen = ntohs(ip->ip_len) - (int) (p - (u_char *)buf);
/* Compute padding to next word boundary. */
if ((padlen = 4 - (optlen % 4)) == 4)
if ((padlen = (int) (4 - (optlen % 4))) == 4)
padlen = 0;
/* XXX - IP_HDR_LEN_MAX == TCP_HDR_LEN_MAX */
@@ -66,13 +70,13 @@ ip_add_option(void *buf, size_t len, int proto,
optlen += padlen;
if (proto == IP_PROTO_IP)
ip->ip_hl = (p - (u_char *)ip) >> 2;
ip->ip_hl = (uint8_t) (p - (u_char *)ip) >> 2;
else if (proto == IP_PROTO_TCP)
tcp->th_off = (p - (u_char *)tcp) >> 2;
tcp->th_off = (uint8_t) (p - (u_char *)tcp) >> 2;
ip->ip_len = htons(ntohs(ip->ip_len) + optlen);
ip->ip_len = htons(ntohs(ip->ip_len) + (unsigned short) optlen);
return (optlen);
return ((ssize_t) optlen);
}
void
@@ -103,7 +107,7 @@ ip_checksum(void *buf, size_t len)
if (len >= TCP_HDR_LEN) {
tcp->th_sum = 0;
sum = ip_cksum_add(tcp, len, 0) +
htons(ip->ip_p + len);
htons(ip->ip_p + (unsigned short) len);
sum = ip_cksum_add(&ip->ip_src, 8, sum);
tcp->th_sum = ip_cksum_carry(sum);
}
@@ -113,7 +117,7 @@ ip_checksum(void *buf, size_t len)
if (len >= UDP_HDR_LEN) {
udp->uh_sum = 0;
sum = ip_cksum_add(udp, len, 0) +
htons(ip->ip_p + len);
htons(ip->ip_p + (unsigned short) len);
sum = ip_cksum_add(&ip->ip_src, 8, sum);
udp->uh_sum = ip_cksum_carry(sum);
if (!udp->uh_sum)
@@ -136,7 +140,7 @@ ip_cksum_add(const void *buf, size_t len, int cksum)
uint16_t *sp = (uint16_t *)buf;
int n, sn;
sn = len / 2;
sn = (int) len / 2;
n = (sn + 15) / 16;
/* XXX - unroll loop using Duff's device. */

View File

@@ -8,6 +8,7 @@
#include "config.h"
#include <winsock2.h>
#include <ws2tcpip.h>
#include <errno.h>
@@ -55,9 +56,9 @@ ip_send(ip_t *ip, const void *buf, size_t len)
ip->sin.sin_addr.s_addr = hdr->ip_src;
if ((len = sendto(ip->fd, (const char *)buf, len, 0,
if ((len = sendto(ip->fd, (const char *)buf, (int) len, 0,
(struct sockaddr *)&ip->sin, sizeof(ip->sin))) != SOCKET_ERROR)
return (len);
return ((ssize_t) len);
return (-1);
}

View File

@@ -6,7 +6,11 @@
* $Id: ip6.c,v 1.2 2005/01/23 07:36:54 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include "dnet.h"
@@ -37,7 +41,7 @@ ip6_checksum(void *buf, size_t len)
if (len >= TCP_HDR_LEN) {
tcp->th_sum = 0;
sum = ip_cksum_add(tcp, len, 0) + htons(nxt + len);
sum = ip_cksum_add(tcp, len, 0) + htons(nxt + (unsigned short) len);
sum = ip_cksum_add(&ip6->ip6_src, 32, sum);
tcp->th_sum = ip_cksum_carry(sum);
}
@@ -46,7 +50,7 @@ ip6_checksum(void *buf, size_t len)
if (len >= UDP_HDR_LEN) {
udp->uh_sum = 0;
sum = ip_cksum_add(udp, len, 0) + htons(nxt + len);
sum = ip_cksum_add(udp, len, 0) + htons(nxt + (unsigned short) len);
sum = ip_cksum_add(&ip6->ip6_src, 32, sum);
if ((udp->uh_sum = ip_cksum_carry(sum)) == 0)
udp->uh_sum = 0xffff;
@@ -56,7 +60,7 @@ ip6_checksum(void *buf, size_t len)
if (len >= ICMP_HDR_LEN) {
icmp->icmp_cksum = 0;
sum = ip_cksum_add(icmp, len, 0) + htons(nxt + len);
sum = ip_cksum_add(icmp, len, 0) + htons(nxt + (unsigned short) len);
sum = ip_cksum_add(&ip6->ip6_src, 32, sum);
icmp->icmp_cksum = ip_cksum_carry(sum);
}

View File

@@ -6,8 +6,14 @@
* $Id: route-win32.c,v 1.12 2005/02/15 07:11:32 dugsong Exp $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
#else
#include "config.h"
#endif
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>

View File

@@ -186,6 +186,7 @@ typedef struct _IP_ADAPTER_ORDER_MAP
// of the ip_option_information structure. See RFC 791 for a complete
// description of each.
//
/* THESE ARE DEFINED IN DNET -- SO EXCLUDED
#define IP_OPT_EOL 0 // End of list option
#define IP_OPT_NOP 1 // No operation
#define IP_OPT_SECURITY 0x82 // Security option
@@ -195,6 +196,7 @@ typedef struct _IP_ADAPTER_ORDER_MAP
#define IP_OPT_TS 0x44 // Timestamp
#define IP_OPT_SID 0x88 // Stream ID (obsolete)
#define IP_OPT_ROUTER_ALERT 0x94 // Router Alert Option
*/
#define MAX_OPT_SIZE 40 // Maximum length of IP options in bytes

View File

@@ -1,124 +0,0 @@
/*++
Copyright (c) 1995-1999 Microsoft Corporation
Module Name:
iptypes.h
*/
#ifndef IP_TYPES_INCLUDED
#define IP_TYPES_INCLUDED
#if _MSC_VER > 1000
#pragma once
#endif
#include <time.h>
// Definitions and structures used by getnetworkparams and getadaptersinfo apis
#define MAX_ADAPTER_DESCRIPTION_LENGTH 128 // arb.
#define MAX_ADAPTER_NAME_LENGTH 256 // arb.
#define MAX_ADAPTER_ADDRESS_LENGTH 8 // arb.
#define DEFAULT_MINIMUM_ENTITIES 32 // arb.
#define MAX_HOSTNAME_LEN 128 // arb.
#define MAX_DOMAIN_NAME_LEN 128 // arb.
#define MAX_SCOPE_ID_LEN 256 // arb.
//
// types
//
// Node Type
#define BROADCAST_NODETYPE 1
#define PEER_TO_PEER_NODETYPE 2
#define MIXED_NODETYPE 4
#define HYBRID_NODETYPE 8
// Adapter Type
#define IF_OTHER_ADAPTERTYPE 0
#define IF_ETHERNET_ADAPTERTYPE 1
#define IF_TOKEN_RING_ADAPTERTYPE 2
#define IF_FDDI_ADAPTERTYPE 3
#define IF_PPP_ADAPTERTYPE 4
#define IF_LOOPBACK_ADAPTERTYPE 5
#define IF_SLIP_ADAPTERTYPE 6
//
// IP_ADDRESS_STRING - store an IP address as a dotted decimal string
//
typedef struct {
char String[4 * 4];
} IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
//
// IP_ADDR_STRING - store an IP address with its corresponding subnet mask,
// both as dotted decimal strings
//
typedef struct _IP_ADDR_STRING {
struct _IP_ADDR_STRING* Next;
IP_ADDRESS_STRING IpAddress;
IP_MASK_STRING IpMask;
DWORD Context;
} IP_ADDR_STRING, *PIP_ADDR_STRING;
//
// ADAPTER_INFO - per-adapter information. All IP addresses are stored as
// strings
//
typedef struct _IP_ADAPTER_INFO {
struct _IP_ADAPTER_INFO* Next;
DWORD ComboIndex;
char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
UINT AddressLength;
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
DWORD Index;
UINT Type;
UINT DhcpEnabled;
PIP_ADDR_STRING CurrentIpAddress;
IP_ADDR_STRING IpAddressList;
IP_ADDR_STRING GatewayList;
IP_ADDR_STRING DhcpServer;
BOOL HaveWins;
IP_ADDR_STRING PrimaryWinsServer;
IP_ADDR_STRING SecondaryWinsServer;
time_t LeaseObtained;
time_t LeaseExpires;
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
//
// IP_PER_ADAPTER_INFO - per-adapter IP information such as DNS server list.
//
typedef struct _IP_PER_ADAPTER_INFO {
UINT AutoconfigEnabled;
UINT AutoconfigActive;
PIP_ADDR_STRING CurrentDnsServer;
IP_ADDR_STRING DnsServerList;
} IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
//
// FIXED_INFO - the set of IP-related information which does not depend on DHCP
//
typedef struct {
char HostName[MAX_HOSTNAME_LEN + 4] ;
char DomainName[MAX_DOMAIN_NAME_LEN + 4];
PIP_ADDR_STRING CurrentDnsServer;
IP_ADDR_STRING DnsServerList;
UINT NodeType;
char ScopeId[MAX_SCOPE_ID_LEN + 4];
UINT EnableRouting;
UINT EnableProxy;
UINT EnableDns;
} FIXED_INFO, *PFIXED_INFO;
#endif

View File

@@ -145,10 +145,10 @@ struct ip_timestamp {
ipt_flg:4; /* flags, see below */
#endif
union ipt_timestamp {
n_long ipt_time[1];
u_int32_t ipt_time[1];
struct ipt_ta {
struct in_addr ipt_addr;
n_long ipt_time;
u_int32_t ipt_time;
} ipt_ta[1];
} ipt_timestamp;
};

View File

@@ -49,15 +49,15 @@ struct icmp {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
u_short icd_id;
u_short icd_seq;
} ih_idseq;
int ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
n_short ipm_void;
n_short ipm_nextmtu;
u_short ipm_void;
u_short ipm_nextmtu;
} ih_pmtu;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
@@ -69,9 +69,9 @@ struct icmp {
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
union {
struct id_ts {
n_time its_otime;
n_time its_rtime;
n_time its_ttime;
u_int32_t its_otime;
u_int32_t its_rtime;
u_int32_t its_ttime;
} id_ts;
struct id_ip {
struct ip idi_ip;

Binary file not shown.

Binary file not shown.

View File

@@ -7,6 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nmap", "nmap.vcproj", "{361
ProjectSection(ProjectDependencies) = postProject
{CB578003-213B-4316-B5BC-2D71A081A65A} = {CB578003-213B-4316-B5BC-2D71A081A65A}
{5DE86C7A-DE72-4265-8807-4CA38F94F22A} = {5DE86C7A-DE72-4265-8807-4CA38F94F22A}
{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C} = {5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}
{F8D6D1E3-D4EA-402C-98AA-168E5309BAF4} = {F8D6D1E3-D4EA-402C-98AA-168E5309BAF4}
{B630C8F7-3138-43E8-89ED-78742FA2AC5F} = {B630C8F7-3138-43E8-89ED-78742FA2AC5F}
EndProjectSection
@@ -24,6 +25,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nbase", "..\nbase\nbase.vcp
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dnet", "..\libdnet-stripped\libdnet-stripped.vcproj", "{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -50,6 +55,10 @@ Global
{B630C8F7-3138-43E8-89ED-78742FA2AC5F}.Debug.Build.0 = Debug|Win32
{B630C8F7-3138-43E8-89ED-78742FA2AC5F}.Release.ActiveCfg = Release|Win32
{B630C8F7-3138-43E8-89ED-78742FA2AC5F}.Release.Build.0 = Release|Win32
{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}.Debug.ActiveCfg = Debug|Win32
{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}.Debug.Build.0 = Debug|Win32
{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}.Release.ActiveCfg = Release|Win32
{5328E0BE-BC0A-4C2A-8CB9-CE00B61B9C4C}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

View File

@@ -22,7 +22,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..;../nbase;../libpcre;winip;..\nsock\include;&quot;pcap-include&quot;"
AdditionalIncludeDirectories=".;..;../nbase;../libpcre;winip;..\nsock\include;&quot;pcap-include&quot;;&quot;..\libdnet-stripped\include&quot;"
PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -39,11 +39,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib iphlpapi.lib wpcap.lib packet.lib nsock.lib libpcre.lib nbase.lib $(NOINHERIT)"
AdditionalDependencies="nsock.lib libpcre.lib nbase.lib libdnet-stripped.lib ws2_32.lib IPHlpAPI.Lib wpcap.lib packet.lib $(NOINHERIT)"
OutputFile=".\Debug/nmap.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="winip;lib;..\libpcre;..\nsock;..\nbase"
AdditionalLibraryDirectories="lib;..\libpcre;..\nsock;..\nbase;&quot;..\libdnet-stripped&quot;"
IgnoreDefaultLibraryNames=""
DelayLoadDLLs="packet.dll,wpcap.dll,iphlpapi.dll"
GenerateDebugInformation="TRUE"
@@ -87,7 +87,7 @@
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".;..;../nbase;../libpcre;winip;..\nsock\include;&quot;pcap-include&quot;"
AdditionalIncludeDirectories=".;..;../nbase;../libpcre;winip;..\nsock\include;&quot;pcap-include&quot;;&quot;..\libdnet-stripped\include&quot;"
PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="0"
@@ -103,11 +103,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib iphlpapi.lib wpcap.lib packet.lib nsock.lib libpcre.lib nbase.lib $(NOINHERIT)"
AdditionalDependencies="ws2_32.lib IPHlpAPI.Lib wpcap.lib packet.lib nsock.lib libpcre.lib nbase.lib libdnet-stripped.lib $(NOINHERIT)"
OutputFile=".\Release/nmap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="winip;lib;..\libpcre;..\nsock;..\nbase"
AdditionalLibraryDirectories="lib;..\libpcre;..\nsock;..\nbase;&quot;..\libdnet-stripped&quot;"
IgnoreDefaultLibraryNames=""
DelayLoadDLLs="packet.dll,iphlpapi.dll,wpcap.dll"
ProgramDatabaseFile=".\Release/nmap.pdb"
@@ -243,28 +243,6 @@
<File
RelativePath="nmap.rc">
</File>
<File
RelativePath="winip\pcapsend.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
CompileAs="2"/>
</FileConfiguration>
</File>
<File
RelativePath="winip\rawrecv.c">
<FileConfiguration
@@ -337,26 +315,7 @@
RelativePath="winfix.cc">
</File>
<File
RelativePath="winip\winip.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
CompileAs="2"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
CompileAs="2"/>
</FileConfiguration>
RelativePath=".\winip\winip.cc">
</File>
</Filter>
</Filter>

View File

@@ -5,7 +5,6 @@
typedef long n_long;
typedef short n_short;
typedef long n_time;

View File

@@ -1,51 +0,0 @@
/*
iphlpapi.h: declares the subset of iphlpapi needed to compile
Copyright (C) 2000 Andy Lutomirski
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License, version 2.1, as published by the Free Software
Foundation, with the exception that if this copy of the library
is distributed under the Lesser GNU Public License (as opposed
to the ordinary GPL), you may ignore section 6b, and that all
copies distributed without exercising section 3 must retain this
paragraph in its entirety.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __IPHLPAPI_H__
#ifndef __IPHLPAPI_FAKE_H__
#define __IPHLPAPI_FAKE_H__
#include <windows.h>
#include <iprtrmib.h>
#include <ipexport.h>
#include <iptypes.h>
#ifdef __cplusplus
extern "C" {
#endif
DWORD __declspec(dllimport) __stdcall GetIfTable(PMIB_IFTABLE, DWORD*, BOOL);
DWORD __declspec(dllimport) __stdcall GetIpAddrTable(PMIB_IPADDRTABLE, DWORD*, BOOL);
DWORD __declspec(dllimport) __stdcall GetIpNetTable(PMIB_IPNETTABLE, DWORD*, BOOL);
DWORD __declspec(dllimport) __stdcall GetIpForwardTable(PMIB_IPFORWARDTABLE, DWORD*, BOOL);
DWORD __declspec(dllimport) __stdcall GetIfEntry(PMIB_IFROW);
DWORD __declspec(dllimport) __stdcall SendARP( int, int, PULONG, PULONG );
#ifdef __cplusplus
}
#endif
#endif
#endif

View File

@@ -659,9 +659,11 @@ typedef DWORD (__stdcall *PGBI)(IPAddr, PDWORD);
int win32_sendto(int sd, const char *packet, int len,
unsigned int flags, struct sockaddr *to, int tolen)
{
/* COMMENTED OUT SINCE pcapsend* is obsolete -- need to use new Nmap infrastructure
if(sd == 501)
return pcapsendraw(packet, len, to, tolen);
else return sendto(sd, packet, len, flags, to, tolen);
else */
return sendto(sd, packet, len, flags, to, tolen);
}
int Sendto(char *functionname, int sd, const unsigned char *packet, int len,
@@ -679,7 +681,9 @@ int win32_socket(int af, int type, int proto)
if(type == SOCK_RAW && proto == IPPROTO_RAW)
{
winip_test(1);
/* no longer using this pcapsend stuff
pcapsend_init();
*/
return 501;
}

View File

@@ -64,8 +64,13 @@ frame-relay(32)
*/
#include <pcap.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
/*
#define IF_other 1
#define IF_regular1822 2
#define IF_hdh1822 3
@@ -98,8 +103,7 @@ frame-relay(32)
#define IF_ds3 30
#define IF_sip 31
#define IF_frame_relay 32
#include <windows.h>
*/
#ifndef EXTERNC
# ifdef __cplusplus
@@ -109,16 +113,15 @@ frame-relay(32)
# endif
#endif
// change to <iphlpapi.h> if you have the SDK
#include "iphlpapi.h"
// windows-specific options
#include <pcap.h>
struct winops {
int norawsock, nopcap, forcerawsock, listinterfaces, nt4route, noiphlpapi, trace;
};
EXTERNC struct winops wo;
/* struct winops wo;
*/
/* Sets a pcap filter function -- makes SOCK_RAW reads easier */
typedef int (*PFILTERFN)(const char *packet, unsigned int len); /* 1 to keep */
@@ -172,9 +175,9 @@ EXTERNC int get_best_route(DWORD dest, PMIB_IPFORWARDROW r);
// pcapsend interface
EXTERNC void pcapsend_init();
void pcapsend_init();
EXTERNC pcap_t *my_real_pcap_open_live(const char *device, int snaplen, int promisc, int to_ms);
EXTERNC int pcapsendraw(const char *packet, int len,
int pcapsendraw(const char *packet, int len,
struct sockaddr *to, int tolen);
// rawrecv interface

View File

@@ -425,7 +425,7 @@ PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=F%UCK=E%ULEN=134%DAT=E)
# Aethra Vega Star Gold (Videoconferencing appliance)
# Aethra Video Conference System Vega Pro S running pSOSystem
Fingerprint Aethra Vega Conference System
Class Aethra | embedded || webcom
Class Aethra | embedded || webcam
TSeq(Class=RI%gcd=<6%SI=<2F97016&>79D33%IPID=I%TS=U)
T1(DF=N%W=7FFF%ACK=S++%Flags=AS%Ops=ME)
T2(Resp=N)
@@ -1888,7 +1888,7 @@ PU(Resp=N)
# Audio Codes MP-104 - VoIP Gateway FXO (version 4.0.282.350)
Fingerprint AudioCodes MP-104 VoIP Gateway FXO
Class AudioCodes | embedded || VOIP Gateway
Class AudioCodes | embedded || VoIP gateway
TSeq(Class=TD%gcd=<3D094%SI=<1E%IPID=I%TS=1000HZ)
T1(DF=N%W=20F4%ACK=S++%Flags=AS%Ops=MNWNNT)
T2(Resp=N)
@@ -1901,7 +1901,7 @@ PU(Resp=N)
# AudioCodes MP-108 FXS (iptele gateway) version: 4.40.162.274
Fingerprint AudioCodes MP-108 VoIP Gateway FXS
Class AudioCodes | embedded || VOIP Gateway
Class AudioCodes | embedded || VoIP gateway
TSeq(Class=TD%gcd=<3D094%SI=<1E%IPID=I%TS=1000HZ)
T1(DF=N%W=209D%ACK=S++%Flags=AS%Ops=MENWNNT)
T2(Resp=N)
@@ -3567,7 +3567,7 @@ PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)
# telephone to be used as a voice-over-IP phone. There is a
# variation, the ATA 188 that has a pass-through port, much like the
# Cisco 7960 phone.
Fingerprint Cisco ATA 186 POTS<->VOIP phone gateway device
Fingerprint Cisco ATA 186 POTS<->VoIP phone gateway device
Class Cisco | embedded || VoIP adapter
TSeq(Class=TD%gcd=<A0000%SI=<1E%IPID=I%TS=U)
T1(DF=N%W=3E80%ACK=S++%Flags=AS%Ops=M)
@@ -8062,7 +8062,7 @@ T6(DF=Y%W=C00|1000%ACK=S++%Flags=AR%Ops=)
T7(DF=Y%W=800|C00|400%ACK=S++%Flags=AR%Ops=)
PU(Resp=N)
# Grandstream BudgeTone101 VOIP phone, firmware 1.0.4.50
# Grandstream BudgeTone101 VoIP phone, firmware 1.0.4.50
Fingerprint Grandstream BT-101 IP phone
Class GrandStream | embedded || VoIP phone
TSeq(Class=C%Val=75DFD55D%IPID=I%TS=U)
@@ -8252,7 +8252,7 @@ PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=F%RIPCK=0%UCK=0%ULEN=134%DAT=E)
# HP Deskjet 6127, firmware FD4R019A
Fingerprint HP Deskjet 6127 printer or InkJet 1200 printer server
Class HP | embedded || printer
Class HP | embedded || printer server
Class HP | embedded || print server
TSeq(Class=TD%gcd=<3D094%SI=<14%IPID=I%TS=1000HZ)
T1(DF=Y|N%W=8E5%ACK=S++%Flags=AS%Ops=MENWNNT)
T2(Resp=N)
@@ -9797,7 +9797,7 @@ PU(Resp=N)
# innovaphone 200 V4.00 sr4 IP200[02-4283], Bootcode[205], HW[202] 2048/8192
# innovaphone IP400 V4.00 hotfix IP400[02-4253], Bootcode[315], HW[102] 2048/4096
Fingerprint innovaphone IP200/IP400 VOIP phone/gateway
Fingerprint innovaphone IP200/IP400 VoIP phone/gateway
Class innovaphone | embedded || telecom-misc
TSeq(Class=TD%gcd=<714%SI=<14%IPID=I%TS=U)
T1(DF=N%W=FA0|2800%ACK=S++%Flags=AS%Ops=M)
@@ -10174,7 +10174,7 @@ T7(DF=N%W=0%ACK=S++%Flags=AR%Ops=)
PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)
Fingerprint KIRK Wireless Server 600
Class KIRK | embedded || VoIP Gateway
Class KIRK | embedded || VoIP gateway
TSeq(Class=TD%gcd=<714%SI=<14%IPID=I%TS=U)
T1(DF=N%W=2800%ACK=S++%Flags=AS%Ops=ME)
T2(Resp=Y%DF=N%W=0%ACK=S%Flags=AR%Ops=)
@@ -10845,8 +10845,8 @@ PU(Resp=N)
# Linksys BEFSR81v2 Router with firmware 2.45.10
# Linksys EtherFast Cable/DSL Router (Model: BEFSR41 Ver 2)(Updated Firmware ver. 1.46.02, Aug 03+2004)
# Linksys Wireless-B Broadband Router BEFW11S4 Firmware v.1.50.14
# Linksys RT31P2 VOIP router (Vonage; firmware version 1.28.00; internal interface)
Fingerprint Linksys BEFW11S4/BEFSR41/BEFSR81/WRK54G broadband router or RT31P2 VOIP router
# Linksys RT31P2 VoIP router (Vonage; firmware version 1.28.00; internal interface)
Fingerprint Linksys BEFW11S4/BEFSR41/BEFSR81/WRK54G broadband router or RT31P2 VoIP router
Class Linksys | embedded || WAP
TSeq(Class=TD%gcd=<FF%SI=<1E%IPID=I%TS=U)
T1(DF=N%W=16D0%ACK=S++%Flags=AS%Ops=M)
@@ -16213,7 +16213,7 @@ T5(DF=N%W=0%ACK=O%Flags=R%Ops=)
T6(DF=N%W=0%ACK=O%Flags=R%Ops=)
T7(DF=N%W=0%ACK=O%Flags=R%Ops=)
Fingerprint MultiTech MultiVOIP Version 2.01A Firmware
Fingerprint MultiTech MultiVoIP Version 2.01A Firmware
Class MultiTech | embedded || telecom-misc
TSeq(Class=TD%gcd=<714%SI=<14)
T1(DF=N%W=600%ACK=S++%Flags=AS%Ops=M)
@@ -16251,7 +16251,7 @@ PU(Resp=Y%DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=F%ULEN=134%DAT=E)
# Multi-Tech Voice over IP Box. Model number (MultiVoip 2410)
Fingerprint MultiTech MultiVoip 2410
Class MultiTech | embedded || VOIP Gateway
Class MultiTech | embedded || VoIP gateway
TSeq(Class=TD%gcd=<1F502%SI=<1E%TS=U)
T1(DF=N%W=2000%ACK=S++%Flags=AS%Ops=M)
T2(Resp=Y%DF=N%W=400|800%ACK=S%Flags=AR%Ops=WNMETL)
@@ -19808,13 +19808,13 @@ T6(DF=N%W=0%ACK=O%Flags=R%Ops=)
T7(DF=N%W=0%ACK=S%Flags=AR%Ops=)
PU(DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=0%UCK=E%ULEN=134%DAT=E)
# Sipura SPA-2000 VOIP Firmware version 2.09d
# SPA-841 VOIP Phone (SIP) with firmware 0.9.5
# Sipura SPA-2000 VoIP Firmware version 2.09d
# SPA-841 VoIP Phone (SIP) with firmware 0.9.5
# Sipura SPA SPA-1000 Software Version: 1.0.33 Hardware Version: 2.0.1
# Sipura SPA-2000 VoIP Adapter
# Sipura SPA-2000 Software Version: 2.0.10(d) IP Phone Adaptor
# Sipura SPA-3000, firmware 2.0.13(GWg)
Fingerprint Sipura SPA-841/1000/2000/3000 POTS<->VOIP gateway
Fingerprint Sipura SPA-841/1000/2000/3000 POTS<->VoIP gateway
Class Sipura | embedded || VoIP adapter
TSeq(Class=TR%gcd=<6%IPID=I%TS=U)
T1(DF=N%W=3E80%ACK=S++%Flags=AS%Ops=M)
@@ -20907,7 +20907,7 @@ PU(DF=N%TOS=0%IPLEN=70%RIPTL=148%RID=E%RIPCK=E%UCK=E%ULEN=134%DAT=E)
# Signal Network Technology Co, Ltd, VoIP appliance model sp100x running firmware version SP100X3.0.1
Fingerprint CPV Telsey broadband + voip residential gateway or Signal SP100x VoIP appliance
Class Telsey | embedded || broadband router
Class Signal | embedded || VoIP Gateway
Class Signal | embedded || VoIP gateway
TSeq(Class=TD%gcd=<138C%SI=<1E%IPID=I%TS=U)
T1(DF=N%W=578%ACK=S++%Flags=AS%Ops=M)
T2(Resp=N)

View File

@@ -1981,6 +1981,7 @@ pcanywheredata 5631/tcp #
pcanywherestat 5632/tcp #
pcanywherestat 5632/udp #
canna 5680/tcp # Canna (Japanese Input)
activesync 5679/tcp # Microsoft ActiveSync PDY synchronization
proshareaudio 5713/tcp # proshare conf audio
proshareaudio 5713/udp # proshare conf audio
prosharevideo 5714/tcp # proshare conf video

View File

@@ -104,7 +104,7 @@
#ifndef NMAP_WINCONFIG_H
#define NMAP_WINCONFIG_H
#define NMAP_VERSION "3.82"
#define NMAP_VERSION "3.83.DC14"
#define NMAP_NAME "nmap"
#define NMAP_URL "http://www.insecure.org/nmap"
#define NMAP_PLATFORM "i686-pc-windows-windows"

View File

@@ -502,7 +502,7 @@ log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT, "%d service%s unrecognized despite ret
log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT, "%s\n", saved_servicefps[i]);
}
}
log_flush_all();
}
char* xml_convert (const char* str) {
@@ -737,6 +737,7 @@ void output_ports_to_machine_parseable_output(struct scan_lists *ports,
if (protsscanned)
output_rangelist_given_ports(LOG_MACHINE, ports->prots, protsscanned);
log_write(LOG_MACHINE, ")\n");
log_flush_all();
}
/* Simple helper function for output_xml_scaninfo_records */
@@ -773,6 +774,7 @@ void output_xml_scaninfo_records(struct scan_lists *scanlist) {
doscaninfo("udp", "udp", scanlist->udp_ports, scanlist->udp_count);
if (o.ipprotscan)
doscaninfo("ipproto", "ip", scanlist->prots, scanlist->prot_count);
log_flush_all();
}
/* Helper function to write the status and address/hostname info of a host
@@ -787,6 +789,7 @@ static void write_xml_initial_hostinfo(Target *currenths,
} else /* If machine is up, put blank hostname so front ends know that
no name resolution is forthcoming */
if (strcmp(status, "up") == 0) log_write(LOG_XML, "<hostnames />\n");
log_flush_all();
}
/* Writes host status info to the log streams (including STDOUT). An
@@ -980,6 +983,7 @@ static void printosclassificationoutput(const struct OS_Classification_Results *
log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT, "\n");
}
}
log_flush_all();
return;
}
@@ -1189,6 +1193,7 @@ void printosscanoutput(Target *currenths) {
log_write(LOG_XML, " />\n");
}
}
log_flush_all();
}
@@ -1288,7 +1293,7 @@ void printserviceinfooutput(Target *currenths) {
}
log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT, "\n");
log_flush_all();
}
@@ -1324,7 +1329,7 @@ void printfinaloutput(int numhosts_scanned, int numhosts_up,
log_write(LOG_NORMAL|LOG_MACHINE, "# Nmap run completed at %s -- %d %s (%d %s up) scanned in %.3f seconds\n", mytime, numhosts_scanned, (numhosts_scanned == 1)? "IP address" : "IP addresses", numhosts_up, (numhosts_up == 1)? "host" : "hosts", o.TimeSinceStartMS(&tv) / 1000.0 );
log_write(LOG_XML, "</runstats></nmaprun>\n");
log_flush_all();
}

View File

@@ -320,7 +320,7 @@ void Port::setServiceProbeResults(enum serviceprobestate sres,
if (hostname) {
slen = strlen(hostname);
if (slen > 128) slen = 128;
if (slen > 64) slen = 64;
serviceprobe_hostname = (char *) safe_malloc(slen + 1);
memcpy(serviceprobe_hostname, hostname, slen);
serviceprobe_hostname[slen] = '\0';

View File

@@ -105,6 +105,7 @@
#include "scan_engine.h"
#include "timing.h"
#include "NmapOps.h"
#include <dnet.h>
#include <list>
using namespace std;
@@ -727,7 +728,7 @@ HostScanStats::HostScanStats(Target *t, UltraScanInfo *UltraSI) {
num_probes_waiting_retransmit = 0;
lastping_sent = lastprobe_sent = lastrcvd = USI->now;
lastping_sent_numprobes = 0;
bzero(&pingprobe, sizeof(pingprobe));
memset(&pingprobe, 0, sizeof(pingprobe));
pingprobestate = PORT_UNKNOWN;
nxtpseq = 1;
max_successful_tryno = 0;

View File

@@ -146,8 +146,9 @@ distro:
/usr/tmp/nmap-$(NMAP_VERSION)/libpcre
$(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/libdnet-stripped
cd ../$(LIBDNETDIR); cp -ra NMAP_MODIFICATIONS acconfig.h aclocal.m4 \
config configure configure.in dnet-config.in include INSTALL \
cd ../$(LIBDNETDIR); cp -ra NMAP_MODIFICATIONS \
libdnet-stripped.vcproj acconfig.h aclocal.m4 config \
configure configure.in dnet-config.in include INSTALL \
libtool LICENSE Makefile Makefile.am Makefile.am.common \
Makefile.in README src THANKS TODO \
/usr/tmp/nmap-$(NMAP_VERSION)/libdnet-stripped

183
tcpip.cc
View File

@@ -1716,7 +1716,7 @@ int read_arp_reply_pcap(pcap_t *pd, u8 *sendermac, struct in_addr *senderIP,
do {
#ifdef WIN32
gettimeofday(&tv_end, NULL);
to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
long to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
// Set the timeout (BUGBUG: this is cheating)
PacketSetReadTimeout(pd->adapter, to_left);
#endif
@@ -2106,28 +2106,146 @@ return -1;
}
#endif /* WIN32 */
#ifndef WIN32 /* ifdef'd out for now because 'doze apparently doesn't
support ioctl() */
struct dnet_collector_route_nfo {
struct sys_route *routes;
int numroutes;
int capacity; /* Capacity of routes or ifaces, depending on context */
struct interface_info *ifaces;
int numifaces;
};
int collect_dnet_routes(const struct route_entry *entry, void *arg) {
struct dnet_collector_route_nfo *dcrn = (struct dnet_collector_route_nfo *) arg;
int i;
/* Make sure that it is the proper type of route ... */
if (entry->route_dst.addr_type != ADDR_TYPE_IP || entry->route_gw.addr_type != ADDR_TYPE_IP)
return 0; /* Not interested in IPv6 routes at the moment ... */
/* Make sure we have room for the new route */
if (dcrn->numroutes >= dcrn->capacity) {
dcrn->capacity <<= 2;
dcrn->routes = (struct sys_route *) realloc(dcrn->routes,
dcrn->capacity * sizeof(struct sys_route));
}
/* Now for the important business */
dcrn->routes[dcrn->numroutes].dest = entry->route_dst.addr_ip;
addr_btom(entry->route_dst.addr_bits, &dcrn->routes[dcrn->numroutes].netmask, sizeof(dcrn->routes[dcrn->numroutes].netmask));
dcrn->routes[dcrn->numroutes].gw.s_addr = entry->route_gw.addr_ip;
/* Now determine which interface the route relates to */
u32 mask;
struct sockaddr_in *sin;
for(i = 0; i < dcrn->numifaces; i++) {
sin = (struct sockaddr_in *) &dcrn->ifaces[i].addr;
mask = htonl((unsigned long) (0-1) << (32 - dcrn->ifaces[i].netmask_bits));
if ((sin->sin_addr.s_addr & mask) == (entry->route_gw.addr_ip & mask)) {
dcrn->routes[dcrn->numroutes].device = &dcrn->ifaces[i];
break;
}
}
if (i == dcrn->numifaces) {
error("WARNING: Unable to find appropriate interface for system route to %s\n", addr_ntoa(&entry->route_gw));
return 0;
}
dcrn->numroutes++;
return 0;
}
int collect_dnet_interfaces(const struct intf_entry *entry, void *arg) {
struct dnet_collector_route_nfo *dcrn = (struct dnet_collector_route_nfo *) arg;
int i;
int numifaces = dcrn->numifaces;
/* Make sure we have room for the new route */
if (dcrn->numifaces >= dcrn->capacity) {
dcrn->capacity <<= 2;
dcrn->ifaces = (struct interface_info *) realloc(dcrn->ifaces,
dcrn->capacity * sizeof(struct interface_info));
}
if (entry->intf_addr.addr_type == ADDR_TYPE_IP) {
addr_ntos(&entry->intf_addr, (struct sockaddr *) &dcrn->ifaces[numifaces].addr);
dcrn->ifaces[numifaces].netmask_bits = entry->intf_addr.addr_bits;
} else {
for(i=0; i < (int) entry->intf_alias_num; i++) {
if (entry->intf_alias_addrs[i].addr_type == ADDR_TYPE_IP) {
addr_ntos(&entry->intf_alias_addrs[i], (struct sockaddr *) &dcrn->ifaces[numifaces].addr);
dcrn->ifaces[numifaces].netmask_bits = entry->intf_alias_addrs[i].addr_bits;
break;
}
if (i == (int) entry->intf_alias_num)
return 0; /* No IPv4 addresses found for this interface */
}
}
/* OK, address/netmask found. Let's get the name */
Strncpy(dcrn->ifaces[numifaces].devname, entry->intf_name, sizeof(dcrn->ifaces[numifaces].devname));
Strncpy(dcrn->ifaces[numifaces].devfullname, entry->intf_name, sizeof(dcrn->ifaces[numifaces].devfullname));
/* Interface type */
if (entry->intf_type & INTF_TYPE_ETH) {
dcrn->ifaces[numifaces].device_type = devt_ethernet;
/* Collect the MAC address since this is ethernet */
memcpy(dcrn->ifaces[numifaces].mac, &entry->intf_link_addr.addr_eth.data, 6);
}
else if (entry->intf_type & INTF_TYPE_LOOPBACK)
dcrn->ifaces[numifaces].device_type = devt_loopback;
else if (entry->intf_type & INTF_TYPE_TUN)
dcrn->ifaces[numifaces].device_type = devt_p2p;
else dcrn->ifaces[numifaces].device_type = devt_other;
/* Is the interface up and running? */
dcrn->ifaces[numifaces].device_up = (entry->intf_flags & INTF_FLAG_UP)? true : false;
/* For the rest of the information, we must open the interface directly ... */
dcrn->numifaces++;
return 0;
}
struct interface_info *getinterfaces(int *howmany) {
static bool initialized = 0;
static struct interface_info *mydevs;
static int numifaces = 0;
int ii_capacity = 0;
int sd, len, rc;
char *p;
u8 *buf;
int bufsz;
#if WIN32
struct dnet_collector_route_nfo dcrn;
intf_t *it;
#else //!WIN32
int sd;
struct ifconf ifc;
struct ifreq *ifr;
struct ifreq tmpifr;
#endif
int len, rc;
char *p;
u8 *buf;
int bufsz;
struct sockaddr_in *sin;
u16 ifflags;
if (!initialized) {
initialized = 1;
ii_capacity = 16;
mydevs = (struct interface_info *) safe_zalloc(sizeof(struct interface_info) * ii_capacity);
#if WIN32
/* On Win32 we just use Dnet to determine the interface list */
dcrn.routes = NULL;
dcrn.numroutes = 0;
dcrn.capacity = ii_capacity; // I'm reusing this struct for ii now
dcrn.ifaces = mydevs;
dcrn.numifaces = 0;
it = intf_open();
if (!it) fatal("%s: intf_open() failed", __FUNCTION__);
if (intf_loop(it, collect_dnet_interfaces, &dcrn) != 0)
fatal("%s: intf_loop() failed", __FUNCTION__);
intf_close(it);
mydevs = dcrn.ifaces;
numifaces = dcrn.numifaces;
ii_capacity = dcrn.capacity;
#else // !Win32
/* Dummy socket for ioctl */
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) pfatal("socket in getinterfaces");
@@ -2253,58 +2371,13 @@ struct interface_info *getinterfaces(int *howmany) {
}
free(buf);
close(sd);
#endif //!WIN32
}
if (howmany) *howmany = numifaces;
return mydevs;
}
#endif
struct dnet_collector_route_nfo {
struct sys_route *routes;
int numroutes;
int route_capacity;
struct interface_info *ifaces;
int numifaces;
};
int collect_dnet_routes(const struct route_entry *entry, void *arg) {
struct dnet_collector_route_nfo *dcrn = (struct dnet_collector_route_nfo *) arg;
int i;
/* Make sure that it is the proper type of route ... */
if (entry->route_dst.addr_type != ADDR_TYPE_IP || entry->route_gw.addr_type != ADDR_TYPE_IP)
return 0; /* Not interested in IPv6 routes at the moment ... */
/* Make sure we have room for the new route */
if (dcrn->numroutes >= dcrn->route_capacity) {
dcrn->route_capacity <<= 2;
dcrn->routes = (struct sys_route *) realloc(dcrn->routes,
dcrn->route_capacity * sizeof(struct sys_route));
}
/* Now for the important business */
dcrn->routes[dcrn->numroutes].dest = entry->route_dst.addr_ip;
addr_btom(entry->route_dst.addr_bits, &dcrn->routes[dcrn->numroutes].netmask, sizeof(dcrn->routes[dcrn->numroutes].netmask));
dcrn->routes[dcrn->numroutes].gw.s_addr = entry->route_gw.addr_ip;
/* Now determine which interface the route relates to */
u32 mask;
struct sockaddr_in *sin;
for(i = 0; i < dcrn->numifaces; i++) {
sin = (struct sockaddr_in *) &dcrn->ifaces[i].addr;
mask = htonl((unsigned long) (0-1) << (32 - dcrn->ifaces[i].netmask_bits));
if ((sin->sin_addr.s_addr & mask) == (entry->route_gw.addr_ip & mask)) {
dcrn->routes[dcrn->numroutes].device = &dcrn->ifaces[i];
break;
}
}
if (i == dcrn->numifaces) {
error("WARNING: Unable to find appropriate interface for system route to %s\n", addr_ntoa(&entry->route_gw));
return 0;
}
dcrn->numroutes++;
return 0;
}
/* A trivial function used with qsort to sort the routes by netmask */
static int nmaskcmp(const void *a, const void *b) {
@@ -2429,7 +2502,7 @@ struct sys_route *getsysroutes(int *howmany) {
struct dnet_collector_route_nfo dcrn;
dcrn.routes = routes;
dcrn.numroutes = numroutes;
dcrn.route_capacity = route_capacity;
dcrn.capacity = route_capacity;
dcrn.ifaces = ifaces;
dcrn.numifaces = numifaces;
route_t *dr = route_open();
@@ -2439,7 +2512,7 @@ struct sys_route *getsysroutes(int *howmany) {
}
route_close(dr);
/* These values could have changed in the callback */
route_capacity = dcrn.route_capacity;
route_capacity = dcrn.capacity;
numroutes = dcrn.numroutes;
routes = dcrn.routes;
}

View File

@@ -230,7 +230,9 @@ extern "C" {
#include <errno.h>
#include <signal.h>
#include <dnet.h>
#ifndef WIN32
#include <netinet/ip_icmp.h>
#endif
typedef enum { devt_ethernet, devt_loopback, devt_p2p, devt_other } devtype;
@@ -413,8 +415,6 @@ struct icmp
u_int16_t icmp_cksum; /* ones complement checksum of struct */
union
{
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* gateway address */
struct ih_idseq /* echo datagram */
{
u_int16_t icd_id;
@@ -436,8 +436,7 @@ struct icmp
u_int16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
/* Removed icmp_pptr and icmp_gwaddr from union and #defines because they conflict with dnet */
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void