Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
Netcat is a simple Unix utility which reads and writes data across
network connections, using TCP or UDP protocol. It is designed to
be a reliable "back-end" tool that can be used directly or easily
driven by other programs and scripts. At the same time, it is a
feature-rich network debugging and exploration tool, since it can
create almost any kind of connection you would need and has several
interesting built-in capabilities.
+60
View File
@@ -0,0 +1,60 @@
# $NetBSD: Makefile,v 1.37 2013/04/10 08:00:10 obache Exp $
DISTNAME= nc110
PKGNAME= netcat-1.10
PKGREVISION= 3
CATEGORIES= net
MASTER_SITES= ftp://coast.cs.purdue.edu/pub/tools/unix/netutils/netcat/
EXTRACT_SUFX= .tgz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://nc110.sourceforge.net/
COMMENT= Read and write data across network connections
PKG_INSTALLATION_TYPES= overwrite pkgviews
WRKSRC= ${WRKDIR}
MAKE_ENV+= DFLAGS="-DGAPING_SECURITY_HOLE -DTELNET"
.include "../../mk/bsd.prefs.mk"
NC_TARGET.${OPSYS}?= ${LOWER_OPSYS}
NC_TARGET.IRIX= irix
NC_TARGET.Interix= netbsd
NC_TARGET.OpenBSD= netbsd
NC_TARGET.DragonFly= freebsd
NC_TARGET.Darwin= generic
BUILD_TARGET= ${NC_TARGET.${OPSYS}}
EXTRA_PROGS= data rservice xor
EXAMPLE_DIR= share/examples/nc
PLIST_SRC= ${PKGDIR}/PLIST ${WRKSRC}/data/PLIST.data
INSTALLATION_DIRS= ${PKGMANDIR}/man1 sbin
post-build:
@cd ${WRKSRC}/data && ${SETENV} ${MAKE_ENV} ${MAKE} ${EXTRA_PROGS}
# Note: the nc binary is installed into sbin to avoid a conflict with
# editors/nedit.
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/nc ${DESTDIR:Q}${PREFIX:Q}/sbin
.for i in ${EXTRA_PROGS}
${INSTALL_PROGRAM} ${WRKSRC}/data/${i} \
${DESTDIR:Q}${PREFIX:Q}/sbin/nc-${i}
.endfor
${INSTALL_DATA_DIR} ${DESTDIR:Q}${PREFIX:Q}/${EXAMPLE_DIR}
@( \
cd ${WRKSRC}/data; \
${RM} -f PLIST.data; \
for i in README Makefile *.c *.d; \
do \
${INSTALL_DATA} $$i ${DESTDIR:Q}${PREFIX:Q}/${EXAMPLE_DIR}; \
${ECHO} ${EXAMPLE_DIR}/$$i >> PLIST.data; \
done; \
)
${INSTALL_MAN} ${FILESDIR}/nc.1 \
${DESTDIR:Q}${PREFIX:Q}/${PKGMANDIR}/man1/nc.1
.include "../../mk/bsd.pkg.mk"
+6
View File
@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.1 2001/10/31 22:56:39 zuntum Exp $
sbin/nc
sbin/nc-data
sbin/nc-rservice
sbin/nc-xor
man/man1/nc.1
+11
View File
@@ -0,0 +1,11 @@
$NetBSD: distinfo,v 1.11 2011/01/13 15:09:58 pooka Exp $
SHA1 (nc110.tgz) = f8ec3a39796b141b6654d39b7957b863c7f79a95
RMD160 (nc110.tgz) = 3e891fa094d921940e53035fb6721e2f0c04efdb
Size (nc110.tgz) = 75267 bytes
SHA1 (patch-aa) = 44dc8cf9072a1c127925a4efed6bb7f1428360bc
SHA1 (patch-ab) = 73990f9a87b04fffb22b94873e3225bd8ee496b5
SHA1 (patch-ac) = 8b0c41953ab0237304a31fb999e27a51df8cb0a9
SHA1 (patch-ad) = 0e6e3234a1abbec1151705a0c21bc1b7a87044f4
SHA1 (patch-ae) = f76fb4b4c593a7951d0c62745f599ef747360514
SHA1 (patch-af) = 45b3824ff84c2557b0016d97b0309d5c8b597690
+128
View File
@@ -0,0 +1,128 @@
.\" $NetBSD: nc.1,v 1.3 2004/02/01 00:17:17 snj Exp $
.Dd October 1, 1999
.Dt NC 1
.Sh NAME
.Nm nc (netcat)
.Nd use network sockets from the command line
.Sh SYNOPSIS
.Nm
.Op Fl h
.Nm ""
.Op Fl ruvz
.Op Fl g Ar gateway
.Op Fl G Ar num
.Op Fl i Ar secs
.Op Fl p Ar port
.Op Fl o Ar file
.Op Fl s Ar addr
.Op Fl w Ar secs
.Ar hostname port[s] [ports] ...
.Ek
.Nm ""
.Ar -l
.Ar -p port
.Op Fl nsuvwz
.Op Fl o Ar file
.Ar [hostname] [port]
.\" ae:g:G:hi:lno:p:rs:tuvw:z
.\"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]
.Sh DESCRIPTION
.Nm
allows you to use network sockets (tcp or udp) from the shell. I'm
merely writing this man page so that i can "man nc" and find out
what I've already forgotten.
.Pp
For connecting to remote sites, it's usually only necessary to supply the
.Ar host
or
.Ar ip address
and
.Ar port
for the connection. For a listening on a socket, you must specify
.Ar -l
for listening, and
.Ar -p port
to specify the port on which you want to listen.
.Pp
The options are as follows (with C and S indicating whether the option
applies to the "client" or "server" roles in a tcp conversation):
.Bl -tag -width Ds
.It Fl g Ar gateway (C)
Specifies a source routing hop for outbound connections.
.It Fl G Ar num (C)
Can be used to specify the source routing pointer in the ip header,
presumably in order to forge unused previous steps in the source
routed path.
.It Fl h
Minor help. Not very helpful, hence this man page.
.It Fl i Ar secs (C)
Delay interval for lines sent or ports scanned.
.It Fl l Ar (S)
Selects "listen" mode instead of connect mode so that people
can connect to you.
.It Fl n Ar (S)
The
.Fl n
option indicates that all ip addresses should be printed out instead
of being looked up in the DNS.
.It Fl o Ar file (CS)
Sends a hex-dump of the traffic to the specified file.
.It Fl p Ar local port number (CS)
When connecting to a remote service, this is the port from which the
connection will originate. When listening for remote clients, this
specifies the local port on which to listen.
.It Fl r Ar (C)
Randomizes local source ports and addresses for outbound connections.
.It Fl s Ar source address (CS)
Specifies the local source address on which to listen, or from which
to connect.
.It Fl u Ar (CS)
Selects UDP transport as opposed to TCP (the default).
.It Fl v Ar (CS)
Turns on verbosity. Use two (or more) for more verbosity.
.It Fl w Ar secs (CS)
This sets a timeout for connects or for final net reads.
.It Fl z Ar (CS)
Zero I/O mode. While mostly used for scanning, I'm sure you could find
a way to use it for connect mode.
.El
.Pp
The
.Nm
utility exits after both input streams (stdin and the remote socket)
have been closed. It doesn't do this very well, and relies rather
heavily on the network layers at both ends for this, and as such, if
microsoft products are used, it might not notice a close because microsoft
sucks.
.Sh SEE ALSO
.Xr cat 1
.Sh HISTORY
The
.Nm
utility, a "damn useful little backend utility" begun 950915 or thereabouts,
as *Hobbit*'s first real stab at some sockets programming. Something that
should have and indeed may have existed ten years ago, but never became a
standard Unix utility. IMHO,
.Nm
could take its place right next to cat,
cp, rm, mv, dd, ls, and all those other cryptic and Unix-like things.
.Sh BUGS
I don't know...I didn't write the damn thing. But there are probably
a bunch. Go blame microsoft.
+12
View File
@@ -0,0 +1,12 @@
$NetBSD: patch-aa,v 1.2 2002/10/08 14:29:36 abs Exp $
--- data/data.c.orig Tue Feb 27 13:43:48 1996
+++ data/data.c
@@ -16,6 +16,7 @@
*Hobbit*, started 951004 or so and randomly screwed around with since */
#include <stdio.h>
+#include <string.h>
#ifdef MSDOS /* for MSC only at the moment... */
#include <fcntl.h>
+12
View File
@@ -0,0 +1,12 @@
$NetBSD: patch-ab,v 1.3 2002/10/08 14:29:36 abs Exp $
--- data/rservice.c.orig Wed Jan 31 18:45:08 1996
+++ data/rservice.c
@@ -10,6 +10,7 @@
... whatever. _H*/
#include <stdio.h>
+#include <string.h>
/* change if you like; "id" is a good one for figuring out if you won too */
static char cmd[] = "pwd";
+12
View File
@@ -0,0 +1,12 @@
$NetBSD: patch-ac,v 1.2 2002/10/08 14:29:36 abs Exp $
--- data/xor.c.orig Sun Feb 18 03:18:16 1996
+++ data/xor.c
@@ -14,6 +14,7 @@
*Hobbit*, 960208 */
#include <stdio.h>
+#include <string.h>
#include <fcntl.h>
char buf[8192];
+164
View File
@@ -0,0 +1,164 @@
$NetBSD: patch-ad,v 1.4 2011/01/13 15:09:58 pooka Exp $
--- netcat.c.orig 1996-03-21 01:38:04.000000000 +0100
+++ netcat.c 2011-01-13 16:06:00.000000000 +0100
@@ -44,12 +44,7 @@
#include <sys/select.h>
#endif
-/* have to do this *before* including types.h. xxx: Linux still has it wrong */
-#ifdef FD_SETSIZE /* should be in types.h, butcha never know. */
-#undef FD_SETSIZE /* if we ever need more than 16 active */
-#endif /* fd's, something is horribly wrong! */
-#define FD_SETSIZE 16 /* <-- this'll give us a long anyways, wtf */
-#include <sys/types.h> /* *now* do it. Sigh, this is broken */
+#include <sys/types.h>
#ifdef HAVE_RANDOM /* aficionados of ?rand48() should realize */
#define SRAND srandom /* that this doesn't need *strong* random */
@@ -151,6 +146,7 @@
/* global cmd flags: */
USHORT o_alla = 0;
+USHORT o_allowbroad = 0;
unsigned int o_interval = 0;
USHORT o_listen = 0;
USHORT o_nflag = 0;
@@ -160,6 +156,7 @@
USHORT o_verbose = 0;
unsigned int o_wait = 0;
USHORT o_zero = 0;
+int o_quit = -1; /* 0 == quit-now; >0 == quit after o_quit seconds */
/* o_tn in optional section */
/* Debug macro: squirt whatever message and sleep a bit so we can see it go
@@ -225,6 +222,14 @@
bail (" punt!");
}
+/* quit :
+ handler for a "-q" timeout (exit 0 instead of 1) */
+void quit()
+{
+ close(netfd);
+ exit(0);
+}
+
/* timeout and other signal handling cruft */
void tmtravel ()
{
@@ -333,6 +338,7 @@
struct in_addr iaddr;
register HINF * poop = NULL;
register int x;
+ int rc;
/* I really want to strangle the twit who dreamed up all these sockaddr and
hostent abstractions, and then forced them all to be incompatible with
@@ -361,9 +367,9 @@
bail ("gethostpoop fuxored");
strcpy (poop->name, unknown); /* preload it */
/* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */
- iaddr.s_addr = inet_addr (name);
+ rc = inet_aton(name, &iaddr);
- if (iaddr.s_addr == INADDR_NONE) { /* here's the great split: names... */
+ if (rc == 0) { /* here's the great split: names... */
if (numeric)
bail ("Can't parse %s as an IP address", name);
hostent = gethostbyname (name);
@@ -620,6 +626,13 @@
rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x));
if (rr == -1)
holler ("nnetfd reuseaddr failed"); /* ??? */
+#ifdef SO_BROADCAST
+ if (o_allowbroad) {
+ rr = setsockopt (nnetfd, SOL_SOCKET, SO_BROADCAST, &x, sizeof (x));
+ if (rr == -1)
+ holler ("nnetfd reuseaddr failed"); /* ??? */
+ }
+#endif
#ifdef SO_REUSEPORT /* doesnt exist everywhere... */
rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
if (rr == -1)
@@ -1216,6 +1229,18 @@
if (rr <= 0) { /* at end, or fukt, or ... */
FD_CLR (0, ding1); /* disable and close stdin */
close (0);
+ /* if the user asked to exit on EOF, do it */
+ if (o_quit == 0) {
+ shutdown(netfd, 1);
+ close (fd);
+ exit (0);
+ }
+ /* if user asked to die after a while, arrange for it */
+ if (o_quit > 0) {
+ shutdown(netfd, 1);
+ signal (SIGALRM, quit);
+ alarm(o_quit);
+ }
} else {
rzleft = rr;
zp = bigbuf_in;
@@ -1314,10 +1339,6 @@
USHORT curport = 0;
char * randports = NULL;
-#ifdef HAVE_BIND
-/* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on SunLOSs? */
- res_init();
-#endif
/* I was in this barbershop quartet in Skokie IL ... */
/* round up the usual suspects, i.e. malloc up all the stuff we need */
lclend = (SAI *) Hmalloc (sizeof (SA));
@@ -1354,7 +1375,8 @@
argv[1] = cp; /* head of new arg block */
fprintf (stderr, "Cmd line: ");
fflush (stderr); /* I dont care if it's unbuffered or not! */
- insaved = read (0, cp, BIGSIZ); /* we're gonna fake fgets() here */
+ insaved = read (0, cp, BIGSIZ-1); /* we're gonna fake fgets() here */
+ cp[BIGSIZ-1] = '\0';
if (insaved <= 0)
bail ("wrong");
x = findline (cp, insaved);
@@ -1389,12 +1411,14 @@
/* If your shitbox doesn't have getopt, step into the nineties already. */
/* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */
- while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) {
+ while ((x = getopt (argc, argv, "abe:g:G:hi:lno:p:q:rs:tuvw:z")) != EOF) {
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */
switch (x) {
case 'a':
bail ("all-A-records NIY");
o_alla++; break;
+ case 'b':
+ o_allowbroad++; break;
#ifdef GAPING_SECURITY_HOLE
case 'e': /* prog to exec */
pr00gie = optarg;
@@ -1443,6 +1467,8 @@
break;
case 'r': /* randomize various things */
o_random++; break;
+ case 'q': /* quit after stdin does EOF */
+ o_quit = atoi(optarg); break;
case 's': /* local source address */
/* do a full lookup [since everything else goes through the same mill],
unless -n was previously specified. In fact, careful placement of -n can
@@ -1642,6 +1668,7 @@
-e prog program to exec after connect [dangerous!!]");
#endif
holler ("\
+ -b allow broadcasts\n\
-g gateway source-routing hop point[s], up to 8\n\
-G num source-routing pointer: 4, 8, 12, ...\n\
-h this cruft\n\
@@ -1651,6 +1678,7 @@
-o file hex dump of traffic\n\
-p port local port number\n\
-r randomize local and remote ports\n\
+ -q secs quit after EOF on stdin and delay of secs\n\
-s addr local source address");
#ifdef TELNET
holler ("\
+50
View File
@@ -0,0 +1,50 @@
$NetBSD: patch-ae,v 1.7 2011/01/13 15:09:58 pooka Exp $
--- Makefile.orig Tue Mar 19 19:16:06 1996
+++ Makefile Sat Nov 22 17:32:15 2003
@@ -9,12 +9,10 @@
# pick gcc if you'd rather , and/or do -g instead of -O if debugging
# debugging
# DFLAGS = -DTEST -DDEBUG
-CFLAGS = -O
XFLAGS = # xtra cflags, set by systype targets
XLIBS = # xtra libs if necessary?
# -Bstatic for sunos, -static for gcc, etc. You want this, trust me.
STATIC =
-CC = cc $(CFLAGS)
LD = $(CC) -s # linker; defaults to stripped executables
o = o # object extension
@@ -28,7 +26,7 @@
### HARD TARGETS
nc: netcat.c
- $(LD) $(DFLAGS) $(XFLAGS) $(STATIC) -o nc netcat.c $(XLIBS)
+ $(CC) $(CFLAGS) $(DFLAGS) $(XFLAGS) -o nc netcat.c $(XLIBS)
nc-dos:
@echo "DOS?! Maybe someday, but not now"
@@ -56,12 +54,12 @@
# Kludged for gcc, which many regard as the only thing available.
solaris-static:
make -e $(ALL) $(MFLAGS) XFLAGS='-DSYSV=4 -D__svr4__ -DSOLARIS' \
- CC=gcc STATIC=-static XLIBS='-lnsl -lsocket -lresolv'
+ STATIC=-static XLIBS='-lnsl -lsocket -lresolv'
# the more usual shared-lib version...
solaris:
make -e $(ALL) $(MFLAGS) XFLAGS='-DSYSV=4 -D__svr4__ -DSOLARIS' \
- CC=gcc STATIC= XLIBS='-lnsl -lsocket -lresolv'
+ STATIC= XLIBS='-lnsl -lsocket -lresolv'
aix:
make -e $(ALL) $(MFLAGS) XFLAGS='-DAIX'
@@ -103,7 +101,7 @@
# from Declan Rieb at sandia, for a/ux 3.1.1 [also suggests using gcc]:
aux:
- make -e $(ALL) $(MFLAGS) XFLAGS='-DAUX' STATIC=-static CC=gcc
+ make -e $(ALL) $(MFLAGS) XFLAGS='-DAUX' STATIC=-static
# Nexstep from mudge: NeXT cc is really old gcc
next:
+18
View File
@@ -0,0 +1,18 @@
$NetBSD: patch-af,v 1.1 2003/04/30 04:08:27 grant Exp $
--- data/Makefile.orig Thu Mar 21 07:14:44 1996
+++ data/Makefile
@@ -1,10 +1,10 @@
all: data rservice xor
data: data.c
- cc -s -O -o data data.c
+ $(CC) $(CFLAGS) -s -o data data.c
rservice: rservice.c
- cc -s -O -o rservice rservice.c
+ $(CC) $(CFLAGS) -s -o rservice rservice.c
xor: xor.c
- cc -s -O -o xor xor.c
+ $(CC) $(CFLAGS) -s -o xor xor.c
clean:
rm -f *.o data rservice xor