diff options
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" } |