Nmap Development mailing list archives

Re: Ncat portable for Windows (static edition)


From: David Fifield <david () bamsoftware com>
Date: Wed, 22 Jun 2011 09:57:34 -0700

On Wed, Jun 22, 2011 at 07:31:46PM +0300, Shinnok wrote:
On 6/21/2011 11:19 PM, Shinnok wrote:
On 06/21/2011 10:07 PM, David Fifield wrote:
Thanks for figuring all this out. How about adding a new configuration
("Portable" or "Static", based on current "Release") that does these
things? You might need to do the same for the nsock project. I think you
can find a compiler flag to define DISABLE_NSOCK_PCAP rather than
editing a source file.
Definetly do-able. Will ping back when done.

Done in r24242:

Add a build configuration to the MS Visual Studio Nmap solution
that builds only Ncat Portable (statically linked).

Thanks for doing this. I tried buidling it, but got some errors. They
appear to be related to Nsock still using pcap. Did you find a way to
disable pcap in the compiler command line?

------ Rebuild All started: Project: ncat, Configuration: Static Win32 ------
  Copying ca-bundle.crt to output directory...
  base64.c
  http.c
  http_digest.c
  ncat_broker.c
  ncat_connect.c
  ncat_core.c
  ncat_exec_win.c
  ncat_listen.c
  ncat_main.c
  ncat_proxy.c
  ncat_ssl.c
  ncat_win.c
  sys_wrap.c
  util.c
  Generating Code...
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
nsock.lib(nsock_iod.obj) : error LNK2019: unresolved external symbol _pcap_close referenced in function _nsi_delete
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_setnonblock referenced in function 
_nsock_pcap_open
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_setmintocopy referenced in function 
_nsock_pcap_open
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_open_live referenced in function 
_nsock_pcap_open
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_freecode referenced in function "char * 
__cdecl nsock_pcap_set_filter(struct pcap *,char const *,char const *)" (?nsock_pcap_set_filter@@YAPADPAUpcap@@PBD1@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_setfilter referenced in function "char * 
__cdecl nsock_pcap_set_filter(struct pcap *,char const *,char const *)" (?nsock_pcap_set_filter@@YAPADPAUpcap@@PBD1@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_geterr referenced in function "char * 
__cdecl nsock_pcap_set_filter(struct pcap *,char const *,char const *)" (?nsock_pcap_set_filter@@YAPADPAUpcap@@PBD1@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_compile referenced in function "char * 
__cdecl nsock_pcap_set_filter(struct pcap *,char const *,char const *)" (?nsock_pcap_set_filter@@YAPADPAUpcap@@PBD1@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_lookupnet referenced in function "char * 
__cdecl nsock_pcap_set_filter(struct pcap *,char const *,char const *)" (?nsock_pcap_set_filter@@YAPADPAUpcap@@PBD1@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_datalink referenced in function "int 
__cdecl nsock_pcap_get_l3_offset(struct pcap *,int *)" (?nsock_pcap_get_l3_offset@@YAHPAUpcap@@PAH@Z)
nsock.lib(nsock_pcap.obj) : error LNK2019: unresolved external symbol _pcap_next_ex referenced in function "int __cdecl 
do_actual_pcap_read(struct msevent *)" (?do_actual_pcap_read@@YAHPAUmsevent@@@Z)
.\Release/ncat.exe : fatal error LNK1120: 11 unresolved externals
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========

I think that will cover everything needed except for building OpenSSL
statically.

David Fifield
There's a solutions for this too, how about adding the static version of
the ssl libs to svn too?

ls -lsh
total 14M
 13M -rw------- 1 shinnok shinnok  13M Jun 19 11:46 libeay32.lib
1.8M -rw------- 1 shinnok shinnok 1.8M Jun 19 11:46 ssleay32.lib

These two approaches combined would make building Ncat portable a matter
of switching the build configuration.
What do you think? Including those libs would be too much? Libeay32
is esp. big and there
not much we can do about it.

I don't know that this static build will be common enough that we want
to burden every downloader with extra libraries. If all someone has to
do is build OpenSSL statically according to your instructions and choose
this build configuration, I think that's pretty good.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: