From owner-freebsd-questions@FreeBSD.ORG Mon Jul 23 15:29:39 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB850106564A for ; Mon, 23 Jul 2012 15:29:39 +0000 (UTC) (envelope-from yanglei.fage@gmail.com) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 811128FC12 for ; Mon, 23 Jul 2012 15:29:39 +0000 (UTC) Received: by qcsg15 with SMTP id g15so3983561qcs.13 for ; Mon, 23 Jul 2012 08:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5imkt7VFypTcSanckNwpgQrstdzXzWHPAmp/fXIZnoI=; b=lBNeRdl6PK/YpSjlyZrENQ33+jAVOPj7bSDvo3UUULwvpHZPW6COEfDrU0ycbCrmfk a1ZkGOHfLG7Tz+J1AcFj/Px+eqIrKzT2z+0CpUtyZ9dIzMIBsAAxR/P7EsdgAZeTmAIe Gv2CrjQjuTg/UOvxCHNWP7LumFzYNP02o7FaBujOS1LO/33XX1Esw9pupkyz48uaPkrR aLmZZUwKchkwn7EMQpjqOk+nKVr/SAdJHjbHyWhNsFQun5ws0tw7r0kyYtvyAy9rjd+N rQimfo6E70IvhbNaohfolMijc/8svZxt1a3T3qnRDvMe/LKB1cmgijkn2AVyl8hH7WOh UnCA== MIME-Version: 1.0 Received: by 10.224.202.136 with SMTP id fe8mr25160103qab.17.1343057378990; Mon, 23 Jul 2012 08:29:38 -0700 (PDT) Received: by 10.229.169.132 with HTTP; Mon, 23 Jul 2012 08:29:38 -0700 (PDT) In-Reply-To: <20120723163604.6e795aa4.freebsd@edvax.de> References: <20120722182545.39d6b96c.freebsd@edvax.de> <20120723163604.6e795aa4.freebsd@edvax.de> Date: Mon, 23 Jul 2012 23:29:38 +0800 Message-ID: From: lei yang To: Polytropon Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org Subject: Re: help about free bsp version netcat to work it on ubuntu X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2012 15:29:39 -0000 On Mon, Jul 23, 2012 at 10:36 PM, Polytropon wrote: > On Mon, 23 Jul 2012 12:59:55 +0800, lei yang wrote: >> On Mon, Jul 23, 2012 at 12:25 AM, Polytropon 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 > > This indicates you did use the netcat version that also is > in the FreeBSD Ports Collection. The netcat version that > belongs to the FreeBSD system (the operating system itself) > does seem to have the switch you need. > > From my home FreeBSD box (8.2-STABLE of August 2011, i386), > THIS is the netcat help message: > > % nc -help > usage: nc [-46DdEhklnrStUuvz] [-e policy] [-I length] [-i interval] [-O length] > [-P proxy_username] [-p source_port] [-s source] [-T ToS] > [-V rtable] [-w timeout] [-X proxy_protocol] > [-x proxy_address[:port]] [destination] [port] > Command Summary: > -4 Use IPv4 > -6 Use IPv6 > -D Enable the debug socket option > -d Detach from stdin > -E Use IPsec ESP > -e policy Use specified IPsec policy > -h This help text > -I length TCP receive buffer length > -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 > --no-tcpopt Disable TCP options > -O length TCP send buffer length > -P proxyuser Username for proxy authentication > -p port Specify local port for remote connects > -r Randomize remote ports > -S Enable the TCP MD5 signature option > -s addr Local source address > -T ToS Set IP Type of Service > -t Answer TELNET negotiation > -U Use UNIX domain socket > -u UDP mode > -V rtable Specify alternate routing table > -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] > See ipsec_set_policy(3) for -e argument format > > > > It seems you sould then try to use the FreeBSD's netcat sources. > In my previous message, I pointed out where to find it (i. e. in > the system's sources). > Yes, the second version I post is using the source from you supplied, then I compiled it, but it has no "-U" flag like what I post, it seems a version different casued this. > By the way, wouldn't it be easier to use Red Hat's netcat source > to compile on Ubuntu, because both are Linusi (and therefore should > be "more equal" to each other than Ubuntu to FreeBSD)? > > I don't know where to find the source code in Red Hat. > > -- > Polytropon > Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ...