Skip to content

Commit

Permalink
ncp-web: fix port checking for IPv6 dual stack
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed Jun 2, 2021
1 parent 1a8ac71 commit 7b809d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 2 additions & 3 deletions bin/ncp-diag
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
14 changes: 8 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

[v1.36.2](https://github.com/nextcloud/nextcloudpi/commit/fccc04c) (2021-05-11) ncp-web: fix port checking
[v1.36.3](https://github.com/nextcloud/nextcloudpi/commit/4d4717d) (2021-05-13) ncp-web: fix port checking for IPv6 dual stack

[v1.36.1](https://github.com/nextcloud/nextcloudpi/commit/c7f2939) (2021-05-09) lamp: allow only TLSv12 and TLSv13
[v1.36.2](https://github.com/nextcloud/nextcloudpi/commit/1a8ac71) (2021-05-11) ncp-web: fix port checking

[v1.36.0 ](https://github.com/nextcloud/nextcloudpi/commit/24b6018) (2020-09-16) Namecheap dynamic DNS client
[v1.36.1 ](https://github.com/nextcloud/nextcloudpi/commit/67aa599) (2021-05-09) lamp: allow only TLSv12 and TLSv13

[v1.35.2 ](https://github.com/nextcloud/nextcloudpi/commit/bfab195) (2021-04-29) ncp-web: fix display of big files for 32 bit
[v1.36.0 ](https://github.com/nextcloud/nextcloudpi/commit/7aef967) (2020-09-16) Namecheap dynamic DNS client

[v1.35.1 ](https://github.com/nextcloud/nextcloudpi/commit/e64ca34) (2021-04-29) ncp-web: fix backup download for big files in 32-bit
[v1.35.2 ](https://github.com/nextcloud/nextcloudpi/commit/8d76a6b) (2021-04-29) ncp-web: fix display of big files for 32 bit

[v1.35.0](https://github.com/nextcloud/nextcloudpi/commit/be30663) (2021-02-27) upgrade to NC20.0.8
[v1.35.1 ](https://github.com/nextcloud/nextcloudpi/commit/0ee3aa9) (2021-04-29) ncp-web: fix backup download for big files in 32-bit

[v1.35.0 ](https://github.com/nextcloud/nextcloudpi/commit/be30663) (2021-02-27) upgrade to NC20.0.8

[v1.34.9 ](https://github.com/nextcloud/nextcloudpi/commit/7d15924) (2021-01-19) nc-autoupdate-ncp: Append to log instead of replace

Expand Down
3 changes: 2 additions & 1 deletion ncp-web/ncp-launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
|| strpos( $fields[1], "open" ) !== false )
$class = 'ok-field';
if ( strpos( $fields[1], "down" ) !== false
|| strpos( $fields[1], "error" ) !== false )
|| strpos( $fields[1], "error" ) !== false
|| strpos( $fields[1], "closed") !== false )
$class = 'error-field';

$table .= "<td class=\"$class\">$fields[1]</td>";
Expand Down

0 comments on commit 7b809d1

Please sign in to comment.