From 7aecfca5a39c07de17dd1e85b3a83afe110e2250 Mon Sep 17 00:00:00 2001 From: Andreas Gruber Date: Thu, 16 Nov 2023 22:45:18 +0100 Subject: [PATCH] Add script to download WinCC OA from ETM Portal --- scripts/download.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/download.sh diff --git a/scripts/download.sh b/scripts/download.sh new file mode 100644 index 0000000..0aeeb83 --- /dev/null +++ b/scripts/download.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# File containing the HTML content +HTML_FILE="Downloads.html" + +# Define the base URL +BASE_URL="https://www.winccoa.com" + +OUTPUT_FILE="WinCC_OA.zip" + +PATCH_NUM="p007" + +curl -o "$HTML_FILE" -c cookie.txt -d "user=${USERNAME}&pass=${PASSWORD}&logintype=login" -X POST "${BASE_URL}/index.html?tx_felogin_login%5Baction%5D=login&tx_felogin_login%5Bcontroller%5D=Login&cHash=c7468a0d2aa90b33b574ad5ad452c085" + +curl -o "$HTML_FILE" -b cookie.txt "${BASE_URL}/downloads/detail/wincc-oa-319-${PATCH_NUM}-debian-11-bullseye.html" + +# Extract the relative URL +RELATIVE_URL=$(grep "Download ZIP File" $HTML_FILE | grep -v "arm64" | sed -n 's/.*href="\([^"]*\).*/\1/p' | sed 's/\&/\&/g') + +# Create the full URL +FULL_URL="${BASE_URL}${RELATIVE_URL}" + +echo "Downloading $FULL_URL to $OUTPUT_FILE" +# Specify the output filename + +# Download the file with verbose output +curl -o "$OUTPUT_FILE" -b cookie.txt "$FULL_URL" + +echo "Downloaded to $OUTPUT_FILE"