Skip to content

Instantly share code, notes, and snippets.

@cloudmaker97
Created December 31, 2024 01:00
Show Gist options
  • Save cloudmaker97/6b7ae8d5e69b09651f8dfa1be9ccebc5 to your computer and use it in GitHub Desktop.
Save cloudmaker97/6b7ae8d5e69b09651f8dfa1be9ccebc5 to your computer and use it in GitHub Desktop.
$url = "https://datapass.de/"
$dataPassText = "Für den Aufruf dieser Seite ist eine Internetverbindung über das Mobilfunknetz notwendig"
$sevenIoKey = "" # API Key from SevenIO
$sevenIoPhone = "49176123456" # Telephone number
$sevenIoName = "FritzBox Fallback"
$sevenIoText = "The cable modem switched to the LTE fallback mode, this message repeats until script turned off"
Write-Host "Checking if $($url) contains a hint for beeing on LTE mode"
try {
$response = Invoke-WebRequest -Uri $url
$content = $response.Content
if ($content -match $dataPassText) {
Write-Host "The current mode seems to be LTE" -ForegroundColor Green
Invoke-RestMethod
-Uri "https://gateway.seven.io/api/sms" `
-Method Post `
-Headers @{ "X-Api-Key" = $sevenIoKey; "Accept" = "application/json" } `
-Body @{
to = $sevenIoPhone;
from = $sevenIoName;
text = $sevenIoText
}
} else {
Write-Host "The current mode seems to be CABLE" -ForegroundColor Yellow
}
} catch {
Write-Host "Failed to access the webpage." -ForegroundColor Red
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment