This is going to be a quick article. I just want to have an update. I live in Israel, as you may know. And while it's often seems overwhelming and that nothing is possible to do, since the country pretty much stopped caring about politics and was in full military mode for a few years now. Yet small things that are possible to do should be done.
Some time ago, for example there was another senseless attempt by the government to push for cashless. Using the war panic so people will not notice that change. Me and a few people immediately
started a project to push the opposite. Outlining both the human-rights issues with going cashless and also practical things, that might specifically concern people in Israeli government. For example: people from around the world are trying to crash the digital payment systems. And there are sometimes multiple hours long outages of credit cards and stuff. And only cash could be used in those situations.
Another quite creepy thing that I found was bothering me especially in the last week or so as there was a raging war with Iran. When Iran sends rockets towards Israel, Israel notifies people of those rockets immediately, sometimes giving you 10+ minutes to react, using an app by the Home Front Command (פיקוד העורף). And the public air raid sirens are only sounding like a minute and a half before the actual explosions begin.
On the news and everywhere they were constantly repeating how important it is to have this app installed. While they can simply start the sirens earlier. There is a huge percentage of the population here in Israel that refuse to own a smartphone for religious reasons. I'm not even talking about how absolutely terrible owning, and more than that relying, on a smart-phone is. Those are surveillance devices. And the app they want me to install is proprietary.
I did find out though that the app they are using simply downloads this file over and over again:
https://www.oref.org.il/WarningMessages/alert/alerts.json
When nothing is happening the file is empty. When there is an alert of any kind, there is a JSON payload ( encoded as
utf-8-sig
). Here is an example:
{
"id": "133951921230000000",
"cat": "10",
"title": "חדירת כלי טיס עוין - האירוע הסתיים",
"data": [
"יונתן",
"קשת"
],
"desc": "באזורים הבאים בהמשך לדיווח על הפעלת התרעה על כניסת כלי טיס עוין לשמי ישראל - האירוע הסתיים."
}
This happened yesterday in the middle of the night on the north. There was a drone that penetrated into the territory of Israel. It was a brief alert, it was dealt with in a matter of a few minutes. But I was able to capture it.
Then it was a matter of simply writing a script for my self, to have the alerts in some way that is Libre. I wrote this code ( using copy-pasted functions from other things I developed ).
import time
import os
from subprocess import Popen
import json
import urllib.parse
import urllib.request
datais = {
"id": "133951921230000000",
"cat": "10",
"title": "חדירת כלי טיס עוין - האירוע הסתיים",
"data": [
"יונתן",
"קשת"
],
"desc": "באזורים הבאים בהמשך לדיווח על הפעלת התרעה על כניסת כלי טיס עוין לשמי ישראל - האירוע הסתיים."
}
def PlaySong(song, volume=100):
Popen(("mpv",
song,
"--no-video",
"--af=loudnorm",
"--volume="+str(volume)))
def Get(url, data=None, headers={}, raw=False, timeout=10):
if data:
try:
data = json.dumps(data).encode("utf-8")
except:
try:
data = data.encode("utf-8")
except:
pass
req = urllib.request.Request(url, data=data, headers=headers)
f = urllib.request.urlopen(req, timeout=timeout)
if raw:
return f.read()
data = f.read().decode('utf-8-sig')
data = json.loads(data)
return data
YouCanExit = "ניתן לצאת"
Finished = "הסתיים"
EndOfWait = "סיום שהייה"
while True:
try:
data = Get("https://www.oref.org.il/WarningMessages/alert/alerts.json")
except Exception as e:
data = {}
if data:
Popen(['notify-send', data.get("title", "")])
if YouCanExit not in data.get("title", "") and Finished not in data.get("title", "") and EndOfWait not in data.get("title", ""):
PlaySong("alert.ogg")
time.sleep(5)
I have also published it on
Codeberg.
It does basic things. It downloads the file every 5 seconds. Checks for particular words in the
title
that might indicate that the message might not be important. And if the message is important, it sounds an alarm. Playing the
alert.ogg
file from the same directory, using MPV. Otherwise it only gives me a basic notification.
I was able to test that it works today in the morning, because there was a rather large barrage of attacks.
This script as you can see works on GNU / Linux specifically. But based on how simple it is, if you know any other systems, please don't hesitate to develop replacements for the stupid proprietary app the Israeli government offers.
Happy Hacking!!!
JSON
Markdown