1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2025-02-05 07:43:22 -08:00

support more netcats

This commit is contained in:
Connor Olding 2024-07-03 13:16:17 -07:00
parent 697e68d039
commit 4f6638ad6f

View file

@ -35,12 +35,15 @@ burl() ( ### @-
(: </dev/udp/localhost/0) 2>&- && net=y || net= (: </dev/udp/localhost/0) 2>&- && net=y || net=
[ $'' ] && r=$(printf \\r) || r=$'\r' [ $'' ] && r=$(printf \\r) || r=$'\r'
if /usr/bin/env nc; [ $? = 1 ] # needs absolute path to env thanks to busybox # nc.traditional needs the -- or else it waits for input.
if /usr/bin/env nc --; [ $? = 1 ] # needs absolute path to env thanks to busybox
then g() { f /usr/bin/env nc -- "$@" ;} then g() { f /usr/bin/env nc -- "$@" ;}
elif busybox nc; [ $? = 1 ]
then g() { f busybox nc -- "$@" ;}
elif netcat; [ $? = 1 ] elif netcat; [ $? = 1 ]
then g() { f netcat -- "$@" ;} then g() { f netcat -- "$@" ;}
elif ncat; [ $? = 1 ]
then g() { f ncat -- "$@" ;}
elif busybox nc; [ $? = 1 ]
then g() { f busybox nc -- "$@" ;}
elif socat /dev/null /dev/null elif socat /dev/null /dev/null
then g() { f socat - "TCP:$1:$2" ;} then g() { f socat - "TCP:$1:$2" ;}
elif curl; [ $? = 2 ] elif curl; [ $? = 2 ]