#!/system/bin/sh # These values may need to be extracted from the official HIP report, if made-up values are not accepted. PLATFORM_VERSION="4.3" PLATFORM_NAME="Android-x86" HOST_ID="deadbeef-dead-beef-dead-beefdeadbeef" if [ -z "$APP_VERSION" ]; then APP_VERSION=4.0.2-19; fi # Read command line arguments into variables COOKIE= IP= IPV6= MD5= while [ "$1" ]; do if [ "$1" = "--cookie" ]; then shift; COOKIE="$1"; fi if [ "$1" = "--client-ip" ]; then shift; IP="$1"; fi if [ "$1" = "--client-ipv6" ]; then shift; IPV6="$1"; fi if [ "$1" = "--md5" ]; then shift; MD5="$1"; fi shift done if [ -z "$COOKIE" -o -z "$MD5" -o -z "$IP$IPV6" ]; then echo "Parameters --cookie, --md5, and --client-ip and/or --client-ipv6 are required" >&2 exit 1; fi # Extract username and domain and computer from cookie USER=$(echo "$COOKIE" | sed -rn 's/(.+&|^)user=([^&]+)(&.+|$)/\2/p') DOMAIN=$(echo "$COOKIE" | sed -rn 's/(.+&|^)domain=([^&]+)(&.+|$)/\2/p') COMPUTER=$(echo "$COOKIE" | sed -rn 's/(.+&|^)computer=([^&]+)(&.+|$)/\2/p') # Timestamp in the format expected by GlobalProtect server NOW=$(date +'%m/%d/%Y %H:%M:%S') # WARNING: Replacing this with a here-doc (cat <' echo " $MD5" echo " $USER" echo " $DOMAIN" echo " $COMPUTER" echo " $HOST_ID" echo " $IP" echo " $IPV6" echo " $NOW" echo ' ' echo ' ' echo ' $APP_VERSION' echo " $PLATFORM_NAME $PLATFORM_VERSION" echo ' Google' echo " $DOMAIN.internal" echo " $COMPUTER" echo " $HOSTID" echo ' ' echo ' ' echo ''