Giter Club home page Giter Club logo

dsame's Introduction

dsame is a program to decode EAS/SAME (Emergency Alert System/Specific Area Message Encoding) alert messages. These messages are primarily used by the National Weather Service for weather-related warnings. dsame will decode a demodulated message, filter by SAME (US/CA) and/or event code, provide readable text, or run an external program.

DO NOT RELY ON THIS PROGRAM WHEN LOSS, DAMAGE, INJURY OR DEATH MAY OCCUR!

###Requirements

###Installation

For Microsoft Windows, dsame is distributed as a self-extracting installer, and downloads for 64-bit and 32-bit systems are available. Run the installer to install the program and optionally multimon-ng and/or rtl_fm.

For Linux and similar systems, dsame is available as a compressed (tar.gz or zip) archive which contains the program source. The source repository can also be cloned using git. Extract and run dsame.py using the python interpreter.

Check here to download the latest release.

###Command Line Options

usage: dsame [-h] [--msg MSG] [--same [SAME [SAME ...]]]
             [--event [EVENT [EVENT ...]]] [--lang LANG]
             [--loglevel {10,20,30,40,50}] [--text] [--no-text] [--version]
             [--call CALL] [--command COMMAND] [--source SOURCE]

####Options

Option Description Example
msg Message to decode. Omit to read from standard input --msg "ZCZC-WXR-RWT-020103-020209-020091-020121-029047-029165-029095-029037+0030-1051700-KEAX/NWS"
same List of SAME codes to monitor --same 029165 029095
event List of event codes to monitor --event RWT TOR SVR
loglevel Set log level --loglevel 10
text, no-text Output/Omit readable message text --text, --no-text
call Call an external program --call alert.sh
command External command line. Omit --call to send to standard output --command "Event Code: {EEE}"
source Source script/program. See /scripts for examples --source source.sh

###Usage

dsame can decode EAS messages from the command line, directly from the output of an external command, or by capturing the ouput of a shell script/batch file or external program. Use msg for command line decoding. The source command is used to capture and decode the output of a script or program. Without one of these options, standard input is used. Press CTRL-C to exit the program.

####Source Scripts

Several sample source scripts and Windows batch files are provided in the scripts directory. If you are using a RTL-SDR device, edit the script to set the frequency, receiver gain and PPM error rate.

###Filtering Alerts

There are two comands used to filter alerts. None, one or both can be specified. The same command is a list of SAME area codes (United States/Canada), and the event command is a list of event codes to monitor.

####Event Codes

This list includes current and proposed event codes.

Code Description Code Description
ADR Administrative Message AVA Avalanche Watch
AVW Avalanche Warning BHW Biological Hazard Warning
BWW Boil Water Warning BZW Blizzard Warning
CAE Child Abduction Emergency CDW Civil Danger Warning
CEM Civil Emergency Message CFA Coastal Flood Watch
CFW Coastal Flood Warning CHW Chemical Hazard Warning
CWW Contaminated Water Warning DBA Dam Watch
DBW Dam Break Warning DEW Contagious Disease Warning
DMO Demo Warning DSW Dust Storm Warning
EAN Emergency Action Notification EAT Emergengy Action Termination
EQW Earthquake Warning EVA Evacuation Watch
EVI Evacuation Immediate EWW Extreme Wind Warning
FCW Food Contamination Warning FFA Flash Flood Watch
FFS Flash Flood Statement FFW Flash Flood Warning
FLA Flood Watch FLS Flood Statement
FLW Flood Warning FRW Fire Warning
FSW Flash Freeze Warning FZW Freeze Warning
HLS Hurricane Local Statement HMW Hazardous Materials Warning
HUA Hurricane Watch HUW Hurricane Warning
HWA High Wind Watch HWW High Wind Warning
IBW Iceberg Warning IFW Industrial Fire Warning
LAE Local Area Emergency LEW Law Enforcement Warning
LSW Land Slide Warning NAT National Audible Test
NIC National Information Center NMN Network Message Notification
NPT National Periodic Test NST National Silent Test
NUW Nuclear Plant Warning POS Power Outage Statement
RHW Radiological Hazard Warning RMT Required Monthly Test
RWT Required Weekly Test SMW Special Marine Warning
SPS Special Weather Statement SPW Shelter in Place Warning
SSA Storm Surge Watch SSW Storm Surge Warning
SVA Severe Thunderstorm Watch SVR Severe Thunderstorm Warning
SVS Severe Weather Statement TOA Tornado Watch
TOE 911 Outage Emergency TOR Tornado Warning
TRA Tropical Storm Watch TRW Tropical Storm Warning
TSA Tsunami Watch TSW Tsunami Warning
VOW Volcano Warning WFA Wild Fire Watch
WFW Wild Fire Warning WSA Winter Storm Watch
WSW Winter Storm Warning

