Skip to content

Commit

Permalink
New Function to Allow / Disallow Internet for certain machine
Browse files Browse the repository at this point in the history
  • Loading branch information
AnneWielis authored Sep 2, 2024
1 parent a84f1d3 commit 704e242
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions fritzBoxShell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ getSID(){
SID=$(curl -s -k -m 5 --anyauth -u "$BoxUSER:$BoxPW" "http://$BoxIP:49000$location" -H 'Content-Type: text/xml; charset="utf-8"' -H "SoapAction:$uri#$action" -d "<?xml version='1.0' encoding='utf-8'?><s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><u:$action xmlns:u='$uri'></u:$action></s:Body></s:Envelope>" | grep "NewX_AVM-DE_UrlSID" | awk -F">" '{print $2}' | awk -F"<" '{print $1}' | awk -F"=" '{print $2}')
}

### ----------------------------------------------------------------------------------------------------- ###
### ---------------------- FUNCTION SetInternet FOR allowing / disallowing Internet --------------------- ###
### ----------------------------- Here the TR-064 protocol cannot be used. ------------------------------ ###
### ----------------------------------------------------------------------------------------------------- ###
### ---------------------------------------- AHA-HTTP-Interface ----------------------------------------- ###
### ----------------------------------------------------------------------------------------------------- ###

SetInternet(){
# Get the a valid SID
getSID

# param2 = profile
# param3 = on/off

wget -O /dev/null --post-data "sid=$SID&toBeBlocked=$option2&blocked=$option3&page=kidLis" "http://$BoxIP/data.lua" 2>/dev/null
echo "Kindersicherung für $option2 steht auf $option3"

}



### ----------------------------------------------------------------------------------------------------- ###
### ----------- FUNCTION LEDswitch FOR SWITCHING ON OR OFF THE LEDS IN front of the Fritz!Box ----------- ###
### ----------------------------- Here the TR-064 protocol cannot be used. ------------------------------ ###
Expand Down Expand Up @@ -967,7 +988,7 @@ DisplayArguments() {
echo "| MISC_LUA | totalConnectionsWLANguest | Number of total connected Guest WLAN clients (incl. full Mesh) |"
echo "| | totalConnectionsLAN | Number of total connected LAN clients (incl. full Mesh) |"
echo "|-----------------|---------------------------|-----------------------------------------------------------------------------|"
echo "| LAN | STATE | Statistics for the LAN easily digestible by telegraf |"
echo "| LAN | STATE | Statistics for the LAN easily digestible by telegraf |"
echo "| DSL | STATE | Statistics for the DSL easily digestible by telegraf |"
echo "| WAN | STATE | Statistics for the WAN easily digestible by telegraf |"
echo "| WAN | RECONNECT | Ask for a new IP Address from your provider |"
Expand All @@ -979,6 +1000,8 @@ DisplayArguments() {
echo "| REBOOT | Box or Repeater | Rebooting your Fritz!Box or Fritz!Repeater |"
echo "| UPNPMetaData | STATE or <filename> | Full unformatted output of tr64desc.xml to console or file |"
echo "| IGDMetaData | STATE or <filename> | Full unformatted output of igddesc.xml to console or file |"
echo "|-----------------|---------------------------|-----------------------------------------------------------------------------|"
echo "| KIDS | userid and true|false | Block / unblock internet access for certain machine |"
echo "|-----------------|---------------------------|-----------------------------------------------------------------------------|"
echo "| VERSION | | Version of the fritzBoxShell.sh |"
echo "|-----------------|---------------------------|-----------------------------------------------------------------------------|"
Expand Down Expand Up @@ -1095,6 +1118,8 @@ else
fi
elif [ "$option1" = "REBOOT" ]; then
Reboot "$option2"
elif [ "$option1" = "KIDS" ]; then
SetInternet "$option2" "$option3";
else DisplayArguments
fi
fi
fi

0 comments on commit 704e242

Please sign in to comment.