Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to check the USA's Homeland Security threat level UNIX
Here's a one-line shell command to get the current threat level from the Department of Homeland Security:
alias hstl 'echo -n "Threat Level: ";'" curl -s
 http://www.dhs.gov/dhspublic/getAdvisoryCondition | 
 tail -n 1 | awk -F\"'"'" '{ print "\$2" }'"
NOTE: Enter the above as one long line with a space before http and tail; broken up here for easier readability.

Example:

macosx % hstl
Threat Level: HIGH


Tested with tcsh and 10.2.6 only.

[robg adds: Works fine in 10.3.2, too.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,006 views]  

A script to check the USA's Homeland Security threat level | 25 comments | Create New Account
Click here to return to the 'A script to check the USA's Homeland Security threat level' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to check the USA's Homeland Security threat level
Authored by: Greedo on Jan 16, '04 11:27:10AM

Considering the threat level has, since it was implemented, only ever been at ELEVATED or HIGH (the 2nd and 3rd highest levels), this isn't terrible useful. :)



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: jonny5 on Jan 16, '04 11:33:10AM
I had trouble getting awk to work, and not being an awk guy, I've changed it to use cut instead:

alias threat='echo -n "Threat Level: "; curl -s http://www.dhs.gov/dhspublic/getAdvisoryCondition | tail -n 1 | cut -f 2 -d\"'


