Skip to content

Instantly share code, notes, and snippets.

@Geczy
Last active April 10, 2025 23:15

Revisions

  1. Geczy revised this gist Sep 11, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 3 runner.sh
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventTypes":["VIEWABLE_IMPRESSION","VIDEO_START","VIDEO_COMPLETE","VIDEO_MUTE","VIDEO_UNMUTE","VIDEO_PAUSE","VIDEO_RESUME","VIDEO_PROGRESS","ACTIVATION_EVENT","UI_CUSTOM_EVENT"],"adTypes":[18],"vsatType":"WATCH"}]}' \
    --compressed | jq ".adDataMap.items.ads[0].offerInteractionId" -r)

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/click" \
    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/click" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
  2. Geczy revised this gist Sep 11, 2024. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions 3 runner.sh
    Original file line number Diff line number Diff line change
    @@ -99,11 +99,6 @@ OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventTypes":["VIEWABLE_IMPRESSION","VIDEO_START","VIDEO_COMPLETE","VIDEO_MUTE","VIDEO_UNMUTE","VIDEO_PAUSE","VIDEO_RESUME","VIDEO_PROGRESS","ACTIVATION_EVENT","UI_CUSTOM_EVENT"],"adTypes":[18],"vsatType":"WATCH"}]}' \
    --compressed | jq ".adDataMap.items.ads[0].offerInteractionId" -r)

    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/click
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/VIDEO_START
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/ACTIVATION_EVENT
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/UI_CUSTOM_EVENT?property%3Aoffer-interaction-id=e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/click" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
  3. Geczy revised this gist Sep 11, 2024. 1 changed file with 37 additions and 2 deletions.
    39 changes: 37 additions & 2 deletions 3 runner.sh
    Original file line number Diff line number Diff line change
    @@ -86,7 +86,7 @@ DEVICE_INFO=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed)
    --compressed | jq ".sessionData.timeRemaining")

    OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements" \
    -H 'content-type: application/json' \
    @@ -97,7 +97,42 @@ OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventTypes":["VIEWABLE_IMPRESSION","VIDEO_START","VIDEO_COMPLETE","VIDEO_MUTE","VIDEO_UNMUTE","VIDEO_PAUSE","VIDEO_RESUME","VIDEO_PROGRESS","ACTIVATION_EVENT","UI_CUSTOM_EVENT"],"adTypes":[18],"vsatType":"WATCH"}]}' \
    --compressed | jq ".adDataMap.items[0].ads[0].offerInteractionId" -r)
    --compressed | jq ".adDataMap.items.ads[0].offerInteractionId" -r)

    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/click
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/VIDEO_START
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/ACTIVATION_EVENT
    # https://sponsoredaccess.viasat.com/engage-advertising-service/vas/api/v1/advertisements/e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f/recordInteraction/UI_CUSTOM_EVENT?property%3Aoffer-interaction-id=e8c49cd4-ff3c-4683-8fa7-0c1dc37da52f

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/click" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/VIDEO_START" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/ACTIVATION_EVENT" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed

    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/VIDEO_COMPLETE" \
    -X 'GET' \
  4. Geczy revised this gist Sep 11, 2024. 2 changed files with 14 additions and 50 deletions.
    28 changes: 0 additions & 28 deletions 1 readme.md
    Original file line number Diff line number Diff line change
    @@ -1,28 +0,0 @@
    This Bash script automates the process of changing the MAC address on a network interface (specifically en0 on macOS, typically used for Wi-Fi) and attempts to activate a 20-minute Wi-Fi session, probably on an American Airlines flight. Here's a detailed breakdown:

    1. Root Check:
    - Exits if not run as root to ensure necessary permissions.

    2. Dependency Check:
    - Checks for the jq command, used for parsing JSON data.

    3. MAC Address Manipulation:
    - Defines generate_valid_mac function for new MAC addresses.
    - Resets Wi-Fi connection by turning it off and on.
    - Tries new MAC addresses until successful.

    4. Network Reconnection:
    - Waits until the en0 network interface is active again after MAC address change.

    5. Device ID Retrieval:
    - Makes an HTTP request to aainflight.com for a device_id, using current timestamp and a specific user agent.

    6. Offer Activation:
    - Retrieves device info and an offer ID from sponsoredaccess.viasat.com.
    - Attempts to activate a Wi-Fi offer using the device_id and offer_id.

    7. Status Check and Response:
    - Checks activation status.
    - Prints a success message with active Wi-Fi session time, or a failure message if activation fails.

    This script is likely for use on American Airlines flights to automate free Wi-Fi access by spoofing MAC addresses and interacting with the in-flight Wi-Fi service's API. However, its usage might violate Wi-Fi provider terms of service and could be unethical or illegal.
    36 changes: 14 additions & 22 deletions 3 runner.sh
    Original file line number Diff line number Diff line change
    @@ -69,12 +69,12 @@ AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML
    printf "Waiting to be assigned a device from AA..."
    while [ -z "$DEVICE_ID" ]; do
    printf "."
    DEVICE_ID=$(curl -s "https://aainflight.com/device?random=$TIMESTAMP" \
    DEVICE_ID=$(curl -s "https://www.aainflight.com/api/v1/connectivity/viasat/device?random=$TIMESTAMP" \
    -H 'accept: application/json' \
    -H 'cache-control: no-cache' \
    -H 'referer: https://aainflight.com/' \
    -H "user-agent: $AGENT" \
    --compressed | jq .guid -r)
    --compressed | jq .deviceGuid -r)
    sleep 1
    done
    echo ""
    @@ -88,39 +88,31 @@ DEVICE_INFO=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1
    -H 'venuecode: aal' \
    --compressed)

    OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/offers" \
    OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements" \
    -H 'content-type: application/json' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventIds":[40,900],"adTypes":[18]}]}' \
    --compressed | jq ".decisions.items[0].offerInteractionId" -r)
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventTypes":["VIEWABLE_IMPRESSION","VIDEO_START","VIDEO_COMPLETE","VIDEO_MUTE","VIDEO_UNMUTE","VIDEO_PAUSE","VIDEO_RESUME","VIDEO_PROGRESS","ACTIVATION_EVENT","UI_CUSTOM_EVENT"],"adTypes":[18],"vsatType":"WATCH"}]}' \
    --compressed | jq ".adDataMap.items[0].ads[0].offerInteractionId" -r)

    ACTIVATE_RESPONSE=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/offers/$OFFER_ID/activate" \
    -X 'POST' \
    -H 'content-type: application/json' \
    curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/vas/api/v1/advertisements/$OFFER_ID/recordInteraction/VIDEO_COMPLETE" \
    -X 'GET' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed)
    --compressed

    status_value=$(echo "$ACTIVATE_RESPONSE" | jq -r '.status')
    future_time=$(date -v+19M '+%I:%M:%S %p')
    current_time=$(date '+%I:%M:%S %p')

    if [ "$status_value" = "SUCCESS" ]; then
    future_time=$(date -v+19M '+%I:%M:%S %p')
    current_time=$(date '+%I:%M:%S %p')

    echo "Successfully activated at $current_time"
    echo "Keep this window open, this script will automatically run again in 19 minutes at $future_time..."
    sleep 1140 # 19 minutes in seconds
    bash "$0"
    else
    echo "Activation failed."
    echo "$ACTIVATE_RESPONSE"
    fi
    echo "Successfully activated at $current_time"
    echo "Keep this window open, this script will automatically run again in 19 minutes at $future_time..."
    sleep 1140 # 19 minutes in seconds
    bash "$0"
  5. Geczy revised this gist Dec 30, 2023. 1 changed file with 22 additions and 18 deletions.
    40 changes: 22 additions & 18 deletions 3 runner.sh
    Original file line number Diff line number Diff line change
    @@ -21,13 +21,11 @@ generate_valid_mac() {
    current_mac=$(ifconfig en0 | awk '/ether/{print $2}')
    echo "Current MAC address: $current_mac"

    networksetup -setairportpower en0 off
    sleep 0.5
    networksetup -setairportpower en0 on
    sleep 0.5
    networksetup -setairportpower en0 off && sleep 0.5
    networksetup -setairportpower en0 on && sleep 0.5

    # Wait until we are disconnected from the network
    printf "Waiting for disconnection..."
    printf "Disconnecting from network..."
    while ifconfig en0 | grep -q "status: active"; do
    printf "."
    sleep 1
    @@ -37,22 +35,27 @@ echo ""
    # Keep trying new MAC addresses until successful
    while true; do
    new_mac=$(generate_valid_mac)
    ifconfig en0 ether "$new_mac"
    if [ $? -eq 0 ]; then
    if ifconfig en0 ether "$new_mac" >/dev/null 2>&1; then
    echo "MAC address rolled successfully"
    break
    fi
    sleep 0.2
    done

    networksetup -detectnewhardware
    networksetup -addpreferredwirelessnetworkatindex en0 aainflight.com 0 OPEN
    # Check if new mac is different from old mac, exit if not
    if [ "$current_mac" = "$(ifconfig en0 | awk '/ether/{print $2}')" ]; then
    echo "Failed. New MAC address is the same as the old MAC address? This should never happen."
    exit
    fi

    networksetup -detectnewhardware &>/dev/null
    networksetup -addpreferredwirelessnetworkatindex en0 aainflight.com 0 OPEN &>/dev/null

    # Display new MAC and IP
    echo "New MAC address: $(ifconfig en0 | awk '/ether/{print $2}')"

    # while loop to wait until we have conection
    printf "Waiting for connection..."
    printf "Connecting to network..."
    while ! ifconfig en0 | grep -q "status: active"; do
    printf "."
    sleep 1
    @@ -63,7 +66,7 @@ TIMESTAMP=$(date +%s)
    DEVICE_ID=""
    AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"

    printf "Waiting for device_id..."
    printf "Waiting to be assigned a device from AA..."
    while [ -z "$DEVICE_ID" ]; do
    printf "."
    DEVICE_ID=$(curl -s "https://aainflight.com/device?random=$TIMESTAMP" \
    @@ -96,8 +99,6 @@ OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/of
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventIds":[40,900],"adTypes":[18]}]}' \
    --compressed | jq ".decisions.items[0].offerInteractionId" -r)

    echo "Activating 20 minute wifi..."

    ACTIVATE_RESPONSE=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/offers/$OFFER_ID/activate" \
    -X 'POST' \
    -H 'content-type: application/json' \
    @@ -112,11 +113,14 @@ ACTIVATE_RESPONSE=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/
    status_value=$(echo "$ACTIVATE_RESPONSE" | jq -r '.status')

    if [ "$status_value" = "SUCCESS" ]; then
    # Calculate the time after adding 20 minutes to the current time
    future_time=$(date -v+20M '+%Y-%m-%d %H:%M:%S')
    future_time=$(date -v+19M '+%I:%M:%S %p')
    current_time=$(date '+%I:%M:%S %p')

    current_time=$(date '+%Y-%m-%d %H:%M:%S')
    echo "Successfully activated at $current_time. Run the script again at: $future_time"
    echo "Successfully activated at $current_time"
    echo "Keep this window open, this script will automatically run again in 19 minutes at $future_time..."
    sleep 1140 # 19 minutes in seconds
    bash "$0"
    else
    echo "Activation failed. Status: $status_value"
    echo "Activation failed."
    echo "$ACTIVATE_RESPONSE"
    fi
  6. Geczy revised this gist Dec 29, 2023. 2 changed files with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions 1 readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    This Bash script automates the process of changing the MAC address on a network interface (specifically en0 on macOS, typically used for Wi-Fi) and attempts to activate a 20-minute Wi-Fi session, probably on an American Airlines flight. Here's a detailed breakdown:

    1. Root Check:
    - Exits if not run as root to ensure necessary permissions.

    2. Dependency Check:
    - Checks for the jq command, used for parsing JSON data.

    3. MAC Address Manipulation:
    - Defines generate_valid_mac function for new MAC addresses.
    - Resets Wi-Fi connection by turning it off and on.
    - Tries new MAC addresses until successful.

    4. Network Reconnection:
    - Waits until the en0 network interface is active again after MAC address change.

    5. Device ID Retrieval:
    - Makes an HTTP request to aainflight.com for a device_id, using current timestamp and a specific user agent.

    6. Offer Activation:
    - Retrieves device info and an offer ID from sponsoredaccess.viasat.com.
    - Attempts to activate a Wi-Fi offer using the device_id and offer_id.

    7. Status Check and Response:
    - Checks activation status.
    - Prints a success message with active Wi-Fi session time, or a failure message if activation fails.

    This script is likely for use on American Airlines flights to automate free Wi-Fi access by spoofing MAC addresses and interacting with the in-flight Wi-Fi service's API. However, its usage might violate Wi-Fi provider terms of service and could be unethical or illegal.
    File renamed without changes.
  7. Geczy created this gist Dec 29, 2023.
    122 changes: 122 additions & 0 deletions run.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,122 @@
    #!/bin/bash

    # If not running via sudo, exit
    if [ "$EUID" -ne 0 ]; then
    echo "Please run as root"
    exit
    fi

    # quit if jq is not installed
    if ! command -v jq &>/dev/null; then
    echo "jq could not be found, install using brew install jq"
    exit
    fi

    # Function to generate a valid MAC address
    generate_valid_mac() {
    echo $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
    }

    # Display current MAC and IP
    current_mac=$(ifconfig en0 | awk '/ether/{print $2}')
    echo "Current MAC address: $current_mac"

    networksetup -setairportpower en0 off
    sleep 0.5
    networksetup -setairportpower en0 on
    sleep 0.5

    # Wait until we are disconnected from the network
    printf "Waiting for disconnection..."
    while ifconfig en0 | grep -q "status: active"; do
    printf "."
    sleep 1
    done
    echo ""

    # Keep trying new MAC addresses until successful
    while true; do
    new_mac=$(generate_valid_mac)
    ifconfig en0 ether "$new_mac"
    if [ $? -eq 0 ]; then
    echo "MAC address rolled successfully"
    break
    fi
    sleep 0.2
    done

    networksetup -detectnewhardware
    networksetup -addpreferredwirelessnetworkatindex en0 aainflight.com 0 OPEN

    # Display new MAC and IP
    echo "New MAC address: $(ifconfig en0 | awk '/ether/{print $2}')"

    # while loop to wait until we have conection
    printf "Waiting for connection..."
    while ! ifconfig en0 | grep -q "status: active"; do
    printf "."
    sleep 1
    done
    echo ""

    TIMESTAMP=$(date +%s)
    DEVICE_ID=""
    AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"

    printf "Waiting for device_id..."
    while [ -z "$DEVICE_ID" ]; do
    printf "."
    DEVICE_ID=$(curl -s "https://aainflight.com/device?random=$TIMESTAMP" \
    -H 'accept: application/json' \
    -H 'cache-control: no-cache' \
    -H 'referer: https://aainflight.com/' \
    -H "user-agent: $AGENT" \
    --compressed | jq .guid -r)
    sleep 1
    done
    echo ""

    PRIMARY_DOMAIN="sponsoredaccess.viasat.com"
    DEVICE_INFO=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/device" \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed)

    OFFER_ID=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/offers" \
    -H 'content-type: application/json' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --data-raw '{"placements":[{"divName":"items","count":5,"siteName":"aal_connect","eventIds":[40,900],"adTypes":[18]}]}' \
    --compressed | jq ".decisions.items[0].offerInteractionId" -r)

    echo "Activating 20 minute wifi..."

    ACTIVATE_RESPONSE=$(curl -s "https://$PRIMARY_DOMAIN/engage-advertising-service/api/v1/offers/$OFFER_ID/activate" \
    -X 'POST' \
    -H 'content-type: application/json' \
    -H 'cookie: aal-termsAcceptance=1703259881243;' \
    -H "deviceid: $DEVICE_ID" \
    -H "origin: https://$PRIMARY_DOMAIN" \
    -H "referer: https://$PRIMARY_DOMAIN/americanairlines/" \
    -H "user-agent: $AGENT" \
    -H 'venuecode: aal' \
    --compressed)

    status_value=$(echo "$ACTIVATE_RESPONSE" | jq -r '.status')

    if [ "$status_value" = "SUCCESS" ]; then
    # Calculate the time after adding 20 minutes to the current time
    future_time=$(date -v+20M '+%Y-%m-%d %H:%M:%S')

    current_time=$(date '+%Y-%m-%d %H:%M:%S')
    echo "Successfully activated at $current_time. Run the script again at: $future_time"
    else
    echo "Activation failed. Status: $status_value"
    fi