Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2:Update
netcat
netcat.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File netcat.patch of Package netcat
--- Makefile +++ Makefile @@ -9,13 +9,14 @@ # pick gcc if you'd rather , and/or do -g instead of -O if debugging # debugging # DFLAGS = -DTEST -DDEBUG -CFLAGS = -O +DFLAGS = -DTELNET +CFLAGS = -O2 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 +LD = $(CC) # linker; defaults to stripped executables o = o # object extension ALL = nc @@ -67,7 +68,8 @@ make -e $(ALL) $(MFLAGS) XFLAGS='-DAIX' linux: - make -e $(ALL) $(MFLAGS) XFLAGS='-DLINUX' STATIC=-static + make -e $(ALL) $(MFLAGS) XFLAGS='-DLINUX' +#STATIC=-static # irix 5.2, dunno 'bout earlier versions. If STATIC='-non_shared' doesn't # work for you, null it out and yell at SGI for their STUPID default --- netcat.c +++ netcat.c @@ -73,6 +73,10 @@ #include <errno.h> #include <signal.h> #include <fcntl.h> /* O_WRONLY et al */ +#include <unistd.h> /* read, write, yadda yadda */ +#ifdef HAVE_BIND +#include <resolv.h> +#endif /* handy stuff: */ #define SA struct sockaddr /* socket overgeneralization braindeath */ @@ -1216,6 +1220,7 @@ if (rr <= 0) { /* at end, or fukt, or ... */ FD_CLR (0, ding1); /* disable and close stdin */ close (0); + shutdown(fd, 1); /* no more sending from us */ } else { rzleft = rr; zp = bigbuf_in; @@ -1313,7 +1318,13 @@ USHORT hiport = 0; USHORT curport = 0; char * randports = NULL; + char * basename; + if ((basename = strrchr(argv[0], '/')) == NULL) + basename = argv[0]; + else + basename++; + #ifdef HAVE_BIND /* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on SunLOSs? */ res_init(); @@ -1420,7 +1431,7 @@ case 'h': errno = 0; #ifdef HAVE_HELP - helpme(); /* exits by itself */ + helpme(basename); /* exits by itself */ #else bail ("no help available, dork -- RTFS"); #endif @@ -1471,7 +1482,7 @@ break; default: errno = 0; - bail ("nc -h for help"); + bail ("%s -h for help", basename); } /* switch x */ } /* while getopt */ @@ -1627,13 +1638,13 @@ #ifdef HAVE_HELP /* unless we wanna be *really* cryptic */ /* helpme : the obvious */ -helpme() +void helpme(char * basename) { o_verbose = 1; holler ("[v1.10]\n\ -connect to somewhere: nc [-options] hostname port[s] [ports] ... \n\ -listen for inbound: nc -l -p port [-options] [hostname] [port]\n\ -options:"); +connect to somewhere: %s [-options] hostname port[s] [ports] ... \n\ +listen for inbound: %s -l -p port [-options] [hostname] [port]\n\ +options:", basename, basename); /* sigh, this necessarily gets messy. And the trailing \ characters may be interpreted oddly by some compilers, generating or not generating extra newlines as they bloody please. u-fix... */ --- scripts/alta +++ scripts/alta @@ -16,12 +16,12 @@ QB="GET /cgi-bin/query?pg=q&what=${WHAT}&fmt=c&q=\"${PLUSARG}\"" # ping 'em once, to get the routing warm -nc -z -w 8 www.altavista.digital.com 24015 2> /dev/null +netcat -z -w 8 www.altavista.digital.com 24015 2> /dev/null echo "=== Altavista ===" for xx in 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 \ 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 ; do - echo "${QB}&stq=${xx}" | nc -w 15 www.altavista.digital.com 80 | \ + echo "${QB}&stq=${xx}" | netcat -w 15 www.altavista.digital.com 80 | \ egrep '^<a href="http://' done --- scripts/bsh +++ scripts/bsh @@ -2,7 +2,7 @@ ## a little wrapper to "password" and re-launch a shell-listener. ## Arg is taken as the port to listen on. Define "NC" to point wherever. -NC=nc +NC=netcat case "$1" in ?* ) --- scripts/dist.sh +++ scripts/dist.sh @@ -9,7 +9,7 @@ sleep 1 SRC=`tail -1 dist.log` -echo "<36>elite: ${SRC}" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 +echo "<36>elite: ${SRC}" | netcat -u -w 1 localhost 514 > /dev/null 2>&1 echo ";;; Hi, ${SRC}..." echo ";;; This is a PRERELEASE version of 'netcat', tar/gzip/uuencoded." echo ";;; Unless you are capturing this somehow, it won't do you much good." @@ -17,7 +17,7 @@ sleep 8 cat dist.file sleep 1 -./nc -v -l -p ${PORT} -e dist.sh < /dev/null >> dist.log 2>&1 & +netcat -v -l -p ${PORT} -e dist.sh < /dev/null >> dist.log 2>&1 & sleep 1 -echo "<36>elite: done" | ./nc -u -w 1 localhost 514 > /dev/null 2>&1 +echo "<36>elite: done" | netcat -u -w 1 localhost 514 > /dev/null 2>&1 exit 0 --- scripts/irc +++ scripts/irc @@ -1,6 +1,6 @@ #! /bin/sh ## Shit-simple script to supply the "privmsg <recipient>" of IRC typein, and -## keep the connection alive. Pipe this thru "nc -v -w 5 irc-server port". +## keep the connection alive. Pipe this thru "netcat -v -w 5 irc-server port". ## Note that this mechanism makes the script easy to debug without being live, ## since it just echoes everything bound for the server. ## if you want autologin-type stuff, construct some appropriate files and --- scripts/iscan +++ scripts/iscan @@ -13,7 +13,7 @@ esac # ping 'em once and see if they *are* running identd -nc -z -w 9 "$1" 113 || { echo "oops, $1 isn't running identd" ; exit 0 ; } +netcat -z -w 9 "$1" 113 || { echo "oops, $1 isn't running identd" ; exit 0 ; } # generate a randomish base port RP=`expr $$ % 999 + 31337` @@ -22,10 +22,10 @@ shift while test "$1" ; do - nc -v -w 8 -p ${RP} "$TRG" ${1} < /dev/null > /dev/null & + netcat -v -w 8 -p ${RP} "$TRG" ${1} < /dev/null > /dev/null & PROC=$! sleep 3 - echo "${1},${RP}" | nc -w 4 -r "$TRG" 113 2>&1 + echo "${1},${RP}" | netcat -w 4 -r "$TRG" 113 2>&1 sleep 2 # does this look like a lamer script or what... kill -HUP $PROC --- scripts/ncp +++ scripts/ncp @@ -20,9 +20,9 @@ if test "$2" ; then test ! -f "$1" && echo "can't find $1" && exit 1 if test "$me" = "nzp" ; then - compress -c < "$1" | nc -v -w 2 $2 $MYPORT && exit 0 + compress -c < "$1" | netcat -v -w 2 $2 $MYPORT && exit 0 else - nc -v -w 2 $2 $MYPORT < "$1" && exit 0 + netcat -v -w 2 $2 $MYPORT < "$1" && exit 0 fi echo "transfer FAILED!" exit 1 @@ -36,9 +36,9 @@ fi # 30 seconds oughta be pleeeeenty of time, but change if you want. if test "$me" = "nzp" ; then - nc -v -w 30 -p $MYPORT -l < /dev/null | uncompress -c > "$1" && exit 0 + netcat -v -w 30 -p $MYPORT -l < /dev/null | uncompress -c > "$1" && exit 0 else - nc -v -w 30 -p $MYPORT -l < /dev/null > "$1" && exit 0 + netcat -v -w 30 -p $MYPORT -l < /dev/null > "$1" && exit 0 fi echo "transfer FAILED!" # clean up, since even if the transfer failed, $1 is already trashed --- scripts/probe +++ scripts/probe @@ -10,7 +10,7 @@ GATE=192.157.69.11 # might conceivably wanna change this for different run styles -UCMD='nc -v -w 8' +UCMD='netcat -v -w 8' test ! "$1" && echo Needs victim arg && exit 1 @@ -20,7 +20,7 @@ $UCMD -z -r -g $GATE "$1" 6473 2>&1 $UCMD -r -z "$1" 6000 4000-4004 111 53 2105 137-140 1-20 540-550 95 87 2>&1 # -s `hostname` may be wrong for some multihomed machines -echo 'UDP echoecho!' | nc -u -p 7 -s `hostname` -w 3 "$1" 7 19 2>&1 +echo 'UDP echoecho!' | netcat -u -p 7 -s `hostname` -w 3 "$1" 7 19 2>&1 echo '113,10158' | $UCMD -p 10158 "$1" 113 2>&1 rservice bin bin | $UCMD -p 1019 "$1" shell 2>&1 echo QUIT | $UCMD -w 8 -r "$1" 25 158 159 119 110 109 1109 142-144 220 23 2>&1 @@ -36,14 +36,14 @@ echo 'BEGIN big udp -- everything may look "open" if packet-filtered' data -g < ${DDIR}/nfs-0.d | $UCMD -i 1 -u "$1" 2049 | od -x 2>&1 # no wait-time, uses RTT hack -nc -v -z -u -r "$1" 111 66-70 88 53 87 161-164 121-123 213 49 2>&1 -nc -v -z -u -r "$1" 137-140 694-712 747-770 175-180 2103 510-530 2>&1 +netcat -v -z -u -r "$1" 111 66-70 88 53 87 161-164 121-123 213 49 2>&1 +netcat -v -z -u -r "$1" 137-140 694-712 747-770 175-180 2103 510-530 2>&1 echo 'END big udp' $UCMD -r -z "$1" 175-180 2000-2003 530-533 1524 1525 666 213 8000 6250 2>&1 # Use our identd-sniffer! iscan "$1" 21 25 79 80 111 53 6667 6000 2049 119 2>&1 # this gets pretty intrusive, but what the fuck. Probe for portmap first -if nc -w 5 -z -u "$1" 111 ; then +if netcat -w 5 -z -u "$1" 111 ; then showmount -e "$1" 2>&1 rpcinfo -p "$1" 2>&1 fi --- scripts/web +++ scripts/web @@ -37,7 +37,7 @@ # PATH=${HOME}:${PATH} ; export PATH test "${PAGER}" || PAGER=more -BACKEND="nc -v -w 15" +BACKEND="netcat -v -w 15" TMPAGE=/tmp/web$$ host="$1" port="80" --- scripts/webproxy +++ scripts/webproxy @@ -51,7 +51,7 @@ # is necessary so this shell has NO remaining channel open to the net. # This will hang around for 10 minutes, and exit if no new connections arrive. # Using -n for speed, avoiding any DNS/port lookups. - nc -w 600 -n -l -p $PORT -e "$0" $XNC "$CLIENT" < /dev/null > /dev/null \ + netcat -w 600 -n -l -p $PORT -e "$0" $XNC "$CLIENT" < /dev/null > /dev/null \ 2> $CFILE & ;; esac @@ -64,7 +64,7 @@ if test "$1" = "reset" ; then rm -f $LFILE test -f "$CFILE" && rm -f $CFILE - nc -w 1 -n 127.0.0.1 $PORT < /dev/null > /dev/null 2>&1 + netcat -w 1 -n 127.0.0.1 $PORT < /dev/null > /dev/null 2>&1 exit 0 fi # find our ass with both hands @@ -82,7 +82,7 @@ fi # ping client machine and get its bare IP address - CLIENT=`nc -z -v -w 8 "$1" 22000 2>&1 | sed 's/.*\[\(..*\)\].*/\1/'` + CLIENT=`netcat -z -v -w 8 "$1" 22000 2>&1 | sed 's/.*\[\(..*\)\].*/\1/'` test ! "$CLIENT" && echo "Can't find address of $1" && exit 1 # if this was an initial launch, be informative about it @@ -92,7 +92,7 @@ test -f "$CFILE" && echo " and connection fuckups to $CFILE" # and run the first listener, showing us output just for the first hit - nc -v -w 600 -n -l -p $PORT -e "$0" $XNC "$CLIENT" & + netcat -v -w 600 -n -l -p $PORT -e "$0" $XNC "$CLIENT" & exit 0 fi @@ -130,8 +130,8 @@ echo "access to Netscam's servers <b>DENIED.</b>" && exit 0 # Do it. 30 sec net-wait time oughta be *plenty*... # Some braindead servers have forgotten how to handle the simple-query syntax. -# If necessary, replace below with (echo "$x1 $hf" ; echo '') | nc... -echo "$x1 $hf" | nc -w 30 "$hh" "$hp" 2> /dev/null || \ +# If necessary, replace below with (echo "$x1 $hf" ; echo '') | netcat... +echo "$x1 $hf" | netcat -w 30 "$hh" "$hp" 2> /dev/null || \ echo "oops, can't get to $hh : $hp". echo "sent \"$x1 $hf\" to $hh : $hp" >> $LFILE exit 0 --- scripts/webrelay +++ scripts/webrelay @@ -10,7 +10,7 @@ # set these as you wish: proxy port... PORT=8000 -# any extra args to the listening "nc", for instance "-s inside-net-addr" +# any extra args to the listening "netcat", for instance "-s inside-net-addr" XNC='' # functionality switch, which has to be done fast to start the next listener @@ -24,9 +24,9 @@ case "${1}" in "") # no args: fire off new relayer process NOW. Will hang around for 10 minutes - nc -w 600 -l -n -p $PORT -e "$0" $XNC < /dev/null > /dev/null 2>&1 & + netcat -w 600 -l -n -p $PORT -e "$0" $XNC < /dev/null > /dev/null 2>&1 & # and handle this request, which will simply fail if vars not set yet. - exec nc -w 15 $RDEST $RPORT + exec netcat -w 15 $RDEST $RPORT ;; esac @@ -38,7 +38,7 @@ # Launch the first relayer same as above, but let its error msgs show up # will hang around for a minute, and exit if no new connections arrive. -nc -v -w 600 -l -p $PORT -e "$0" $XNC < /dev/null > /dev/null & +netcat -v -w 600 -l -p $PORT -e "$0" $XNC < /dev/null > /dev/null & echo \ "Relay to ${RDEST}:${RPORT} running -- point your browser here on port $PORT" exit 0 --- scripts/websearch +++ scripts/websearch @@ -15,7 +15,7 @@ # Don't have "nc"? Get "netcat" from avian.org and add it to your toolkit. doquery () { - echo GET "$1" | nc -v -i 1 -w 30 "$2" "$3" + echo GET "$1" | netcat -v -i 1 -w 30 "$2" "$3" } # changed since original: now supplying port numbers and separator lines... @@ -35,7 +35,7 @@ # you want to play, the basic idea and query formats follow. # echo "GET /WW/IS/Titles?qt=${PLUSARG}" > $IFILE # echo "" >> $IFILE -# nc -v -w 30 guide-p.infoseek.com 80 < $IFILE +# netcat -v -w 30 guide-p.infoseek.com 80 < $IFILE # this is kinda flakey; might have to do twice?? echo '' ; echo "=== Opentext ===" @@ -66,7 +66,7 @@ echo "Why: go ask todd@pointcom.com (Todd Whitney)" >> $IFILE echo '' >> $IFILE echo '' ; echo "=== Lycos ===" -nc -v -i 1 -w 30 twelve.srv.lycos.com 80 < $IFILE +netcat -v -i 1 -w 30 twelve.srv.lycos.com 80 < $IFILE rm -f $IFILE exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor