Last active
April 10, 2025 23:15
-
-
Save Geczy/a7a3fc87daf7d9d8f5d98ee3d4c967ef to your computer and use it in GitHub Desktop.
free american airlines wifi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment