get correct ipv6 prefix from easy box

This commit is contained in:
2024-05-22 12:41:46 +00:00
parent 080e4ecb6d
commit d26eeb9f63

View File

@@ -44,14 +44,14 @@ done
RETVAL="" RETVAL=""
touch $COOKIEFILE touch $COOKIEFILE
echo "request: http://${HOST}/main.cgi?page=login.html" 1>&2 #echo "request: http://${HOST}/main.cgi?page=login.html" 1>&2
OUT=$($WGET "http://${HOST}/main.cgi?page=login.html" ) OUT=$($WGET "http://${HOST}/main.cgi?page=login.html" )
DM_COOKIE=$(echo $OUT | grep dm_cookie | awk -F"dm_cookie='" '{ print $2 }' | awk -F"'" '{ print $1 }') DM_COOKIE=$(echo $OUT | grep dm_cookie | awk -F"dm_cookie='" '{ print $2 }' | awk -F"'" '{ print $1 }')
echo "DM_COOKIE = "${DM_COOKIE} 1>&2 #echo "DM_COOKIE = "${DM_COOKIE} 1>&2
WBM_COOKIE=$(cat $COOKIEFILE | grep "wbm_cookie_session_id" | awk -F"\t" '{ print $7 }') WBM_COOKIE=$(cat $COOKIEFILE | grep "wbm_cookie_session_id" | awk -F"\t" '{ print $7 }')
echo "WBM_COOKIE = "${WBM_COOKIE} 1>&2 #echo "WBM_COOKIE = "${WBM_COOKIE} 1>&2
# Create a 'special' cookie file without HOST and PATH (important): # Create a 'special' cookie file without HOST and PATH (important):
# cat step1_cookie.txt | sed "s/${HOST}//g" | sed 's/\t\/\t/\t\t/g' > step1_cookie_special.txt # cat step1_cookie.txt | sed "s/${HOST}//g" | sed 's/\t\/\t/\t\t/g' > step1_cookie_special.txt
@@ -71,7 +71,8 @@ fi
if [[ "$1" == "wan" && "$2" == "ipv6prefix" ]]; then if [[ "$1" == "wan" && "$2" == "ipv6prefix" ]]; then
echo "request: http://${HOST}/data_model.cgi" 1>&2 echo "request: http://${HOST}/data_model.cgi" 1>&2
POST_DATA="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header><DMCookie>${DM_COOKIE}</DMCookie><SessionNotRefresh>1</SessionNotRefresh></soapenv:Header><soapenv:Body><cwmp:GetParameterValues xmlns=\"\"><ParameterNames><string>InternetGatewayDevice.X_JUNGO_COM_TR_181.Device.IP.Interface.33948673.IPv6Prefix.2049.Prefix</string></ParameterNames></cwmp:GetParameterValues></soapenv:Body></soapenv:Envelope>" #POST_DATA="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header><DMCookie>${DM_COOKIE}</DMCookie><SessionNotRefresh>1</SessionNotRefresh></soapenv:Header><soapenv:Body><cwmp:GetParameterValues xmlns=\"\"><ParameterNames><string>InternetGatewayDevice.X_JUNGO_COM_TR_181.Device.IP.Interface.33948673.IPv6Prefix.2049.Prefix</string></ParameterNames></cwmp:GetParameterValues></soapenv:Body></soapenv:Envelope>"
POST_DATA="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header><DMCookie>${DM_COOKIE}</DMCookie><SessionNotRefresh>1</SessionNotRefresh></soapenv:Header><soapenv:Body><cwmp:GetParameterValues xmlns=\"\"><ParameterNames><string>InternetGatewayDevice.X_JUNGO_COM_TR_181.Device.IP.Interface.33948673.IPv6Prefix.5121.Prefix</string></ParameterNames></cwmp:GetParameterValues></soapenv:Body></soapenv:Envelope>"
OUT=$($WGET \ OUT=$($WGET \
--post-data="${POST_DATA}" \ --post-data="${POST_DATA}" \