An alert must match one of each specified alert type in order to be processed. If an alert type is omitted, any alert will match that type. In most cases, using only SAME codes to filter alerts will be the best option.

###External Commands

The call option runs an external program, script/batch file for each alert. The command option defines the command string sent to that program, script or batch file, or to standard output if the call option is omitted. The following variables can be used in command strings.

####Command Variables

Variable Description Example
{ORG} Organization code WXR
{EEE} Event code RWT
{PSSCCC} Geographical area (SAME) codes 020103-020209-020091-020121-029047-029165-029095-029037
{TTTT} Purge time code 0030
{JJJHHMM} Date code 1051700
{LLLLLLLL} Originator code KEAX/NWS
{COUNTRY} Country code US
{organization} Organization name National Weather Service
{location} Originator location Pleasant Hill, Missouri
{event} Event type Required Weekly Test
{type} Event type indicator T
{start} Start time 12:00 PM
{end} End time 12:30 PM
{length} Length of event 30 minutes
{seconds} Event length in seconds 1800
{date} Local date 04/15/15 12:00:38
{MESSAGE} Readable message (See sample text output below)

###Sample Commands

Decoding from a text file using standard input:

cat zczc.txt | dsame.py --same 029165

Using a source script to decode from standard input:

dsame.py --same 029165 --source source.sh

Call an external script with the event type and length:

dsame.py --same 029165 --source source.sh --call alert.sh --command "{length}" "{event}"

Decoding a message from the command line:

dsame.py --msg "ZCZC-WXR-RWT-020103-020209-020091-020121-029047-029165-029095-029037+0030-1051700-KEAX/NWS" --text

Print an encoded alert string, and omit the alert text:

dsame.py --source source.sh --no-text --command "ZCZC-{ORG}-{EEE}-{PSSCCC}+{TTTT}-{JJJHHMM}-{LLLLLLLL}-"

Send an alert to a Pushbullet channel:

dsame.py --source source.sh --call pushbullet-channel.sh --command "{event}" "{MESSAGE}"

###Sample Text Output

The National Weather Service in Pleasant Hill, Missouri has issued a Required Weekly Test valid until 12:30 PM for the following counties in Kansas: Leavenworth, Wyandotte, Johnson, Miami, and for the following counties in Missouri: Clay, Platte, Jackson, Cass. (KEAX/NWS)

This experimental Pushbullet channel is updated using dsame, multimon-ng and a rtl-sdr dongle on a Raspberry Pi 2.

###Known Issues

  • SASMEX/SARMEX, a Mexican system for seismic alerts, is not implemented due to lack of documentation.
  • A correct and complete list of ICAO location codes used by the National Weather Service messages is not available.
  • Country detection may not be reliable for some locations with duplicate SAME codes.
  • Date and time information may not be accurate when decoding old messages or messages from another time zone.
  • Multimon-ng will not decode the same alert in succession. This should only be an issue during testing and can be avoided by alternating test alerts.

dsame's People

Contributors

cuppa-joe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsame's Issues

Crash: ValueError: time data

dsame.py dies processing messages, worked fine in 2019, doesn't work in 2020.
Have attached a screen shot of the error.
crash message

Support for Python 3.x needed

