diff options
author | nachoparker <nacho@ownyourbits.com> | 2021-05-13 17:37:27 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2021-06-02 22:57:42 +0300 |
commit | 7b809d114b06c761d3662a8eb1c734b43503b688 (patch) | |
tree | 8d570c18c44787cdd034fb91c311cdff0772e21d /bin | |
parent | 1a8ac71543ec827e18bee632dd32e40a6fc21070 (diff) |
ncp-web: fix port checking for IPv6 dual stackv1.36.3
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ncp-diag | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/ncp-diag b/bin/ncp-diag index b7d65e26..e7f2223a 100644 --- a/bin/ncp-diag +++ b/bin/ncp-diag @@ -66,16 +66,15 @@ function is_port_open() { local port=$1 local public_ip - public_ip="$(curl icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; } - + public_ip="$(curl -4 https://icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; } local tmp_file=$(mktemp) local token=$(wget -T2 -t1 -qO- --keep-session-cookies --save-cookies $tmp_file https://portchecker.co | grep -oP "_csrf\" value=\"\K.*\"") - rm $tmp_file if [[ "${token}" != "" ]]; then wget -T2 -t1 -qO- --load-cookies $tmp_file https://portchecker.co --post-data "target_ip=${public_ip}&port=${port}&_csrf=${token::-1}" \ | grep -q '<span class="green">open</span>' && { echo "open"; return 1; } fi + rm $tmp_file echo "closed" } |