hidden files, allow ips

This commit is contained in:
Q
2024-01-14 09:25:24 +02:00
parent 10ba7ef02b
commit 4eab9a34cd
6 changed files with 155 additions and 69 deletions

View File

@@ -87,6 +87,12 @@ _title() {
set -e
if [[ ! -d ../test ]]; then
echo run in the test folder
exit 1
fi
BIG="big file(1).ext"
BIGS="big_file1.ext"
SMALL="small file"
@@ -316,7 +322,54 @@ function t17-new-upload_token() {
}
function t18-upload_hidden() {
url=$( cat "$IMAGE" | \
curl -fL -w "\n" -F file="@-" -X POST \
-H "Name: $IMAGE" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
-H "Hidden: true" \
-H "Max-Downloads: 1" \
"$FLASK_PUBLIC_URL"/upload | grep ^http )
curl "$url" > /dev/null
./mfl w -m 1 --hidden "$IMAGE"
curl -fL -w "\n" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
"$FLASK_PUBLIC_URL"/ls
}
function t19-upload_ip_allow() {
url=$( cat "$IMAGE" | \
curl -fL -w "\n" -F file="@-" -X POST \
-H "Name: $IMAGE" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
-H "Allowed-IP: *" \
"$FLASK_PUBLIC_URL"/upload | grep ^http )
curl -s -D /dev/stderr "$url" | head -c 1 | head -c 0
url=$( cat "$IMAGE" | \
curl -fL -w "\n" -F file="@-" -X POST \
-H "Name: $IMAGE" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
-H "Allowed-IP: 10.0.0.10, 172.20.*" \
"$FLASK_PUBLIC_URL"/upload | grep ^http )
curl -s -D /dev/stderr "$url" | head -c 1 | head -c 0
url=$( cat "$IMAGE" | \
curl -fL -w "\n" -F file="@-" -X POST \
-H "Name: $IMAGE" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
-H "Allowed-IP: 10.0.0.10, 12.12.12.12" \
"$FLASK_PUBLIC_URL"/upload | grep ^http )
curl -s -D /dev/stderr "$url" | head -c 1 | head -c 0
./mfl w -m 1 --allow '*' "$IMAGE"
./mfl w -m 1 --allow '10.0.0.1, 10.0.0.*' "$IMAGE"
./mfl list
}
_getlist() {
declare -F | awk '{ print $3 }' | grep -v ^_