The code runs flawlessly in Python 2.x, but just goes awry in Python 3.x. Are there any plans on updating the code to be compatible with Python 3.x? I was trying to make some modifications to the code so I could make a semi-automated system using a random computer I had laying around, but I can't make the proper modifications inside Python 2.x, probably because everything has been depreciated.

Only works on first run with Windows

With the Windows application, dsame only works when "Start dsame" is checked after the installer runs. When this is checked, dsame runs just fine. When launched any other way, dsame does not do anything. I can display help text through cmd, but not actually decode anything.

Any ideas for what to try?

Thanks in advance.

(By the way, when this application works, it works REALLY WELL. Thank you for making such a great application open source!)

Does the Windows rtf_fm+multimon-ng batch file really work?

I have no issues piping output of rtl_fm into multimon-ng on linux but on windows, multimode-ng throws an "open: No such file or directory" error. Any ideas?

INPUT: rtl_fm Device
multimonNG (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
(C) 2012 by Elias Oenal
available demodulators: POCSAG512 POCSAG1200 POCSAG2400 EAS UFSK1200 CLIPFSK AFS
K1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF ZVEI
Enabled demodulators: EAS

open: No such file or directory

Found 2 device(s):
0: Failed to query data
1: Realtek, RTL2838UHIDIR, SN: 10000007

Using device 1: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to 42.10 dB.
Tuned to 162753575 Hz.
Oversampling input by: 46x.
Oversampling output by: 1x.
Buffer size: 8.08ms
Exact sample rate is: 1014300.020041 Hz
Sampling at 1014300 S/s.
Output at 22050 Hz.

DNS Server not Authoritative For Zone

When i try and run a command through it, example dsame.py --msg "ZCZC-EAS-DMO-036000+0100-1311208-ZZTV/NY -" It gives the error "DNS server not authoritative for zone." no clue why it does this. I tried running it as an administrator and nothing.
image

Please consider adding MX as an instance for sending EAS alerts via aprs (SASMEX/SARMEX)

Seismic alerts in Mexico City (SASMEX/SARMEX) follow the ANSI/CTA-2009-B R-2016 standard and are triggerd by a lot of sensors installed all around the west coast of Mexico, they measure the activity of 4 tectonic plates (Caribe, Cocos, Rivera and Pacific). These EAS alarms are only sent in Mexico City and conurbation in the same RF frequencies used by NWS. A given county/catalog/region is not used as it is in the US and CA since it is sent as general announcement by our authorities as can be seen in PSSCCC = 000000.

This is an actual real example of the test sent every 3 hours:

EZCZC-ORG-EEE-PSSCCC+TTTT-JJJHHMMM-LLLLLLLL-
DEZCZC-CIV-RWT-000000+0300-832300-XDIF/005-
DENNNN

Direwolf screen
EAS audio level = 42(8/8) |||||||__
[2.3] EAS>APDW17:{DEZCZC-CIV-RWT-000000+0300-832300-XDIF/005-
User-Defined Data, DireWolf, WB2OSZ

EAS audio level = 41(8/8) |||||||__
[2.3] EAS>APDW17:{DEZCZC-CIV-RWT-000000+0300-832300-XDIF/005-
User-Defined Data, DireWolf, WB2OSZ

EAS audio level = 39(8/8) ||||||___
[2.2] EAS>APDW17:{DEZCZC-CIV-RWT-000000+0300-832300-XDIF/005-
User-Defined Data, DireWolf, WB2OSZ

EAS audio level = 38(8/7) ||||||___
[2.2] EAS>APDW17:{DENNNN
User-Defined Data, DireWolf, WB2OSZ

EAS audio level = 39(8/7) |||||||__
[2.3] EAS>APDW17:{DENNNN
User-Defined Data, DireWolf, WB2OSZ

EAS audio level = 39(8/7) |||||||__
[2.3] EAS>APDW17:{DENNNN
User-Defined Data, DireWolf, WB2OSZ

DEZCZC - origin of the message
CIV - Civil Authority
RWT - Weekly Test
000000 - test (all zones)
+0300 - Indicates the valid period of the message in segments of 15 minutes
832300 -Day in Julian Calendar JJJHHMM
XDIF/005 - Station identifier
DENNNN - end of message

''Earthquake Alert" in spanish "Alerta Sismica" < this is the message that should be sent as WX emergency announcement via APRS locally.

DEZCZC-CIV-EQW-000000+030-832300-XDIF/005-

CIV - Civil Authority
EQW- Earthquake Alert
000000 - test (all zones)
+0300 - Indicates the valid period of the message in segments of 15 minutes
832300 - Day in the Julian Calendar of the alert JJJHHMM
XDIF/005 - Station identifier
DENNNN - end of message

Thank You so much for yur support!!!! a los of HAMS here in Mexico appreciate your extraordinary work!

73!

--command parameters empty

Hi Everyone!

First off, I want to say this project is fantastic so thank you to anyone who has contributed especially cuppa-joe. I have setup an SDR on my RPi3 using multimon and dsame exactly as described in these examples. I am getting all EAS alerts and decoding them with dsame properly. However, I am trying to call an alert.sh script that will then POST the alert data to my server so I can trigger follow on actions. The script gets called correctly and the POST happens correctly but the parameters are empty. Here are a few more details.

The command I run is:
python dsame.py --source rtl_source.sh --call alert.sh --command "{event}" "{EEE}" "{MESSAGE}"

The contents of rtl_srouce.sh are the exact same as the rtl source file in this repo, with one slight adjustment (the frequency in my area is 162.550M instead of 162.500M).

The contents of alert.sh are as follows:
#!/bin/bash

URL=localhost:1880/v1/weather/alert
EVENT=$1
CODE=$2
MSG=$3

curl -X POST --header "Content-Type: application/json" --data-binary "{"event":"$EVENT","code":"$CODE","msg":"$MSG"}" $URL

As yo can see, I am just trying to read in the 3 parameters and curl to a local service (for now).

What I see when I run this is the proper alert text printed to stdout as well as the following object:
{"event":"","code":"","msg":""}
Naturally, that same object is what gets POSTed to my API service.

Am I missing something obvious to get the parameters to be passed into alert.sh?

Thank you!
Jason

Incorrect name for code 051095

Just a quick little thing...code 051095 should be just "James City", not "City of James City". Despite the name, it is a county.

Thank you for an awesome program! :)

Has development for this project been stopped?

There are several issues with dsame, including the fact that it cannot decode EAS headers that are statewide, For instance, trying to decode the following EAS alert using the --msg argument, simply results in blank output.
ZCZC-EAS-RMT-025000+0400-2501633-Comcast
image
This needs to be set up so that we can decode statewide tests and other alerts.

Also, I have noticed several cities are missing from the list, which needs to be updated. If anybody wants to work on these projects, you can make a pull request over at my fork of dsame so that I can get notified, and then you can make a fork or response here, since it appears the author for this project has quit or ceased operations. My fork can be found here https://github.com/RadarFolf/dsame

Is it possible to change the output message?

Hello. I love dsame so far, but I am wondering if it is possible to change the output from:

The National Weather Service in Milwaukee, Wisconsin has issued a Required
Weekly Test valid until 01:30 PM for the following counties in Wisconsin:
Calumet, Dodge, Fond du Lac, Green Lake, Manitowoc, Sheboygan, Washington,
Waushara, Winnebago. (KMKX/NWS)

to:
** ALERT ** ** ALERT **

AGENCY: The National Weather Service in Milwaukee, Wisconson
EVENT: Required Weekly Test
EXPIRE: 01:30 PM
COUNTIES: Calumet, Dodge, Fond du Lac, Green Lake, Manitowoc, Sheboygan, Washington,
Waushara, Winnebago. (KMKX/NWS)

I tried editing MSG__TEXT in defs.py, but it just kept giving me errors. Plus it looks like it doesn't like the triple '/" or \n\r so it creates a new line.

I have very limited Python experience, so any help will be extremely appreciated!!

Thank you
-bigginksu

No updates?

This repository hasn't been updated since 2015, and it looks like there will be no more updates. Saddening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.