Tribal Chicken

Security. Malware Research. Digital Forensics.

Location-aware bushfire SMS alerts

I’ve put together a small Python script which can be used to subscribe to a CAP (Common Alerting Protocol) feed, analyse basic information and push it out my SMS Gateway if the alert fits certain location criteria.

[![](/content/images/2015/01/Screen-Shot-2015-01-13-at-11.12.01-pm.png)](/content/images/2015/01/Screen-Shot-2015-01-13-at-11.12.01-pm.png)SMS Alerts. “DST:” Is the distance from home to the fire.
 

You set your home location, the feed you wish to subscribe to and a distance (in Kilometres) in the script. When a new alert is delivered on the data feed, the script will determine if the alert location falls within the radius you have specified. If so, the alert topic is sent via SMS.

Of course this could be sent by any method (Push notification, email or even a phone call if you have the hardware).

Why?

Well, I find an SMS is still a good “In your face” notification method. This way, when there is an alert of interest, I receive the SMS within a few minutes prompting me to look up the full alert text.

Sure, there are other methods: Use a feed reader to process the RSS feed, monitor the Twitter account, etc. However, I find that most of these other methods require active intervention to check and process the alerts.

Currently in Australia, each state manages its own emergency services, who in turn have their own setup for disseminating information. There have been a few projects to aggregate all information, but from what I have seen none of these do quite what I am looking for.

Having said this, I actually see a great opportunity for collaboration to create a single “Australian Emergency Data Feed” (Utilising CAP-AU-STD) which can be used as a central feed consisting of the aggregated alerts from each state.

[![Screen Shot 2015-01-13 at 11.46.21 pm](/content/images/2015/01/Screen-Shot-2015-01-13-at-11.46.21-pm.png)](/content/images/2015/01/Screen-Shot-2015-01-13-at-11.46.21-pm.png)DFES CAP Message
### So what does it do?

Anyway, DFES in WA Publish a CAP feed (also GeoRSS, if you’re interested) to the website. We simply periodically scrape the CAP XML data feed. Once we have the XML we parse the CAP data

Then, once we have the data, we perform just two main checks  on each alert contained within the feed:

  1. Is this a new alert (which we haven’t seen before) (id)
  2. Does the alert location fall within our area of interest (area: circle)

The script is aware of two things. The “Home location” (Set to the coordinates of my house) and the “Distance”. The distance is calculated between the two coordinates using the haversine formula.

If the answer is yes to both, then we extract a summary and send via email to my SMS Gateway.

[![Screen Shot 2015-01-13 at 10.56.32 pm](/content/images/2015/01/Screen-Shot-2015-01-13-at-10.56.32-pm.png)](/content/images/2015/01/Screen-Shot-2015-01-13-at-10.56.32-pm.png)Assessing new alerts
Now, clearly we don’t want to get spammed with an alert each time we scrape the data feed. So each time we process an alert, we store some of the information in an SQLite database. This way, further conditions can be evaluated.
  1. Notify if the alert is of a different severity level to the previous notification.
  2. Notify if the alert has a severity level of “Extreme”, regardless of previous notifications.

In practice, what this means is only one “All Clear, Advice or Watch and Act” notification will be sent. When the severity is upgrade or downgraded, a notification will also be sent.

“Emergency Warning” alerts will always be sent.