[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: joshuajestelle on Jan 16, '04 12:35:59PM

I had trouble getting this to work as an alias under bash, so I wrote it as a shell script as follows:


#!/bin/sh

echo -n "Threat Level: "
curl -s http://www.dhs.gov/dhspublic/getAdvisoryCondition | tail -n 1 | awk -F\" '{print $2}'



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: jonn8n on Jan 16, '04 12:46:25PM
Here it is as an AppleScript:

--Open this script in a new Script Editor window.

set the_command to "curl -s 'http://www.dhs.gov/dhspublic/getAdvisoryCondition' | grep CONDITION"
set the_level to (word -1 of (do shell script the_command))
display dialog ("Terror Alert Level: " & the_level) buttons {"OK"} default button 1 with icon 2 giving up after 10
Jon

[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: BGK on Jan 16, '04 12:46:52PM

This has been a wartime economy for decades and decades.
God bless no one!

---
I'm washing dishes to pay for this.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: prk on Jan 16, '04 02:59:59PM
Here is a quicky PHP script for your home page:

<?php
$threat = eregi_replace('.*CONDITION="(.*)" />', '\1', implode('\n', file("http://www.dhs.gov/dhspublic/getAdvisoryCondition")));
print "Homeland Security Threat Leval: $threat.";
?>


[ Reply to This | # ]
bash?
Authored by: CkB_Cowboy on Jan 16, '04 03:38:32PM
That didn't work for me in bash, but this does:
alias hstl="echo Threat Level: `curl -s http://www.dhs.gov/dhspublic/getAdvisoryCondition | tail -n 1 | awk -F'"' '{print $2}'`"
- Cowboy

---
My ill-matic homepage:
http://rj3.net/cowboy/

[ Reply to This | # ]

A script to check the USA's Homeland Security threat level
Authored by: maged on Jan 16, '04 04:31:44PM
I don't want to turn this into a political discussion or flame war, but while this may be interesting on a technical level, the real question is, what do you actually do when the color changes from Yellow to Orange? Just received today Bruce Schneier's (Blowfish inventor) commentray on the issue:

Color-coded Terrorist Threat Levels

Quote:
The color-alert system, on the other hand, is not tied to any specific actions. People are left to worry, or are given nonsensical instructions to buy plastic sheeting and duct tape. Even local police departments and government organizations largely have no idea what to do when the threat level changes. The threat levels actually do more harm than good, by needlessly creating fear and confusion (which is an objective of terrorists) and anesthetizing people to future alerts and warnings. If the color-alert system became something better defined, so that people know exactly what caused the levels to change, what the change means, and what actions they need to take in the event of a change, then it could be useful. But even then, the real measure of effectiveness is in the implementation. Terrorist attacks are rare, and if the color-threat level changes willy-nilly with no obvious cause or effect, then people will simply stop paying attention. And the threat levels are publicly known, so any terrorist with a lick of sense will simply wait until the threat level goes down."

Living under Orange reinforces this. It didn't mean anything. Tom Ridge's admonition that Americans "be alert, but go about their business" reinforces this; it's nonsensical advice. I saw little that could be considered a good security trade-off, and a lot of draconian security measures and security theater.

[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: foobar104 on Jan 16, '04 05:19:20PM

I share your intention of not going all political and whatnot. That said, please remember that the alert conditions most certainly do have very concrete and specific meanings. Airport and event security procedures differ under yellow and orange. Police and highway patrol procedures differ. Security conditions at hospitals, shopping malls, arenas, schools, and other places where lots of people gather differ significantly between yellow and orange. Procedures for the national guard differ. Under orange, air national guard units fly combat air patrols over sensitive places like cities and military installations, and the rules of engagement are altered. Under orange, incoming international passenger and cargo flights are intercepted by ANG aircraft, and often guided right in to their points of destination.

Just because it doesn't mean anything to you, a private citizen unconnected in any way to a defense or security organization, don't conclude that it doesn't mean anything to anybody.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: mewyn on Jan 16, '04 06:09:28PM

I do realize that this is OT, but what the hay. I work at one of the largest hospitals in the Chicago area, and we have no changing proceedures that change based on this 'threat level.' Most people here wouldn't even know what level it is on a given day.

Also, I have flown on both orange and yellow days, and the security did not seem a bit different. If you have some secret insight into this, I sure would like to know.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: raider on Jan 17, '04 01:56:47AM
Neither our local nor state change their police or highway patrol procedures when the threat levels change. In fact, they are so under funded - the stupid threat level color is the last thing they think about. Also, I have never noticed any change at any of our State Government facilities, nor in our airports. None of our shopping malls change a thing either. In fact, the only thing that I can recal changing with the terror threat level indicator is what they will allow into the local NBA games... They stop allowing bags or backpacks when the level gets elevated. That'll save the world...

The threat level color is the most useless and wasted effort in the government today, bar none.

Aside from the stupidity of the color code system, this is a pretty cool hint though... Even if it serves no practical purpose...

[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: Cerberus on Jan 17, '04 06:38:51AM

I think you are closer than any other persion to this. Each institution or government facility is able to better assess its response and security diligence with the threat level.

My local airport might operate under a yellow, which causes A, B and C to happen, but this may only visibly affect the TSA (Transportation Security Administration, a GOVERNMENT agency) who ONLY screen your baggage. The airlines have their own policy(s), which may or may not change with the threat level.

When the threat level changes, I see random FULL-CAR searches at the airport, and that happens BEFORE anyone gets within 1500 feet of the airport. Sometimes they shut down the short-term parking. Around here usually Delta allows you to get on a plane without ID (and at some other airports) but NorthWest (ALWAYS SEEMS TO) want a picture ID and your boarding card etc. However if you fly into Atlanta (atlanta-hartsfield is the busiest airport in the United States and HUb for Delta, AirTran and a few others) usually Delta will ask you for a picture ID to get on any flight. So I can get on a plane from here without an ID but have to present one to keep going to my destination. etc.etc.etc. So it is up to each group what to do with the threat level and I think this is as it should be. Keep'em on their toes (and by them I mean anyone trying to threaten me and my fellow human beings)

BTW. I *PERSONALLY* have not had the threat level change my habits and whether that is naivety or a trust in my fellow citizens and a general trust in the decency of mankind if for noone to judge or comment on but me.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: lipids on Jan 16, '04 07:50:23PM
I completely agree. However, I will not put politics aside just for the sugar coated, PC, avoidance of confrontation. The threat level is simply another way to contrtol the masses. A police state is well on its way in the U.S.. OK, delude yourself, write me off as some sort of paranoid freak, it is easier that way. However, those that think they are free may one day realize they are not. At that point your only choice for freedom will be death.

We are on the brink of civil war. You may think that the country is too lazy to rise up against its leaders, but as I am sure you already know, apathy is merely the curtain in front of growing discontent. So, I ask you all to consider these excerpts from Patrick Henry's famous address to the pre U.S. Senate in 1775. Swap out British with Bush Administration.

"it is natural to man to indulge in the illusions of hope. We are apt to shut our eyes against a painful truth, and listen to the song of that siren till she transforms us into beasts. Is this the part of wise men, engaged in a great and arduous struggle for liberty? Are we disposed to be of the numbers of those who, having eyes, see not, and, having ears, hear not, the things which so nearly concern their temporal salvation? For my part, whatever anguish of spirit it may cost, I am willing to know the whole truth, to know the worst, and to provide for it."

"But when shall we be stronger? Will it be the next week, or the next year? Will it be when we are totally disarmed, and when a British guard shall be stationed in every house? Shall we gather strength but irresolution and inaction? Shall we acquire the means of effectual resistance by lying supinely on our backs and hugging the delusive phantom of hope, until our enemies shall have bound us hand and foot? Sir, we are not weak if we make a proper use of those means which the God of nature hath placed in our power. The millions of people, armed in the holy cause of liberty, and in such a country as that which we possess, are invincible by any force which our enemy can send against us. Besides, sir, we shall not fight our battles alone. There is a just God who presides over the destinies of nations, and who will raise up friends to fight our battles for us. The battle, sir, is not to the strong alone; it is to the vigilant, the active, the brave. Besides, sir, we have no election. If we were base enough to desire it, it is now too late to retire from the contest. There is no retreat but in submission and slavery! Our chains are forged!"

[ Reply to This | # ]

A script to check the USA's Homeland Security threat level
Authored by: pobs on Jan 16, '04 08:38:19PM

I think that a small improvement to this code is in order:

alias NervousWreck 'echo -n "Threat Level: ";'" curl -s http://www.dhs.gov/dhspublic/getAdvisoryCondition | tail -n 1 | awk -F\"'"'" '{ print "\$2" }'"

I think it'll work much better now.


No one get worried ... we are all fine. Right?



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: johnq on Jan 17, '04 07:18:45PM

My main issue with the threat levels is the naming.

Low - No problem with Low

Guarded - This basically meaningless. It implies Low is "unguarded", which we will never be again, presumably. It doesn't answer the implicit question of ""what is the current threat level""? "Low", "High" and "Severe" answer this question.
"Elevated" and "Guarded" do not, in different ways.

Elevated - Big problem with this one. Since it is also a verb, we get into ridiculous situations where we have to say "The Homeland Security Threat level was elevated from Elevated to High today" or "The Homeland Security Threat level was lowered from Elevated to Guarded today". Confusion occurs whether the level was Elevated or elevated (raised) from some other level.

High - High and Severe are not different enough, nearly interchangeable. "My daughter had a sever fever last night" or "My daughter had a high fever last night"...

Severe - see above.

Basically I would like less ambiguous labels.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: Cantus on Jan 16, '04 05:43:12PM
Using sed:

curl 'http://www.dhs.gov/dhspublic/getAdvisoryCondition' | tail -1 | sed 's/<.*="/Threat Level: /g;s/".*>//g'

Enjoy!

[ Reply to This | # ]

A script to check the USA's Homeland Security threat level
Authored by: zs on Jan 17, '04 04:32:43AM

Thank you very much Rob for this great site.

All I have to say is that this type of hint is of a political nature and that I have no choice but to respond with my own thoughts on the subject. My first reaction when I saw this hint was:

Are you ignorant enough to need to be told when you should be afraid?

The entire idea of a "Terror Alert" only deserves such mockery: <http://www.geekandproud.net/terror/>

I know that regardless of this artificial level, I will still do my best to care for my family and my friends- and any stranger I find that is in need of help.

Wake up!

z

---
zs



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: schack on Jan 17, '04 06:04:32AM

Boy, you guys are getting a bit paranoid! Ease up over there. :-)



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: fearless on Jan 17, '04 06:30:30AM

Brazil has the right idea - they (and the rest of us) have as much reason to be scared of Americans as Americans have to worry about Brazilians... next Brazil will be in the Axis of Evil and 97% of Americans will tell you the 9/11 hijackers came from south America...



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: jason mark on Jan 17, '04 08:41:12AM

According to Ashcroft the only reason we as a country even have an office of homeland security is to "remind people to be afraid".

If you work for the FBI this is a GREAT thing because a lot of laws and executive orders have been passed lately that are unconstitutional, and people haven't really complained about them because they're afraid.


Of course it might backfire if people start to realize that they're spending a lot of their taxpayer money to be more afraid in their day-to-day life. Not a great ROI that.... :)


I don't think I need a script on my machine to remember to be afraid.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: murali1080 on Jan 17, '04 09:16:59AM

Foolishness at its extreme! Sorry to be blunt but paranoia has no excuse and US is filled with it. It is a culture of fear culminating in unbelievable benefits to the ruling elite of the US. I think all Americans should be made to watch "Bowling for Columbine," a movie-documentary by Micahel Moore.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: daniello on Jan 17, '04 11:56:45AM

Interview with Hermann Goehring:

Gilbert: 'We got around to the subject of war again, and I said that, contrary to his attitude, I did not think that the common people are very thankful for leaders who bring them war and destruction.'

Goehring: '... But, after all, it is the leaders of the country who determine the policy, and it is always a simple matter to drag the people along, whether it is a democracy or a fascist dictatorship or a Parliament or a Communist dictatorship.'

Gilbert: ' There is one difference, I pointed out. In a democracy, the people have some say in the matter through their elected representatives, and in the United States, only Congress can declare wars.'

Goehring: ' Oh, that is all well and good, but, voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country.'

--'Nuremberg Diaries,', G.M. Gilbert, in which the author interviews Hermann Goehring.



[ Reply to This | # ]
A script to check the USA's Homeland Security threat level
Authored by: mproud on Jan 18, '04 12:56:54AM
YES!

That's EXACTLY what I thought when I saw it for the first time!

YES!

[ Reply to This | # ]
Moore is okay, Chomsky is smarter
Authored by: thinkyhead on Jan 19, '04 09:06:42PM

I note that there's scads of Chomsky audio on the fileshare networks these days. Check him out, he's been reading the newspapers and keeping track of the historical facts for 60 years. There is no doubt that "the masses" are being kept down and that the US government is hypocritical to the core, but knowing how and why is better than simply assuming so.

And if you're in a mood to feel better about the universe there's lots of Alan Watts audio on those fileshare networks too. I prefer Acquisition on Mac OS X. It's the only Limewire client I've ever admired.

---
|
| slur was here
|



[ Reply to This | # ]
GROAN!!!
Authored by: gatorparrots on Jan 18, '04 01:42:15PM
Now someone wrote an application based on this "hint"! What a colossal waste of time!!!
DHS Advisory
http://homepage.mac.com/jonn8/as/html/DHS_Advisory.html

[ Reply to This | # ]