From a6f744edb1635beaa281d726b571c581369f294f Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 24 Jan 2016 10:40:08 +0800 Subject: [PATCH] use nmap Ncat for centOS --- le.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/le.sh b/le.sh index ec3139a0..e4e93cdb 100755 --- a/le.sh +++ b/le.sh @@ -222,11 +222,15 @@ _setopt() { _startserver() { content="$1" + _NC="nc -q 1" + if nc -h | grep "nmap.org/ncat" >/dev/null ; then + _NC="nc" + fi # while true ; do if [ "$DEBUG" ] ; then - echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80 + echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -l -p 80 -vv else - echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80 > /dev/null + echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -l -p 80 > /dev/null fi # done }