Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2012 12:59:55 +0800
From:      lei yang <yanglei.fage@gmail.com>
To:        Polytropon <freebsd@edvax.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: help about free bsp version netcat to work it on ubuntu
Message-ID:  <CAHsH0E9NkghmTPB=81bdquxq58kNFWuzyQAnzgZrhM54S7n9vA@mail.gmail.com>
In-Reply-To: <20120722182545.39d6b96c.freebsd@edvax.de>
References:  <CAHsH0E_mj-g3YZcuMe0%2BDYLy_6=gzJNrhFE=CAy2SmiufUCAYA@mail.gmail.com> <20120722182545.39d6b96c.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 23, 2012 at 12:25 AM, Polytropon <freebsd@edvax.de> wrote:
> On Sun, 22 Jul 2012 22:41:57 +0800, lei yang wrote:
>> Hi,
>>
>> I want to build a "netcat" on my local pc (ubuntu) with gcc, is it
>> possible? I'm new to free bsd
>
> I hope I don't misunderstand your intention: You are trying to
> build a Linux executable of netcat from FreeBSD's sources?
>
> You _do_ know that FreeBSD and Linux (here: Ubuntu) are two
> totally different operating systems. I'm not sure code is
> compatible at this level (but it maybe _could_ be, you'd
> have to try it).
>
> The netcat program (nc) is part of the FreeBSD operating
> system for some time now. There's also a port of netcat
> in /usr/ports/net/netcat (which can also be used). That
> port's Makefile lists some sources:
>
> ftp://coast.cs.purdue.edu/pub/tools/unix/netutils/netcat/
>
> ftp://ftp.cuhk.edu.hk/pub/packages/security/purdue/netutils/netcat/
>
> http://www.planetmirror.com/pub/lprng/TOOLS/
>
> You could try to use that source distribution as well.
>
>


Thanks for the great help, I have built it successfully on my ubuntu.
I find it's not the version I want
I want use the version on Rehat,which has a "-U" flag( yes, I want to
use this flag) but the above version has no this flag

on redhat:

usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
	  [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
	  [-x proxy_address[:port]] [hostname] [port[s]]
	Command Summary:
		-4		Use IPv4
		-6		Use IPv6
		-D		Enable the debug socket option
		-d		Detach from stdin
		-h		This help text
		-i secs		Delay interval for lines sent, ports scanned
		-k		Keep inbound sockets open for multiple connects
		-l		Listen mode, for inbound connects
		-n		Suppress name/port resolutions
		-p port		Specify local port for remote connects
		-r		Randomize remote ports
 		-s addr		Local source address
		-T ToS		Set IP Type of Service
		-C		Send CRLF as line-ending
		-t		Answer TELNET negotiation
		-U		Use UNIX domain socket
		-u		UDP mode
		-v		Verbose
		-w secs		Timeout for connects and final net reads
		-X proto	Proxy protocol: "4", "5" (SOCKS) or "connect"
		-x addr[:port]	Specify proxy address and port
		-z		Zero-I/O mode [used for scanning]
	Port numbers can be individual or ranges: lo-hi [inclusive]

------------------------------------------------------------------------------------------------------------------
with the above you list:

lyang0@lyang0-OptiPlex-755:~/tmp/nc110$ ./nc -help
[v1.10]
connect to somewhere:	nc [-options] hostname port[s] [ports] ...
listen for inbound:	nc -l -p port [-options] [hostname] [port]
options:
	-g gateway		source-routing hop point[s], up to 8
	-G num			source-routing pointer: 4, 8, 12, ...
	-h			this cruft
	-i secs			delay interval for lines sent, ports scanned
	-l			listen mode, for inbound connects
	-n			numeric-only IP addresses, no DNS
	-o file			hex dump of traffic
	-p port			local port number
	-r			randomize local and remote ports
	-s addr			local source address
	-u			UDP mode
	-v			verbose [use twice to be more verbose]
	-w secs			timeout for connects and final net reads
	-z			zero-I/O mode [used for scanning]
port numbers can be individual or ranges: lo-hi [inclusive]


it has no "-U" flag, can you point me where I get this version

Lei





>
>> I have to quesion:
>> 1)where to download it's source it for "netcat"
>
> They can be found in /usr/src/contrib/netcat/ once you have
> extracted the source distribution of FreeBSD. Depending on
> which version of the OS (branch, revision, platform) you
> need, you have to select the corresponding archive from
> one of the download mirrors.
>
> Visit http://www.freebsd.org/ to find out where and how
> to obtain FreeBSD (or components of it). I would suggest
> using one of the FTP servers that are accessible for you
> at a good speed.
>
>
>
>> 2)how to build it on ubuntu with gcc? only make?
>
> I'm not even sure Linux will be able to compile FreeBSD
> sources. A "typical Linux build" would consist of the
> three commands
>
>         # ./configure
>         # make
>         # make install
>
> but FreeBSD's OS sources don't need the 1st step. The
> Makefiles distributed also do use "BSD make", not "GNU make"
> (often refered to as gmake on non-Linux systems).
>
>
>
> If this isn't the answer to your question, feel free to be
> more specific.
>
>
> --
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHsH0E9NkghmTPB=81bdquxq58kNFWuzyQAnzgZrhM54S7n9vA>