#!/bin/bash PATH=/bin:/usr/sbin:/usr/bin:/sbin:/opt/sbin:/opt/bin:/usrdata/root/bin # Get query QUERY_STRING=$(/opt/bin/sudo echo "${QUERY_STRING}" | sed 's/;//g') if [ "${QUERY_STRING}" ]; then export IFS="&" for cmd in ${QUERY_STRING}; do if [ "$(echo $cmd | grep '=')" ]; then key=$(echo $cmd | awk -F '=' '{print $1}') value=$(echo $cmd | awk -F '=' '{print $2}') eval $key=$value fi done fi setTTL=$(printf '%b\n' "${ttlvalue//%/\\x}") if [ -n "${setTTL}" ]; then # Stop Service To Remove Rules /opt/bin/sudo /usrdata/simplefirewall/ttl-override stop # Check iptables is still set ttlcheck=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}') # If TTL is still set manually remove values if [ ! -z "${ttlcheck}" ]; then /opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j TTL --ttl-set ${ttlcheck} &>/dev/null || true /opt/bin/sudo /usr/sbin/ip6tables -w 5 -t mangle -D POSTROUTING -o rmnet+ -j HL --hl-set ${ttlcheck} &>/dev/null || true fi # Echo TTL to file /opt/bin/sudo echo $setTTL > /usrdata/simplefirewall/ttlvalue # Set Start Service /opt/bin/sudo /usrdata/simplefirewall/ttl-override start fi # Check iptables for ttlvalue ttlvalue=$(/opt/bin/sudo /usr/sbin/iptables -w 5 -t mangle -vnL | grep TTL | awk '{print $13}') ttlenabled=true; # Set Variables if [ -z "${ttlvalue}" ]; then ttlvalue=0 ttlenabled=false fi echo "Content-type: text/json" echo "" /opt/bin/sudo cat <