diff --git a/.github/workflows/build_master.yml b/.github/workflows/build_master.yml index ad1e31ccd8..8a4b03de6d 100644 --- a/.github/workflows/build_master.yml +++ b/.github/workflows/build_master.yml @@ -167,6 +167,7 @@ jobs: --manifest /tmp/s3-en-manifest.json \ --remote-prefix en/ aws s3 sync ./book s3://hacktricks-cloud/en --delete + bash scripts/upload_immutable_images.sh hacktricks-cloud en - name: Upload root sitemap index run: | diff --git a/.github/workflows/translate_all.yml b/.github/workflows/translate_all.yml index 1a03693baa..849a275a4c 100644 --- a/.github/workflows/translate_all.yml +++ b/.github/workflows/translate_all.yml @@ -85,6 +85,10 @@ jobs: wget -O /tmp/translator.py https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/master/scripts/translator.py wget -O /tmp/seo_postprocess.py https://raw.githubusercontent.com/HackTricks-wiki/hacktricks-cloud/master/scripts/seo_postprocess.py cp scripts/mark_unchanged_s3_files.py /tmp/mark_unchanged_s3_files.py + cp scripts/upload_immutable_images.sh /tmp/upload_immutable_images.sh + mkdir -p /tmp/immutable-images + cp src/images/{hacktricks-summer-discount-2026-v1.webp,arte-badge-v1.webp,grte-badge-v1.webp,azrte-badge-v1.webp} /tmp/immutable-images/ + cp theme/discount.js /tmp/discount.js - name: Run get_and_save_refs.py run: | @@ -152,6 +156,8 @@ jobs: git checkout "$BRANCH" git pull MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && echo "" && echo "" && echo "Debug logs" && (cat hacktricks-preprocessor.log | tail -n 20) && exit 1) + cp /tmp/immutable-images/* ./book/images/ + cp /tmp/discount.js ./book/discount.js - name: Push search index to hacktricks-searchindex repo shell: bash @@ -284,6 +290,7 @@ jobs: --manifest /tmp/s3-branch-manifest.json \ --remote-prefix "$BRANCH/" aws s3 sync ./book s3://hacktricks-cloud/$BRANCH --delete + bash /tmp/upload_immutable_images.sh hacktricks-cloud "$BRANCH" echo "Sync completed" echo "Cat 3 files from the book" find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat diff --git a/scripts/upload_immutable_images.sh b/scripts/upload_immutable_images.sh new file mode 100644 index 0000000000..42073028be --- /dev/null +++ b/scripts/upload_immutable_images.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 2 ]; then + echo "usage: $0 " >&2 + exit 2 +fi + +bucket="$1" +prefix="${2#/}" +prefix="${prefix%/}" +cache_control="public,max-age=31536000,immutable" + +for image in \ + hacktricks-summer-discount-2026-v1.webp \ + arte-badge-v1.webp \ + grte-badge-v1.webp \ + azrte-badge-v1.webp; do + source_path="./book/images/${image}" + if [ ! -f "$source_path" ]; then + echo "Missing immutable image: $source_path" >&2 + exit 1 + fi + key="${prefix}/images/${image}" + local_etag="\"$(md5sum "$source_path" | cut -d' ' -f1)\"" + remote_state="$(aws s3api head-object \ + --bucket "$bucket" \ + --key "$key" \ + --query '[ETag,CacheControl,ContentType]' \ + --output text 2>/dev/null || true)" + read -r remote_etag remote_cache_control remote_content_type <<< "$remote_state" + if [ "$remote_etag" = "$local_etag" ] \ + && [ "$remote_cache_control" = "$cache_control" ] \ + && [ "$remote_content_type" = "image/webp" ]; then + echo "Immutable image already current: $key" + continue + fi + aws s3 cp "$source_path" "s3://${bucket}/${key}" \ + --only-show-errors \ + --content-type image/webp \ + --cache-control "$cache_control" +done diff --git a/src/banners/hacktricks-training.md b/src/banners/hacktricks-training.md index 0ca6dd6d00..0d2c44d97f 100644 --- a/src/banners/hacktricks-training.md +++ b/src/banners/hacktricks-training.md @@ -1,7 +1,7 @@ > [!TIP] -> Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://hacktricks-training.com/courses/arte)\ -> Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://hacktricks-training.com/courses/grte)\ -> Learn & practice Az Hacking: [**HackTricks Training Azure Red Team Expert (AzRTE)**](https://hacktricks-training.com/courses/azrte) +> Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://hacktricks-training.com/courses/arte)\ +> Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://hacktricks-training.com/courses/grte)\ +> Learn & practice Az Hacking: [**HackTricks Training Azure Red Team Expert (AzRTE)**](https://hacktricks-training.com/courses/azrte) > >
> diff --git a/src/images/arte-badge-v1.webp b/src/images/arte-badge-v1.webp new file mode 100644 index 0000000000..fae64d7e2f Binary files /dev/null and b/src/images/arte-badge-v1.webp differ diff --git a/src/images/azrte-badge-v1.webp b/src/images/azrte-badge-v1.webp new file mode 100644 index 0000000000..be67d55a64 Binary files /dev/null and b/src/images/azrte-badge-v1.webp differ diff --git a/src/images/grte-badge-v1.webp b/src/images/grte-badge-v1.webp new file mode 100644 index 0000000000..941453e2bb Binary files /dev/null and b/src/images/grte-badge-v1.webp differ diff --git a/src/images/hacktricks-summer-discount-2026-v1.webp b/src/images/hacktricks-summer-discount-2026-v1.webp new file mode 100644 index 0000000000..90befc4c4a Binary files /dev/null and b/src/images/hacktricks-summer-discount-2026-v1.webp differ diff --git a/theme/discount.js b/theme/discount.js index 59522e3e3a..0203fffde0 100644 --- a/theme/discount.js +++ b/theme/discount.js @@ -2,7 +2,7 @@ var CAMPAIGN_ID = "summer-2026" var DISMISS_KEY = "htDiscountDismissedUntil:" + CAMPAIGN_ID var DISMISS_MS = 10 * 24 * 60 * 60 * 1000 - var IMAGE_PATH = "images/hacktricks-summer-discount-2026.png" + var IMAGE_PATH = "images/hacktricks-summer-discount-2026-v1.webp" var TARGET_URL = "https://hacktricks-training.com" var TITLE = "HackTricks Training Summer Discount"