File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -64,15 +64,19 @@ echo "internet check|$( ping -W 2 -w 1 -q github.com &>/dev/null && echo ok || e
6464
6565function is_port_open()
6666{
67- local PORT=$1
67+ local port=$1
68+ local public_ip
69+ public_ip=" $( curl icanhazip.com 2> /dev/null) " || { echo " closed" ; return 1; }
70+
6871 local tmp_file=$( mktemp)
69- local v=$( wget -T2 -t1 -q --keep-session-cookies --save-cookies $tmp_file https://portchecker.co -O - | grep -oP " _csrf\" value=\" \K.*\" " )
70- if [[ " $v " != " " ]]; then
71- wget -T2 -t1 -q --load-cookies $tmp_file https://portchecker.co --post-data " port=$PORT &_csrf=${v::- 1} " -O - \
72+ local token=$( wget -T2 -t1 -qO- --keep-session-cookies --save-cookies $tmp_file https://portchecker.co | grep -oP " _csrf\" value=\" \K.*\" " )
73+ rm $tmp_file
74+
75+ if [[ " ${token} " != " " ]]; then
76+ wget -T2 -t1 -qO- --load-cookies $tmp_file https://portchecker.co --post-data " target_ip=${public_ip} &port=${port} &_csrf=${token::- 1} " \
7277 | grep -q ' <span class="green">open</span>' && { echo " open" ; return 1; }
7378 fi
7479 echo " closed"
75- rm $tmp_file
7680}
7781
7882echo " port check 80|$( is_port_open 80 ) "
Original file line number Diff line number Diff line change 11
2- [ v1.36.1 ] ( https://github.com/nextcloud/nextcloudpi/commit/8e7579d ) (2021-05-09) lamp: allow only TLSv12 and TLSv13
2+ [ v1.36.2 ] ( https://github.com/nextcloud/nextcloudpi/commit/fccc04c ) (2021-05-11) ncp-web: fix port checking
33
4- [ v1.36.0] ( https://github.com/nextcloud/nextcloudpi/commit/24b6018 ) (2020-09-16) Namecheap dynamic DNS client
4+ [ v1.36.1] ( https://github.com/nextcloud/nextcloudpi/commit/c7f2939 ) (2021-05-09) lamp: allow only TLSv12 and TLSv13
5+
6+ [ v1.36.0 ] ( https://github.com/nextcloud/nextcloudpi/commit/24b6018 ) (2020-09-16) Namecheap dynamic DNS client
57
68[ v1.35.2 ] ( https://github.com/nextcloud/nextcloudpi/commit/bfab195 ) (2021-04-29) ncp-web: fix display of big files for 32 bit
79
You can’t perform that action at this time.
0 commit comments