Tracking .mil Aircraft

fred555

Pub Member
Original poster
Lifetime Supporter
Sep 18, 2014
7,976
7,024
77W
Part I : Introduction (Warning Linux Content Ahead, PERL Too)

I just noticed this SDR related forum recently. I have a project I have been working on but want to throw it out here for anyone that is interested in taking it further. I have been busy building my dish farm and have not had time for this endeavor.

The output of the project, using PERL, in its current state is aircraft type, base of operation, unit information and some comments about the aircraft. Output is to a text log using tail to see live output, not very fancy. Its sorta fun to go over the log when you get home from work. You can see that Looking Glass (the Doomsday Plane) has overflown your house while you are at work! You will also learn about very specialized aircraft in the US fleet.

http://en.wikipedia.org/wiki/Operation_Looking_Glass

There are some rare types with only one or two in existence. I won't mention any of that here, but you will find them. Surprisingly Wikipedia has a lot of info on these types. You will be amazed that you did not realize how much is going on right over your head.

It was first developed on the raspberry pi in Debian Wheezy. I went ahead and built a mini ITX box with loads of RAM, a 3.4Ghz dual core processor and a 250 Gig SSD. Wow what a difference. Loaded Debian 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux.

As I am writing this I just remembered I rewrote this project entirely in Visual Basic .NET for Windows, using adsb# or adsbscope for Windows as the data source I think. So a 100% Windows version is possible.
Maybe I will post it later but It is very rough. I was a programmer long ago and this is just a hobby now.


First Step:

Go here and get Dump1090 running as a service that starts at startup:
http://www.satsignal.eu/raspberry-pi/dump1090.html

I use the following line in dump1090.sh when starting the service:
PROG_ARGS="--quiet --net --net-ro-size 500 --net-ro-rate 5"

Go ahead ahead and get familiar with Dump1090. Bring up a browser and play around with it, although the GUI wont be used here.

Next go here and get familiar with this project (navigation is difficult):
http://www.live-military-mode-s.eu/

Particularly this page and you will see where this is leading:
http://www.live-military-mode-s.eu/overviewUS.php

Here is a sample of the data:
AE035E 58-0077 KC-135T K35R PA ANG | 171ARW [KPIT] confirmed Geilenkirchen Source: own log

This is a KC-135T from the Pennsylvania Air National Guard, 171st Air Refueling Wing based out of Pittsburgh International Airport. Some entries will include a picture of the actual aircraft or just a stock picture.

End of Part I
 
Last edited:
  • Like
Reactions: Titanium
Part II: Downloading Aircraft Info

The next step is to download the aircraft data into a single file that will use ICAO Hex ID as an index to pull down Information about the aircraft in later steps.

I am going to assume you know how to add the needed PERL modules to your system

I am certain I am a rotten PERL coder and there are a thousand ways of doing this better.
So no flames on how bad I am.

In the following PERL code you will have to change this line to suit your needs:
my $filename = "/home/fred/perladsb/adsb.db";
In this case it will build the file with a name of adsb.db

Go ahead and cd to the directory its in and type ./getdb.pl
It will give you some feedback as it is running and it will take at least five minutes or more to download.
Go ahead and look at the file when it's done and scroll through all the various aircraft.
 

Attachments

  • getdb.pl.txt
    1.6 KB · Views: 298
Last edited:
  • Like
Reactions: Titanium
Part III: The Client

The last piece is the client. As coded it is on the same box as Dump1090, but can be offloaded
to other hardware. Useful if Dump1090 is on a raspberry Pi and processing is offloaded to another box.
I guess you could also mix and match. Put the raspberry Pi up on the antenna on the roof and use Windows as a decoder. This code should explain why:

my $socket = new IO::Socket::INET (
PeerAddr => '127.0.0.1',
PeerPort => 30002,
Proto => 'tcp',

A tcp socket is opened by Dump1090 then the client connects to it to read the stream.

Also change these two lines to suit your needs:
my $filename = '/home/fred/report.txt';
my $dbfile = '/home/fred/perladsb/adsb.db';

I use the following command to start the program so the PERL client runs after logoff:
nohup perl /home/fred/perladsb/fatclient.pl &

I would like to see how to start PERL code as a service reliably.

Use this command with your path info to watch live:
tail -f /home/fred/report.txt

Also I should probably explain this line:

if ($recv_data =~ /^\*..AE/ or $recv_data =~ /^\*..016/ or $recv_data =~ /^\*..777/ or $recv_data =~ /^\*..B/ or $recv_data =~ /^\*..ADFC/ or $recv_data =~ /^\*..ADFD/ or $recv_data =~ /^\*..ADFE/ or $recv_data =~ /^\*..ADFF/) {

US .mil ICAO codes are in certain ranges, for the most part. This line says only show me aircraft that match these conditions. If I remember correctly, there are two other characters that start off the transmission, depending on packet type, then the ICAO code. That's the reason for the .. in the regex.

If you live in another country you will have to modify the db datasource url and regex to suit your needs in tracking military planes from other nations.

So in operation the following will happen:

Dump 1090 recieves a packet, the PERL client sees the following ICAO: AE016F
the regex ( /^\*..AE/ ) sees its .mil, looks up the ICAO in the file and prints out:

Thu Jun 19 15:24:44 2014 AE016F,84-0077,C-21A,USAF | 375AW | 457AS [KADW]

Its a Learjet based Air Force C-21a out of Andrews [KADW], tail number 84-0077, 375th Air mobility Wing/457th Airlift Squadron.

http://en.wikipedia.org/wiki/457th_Airlift_Squadron

Then Google 84-0077:
624047.jpg

And here is the actual plane.
http://www.airport-data.com/aircraft/photo/000624047.html

Enjoy

END Part III
 

Attachments

  • fatclient.pl.txt
    1.2 KB · Views: 255
Last edited:
Here is what a Doomsday Plane sighting looks like:

Thu Dec 25 07:30:11 2014 AE041C,164410,E-6B,USN | SCW-1 [KTIK]

Airborne Communications—The Navy's E-6B Mercury aircraft provide a survivable communications link between national decision-makers and the nation's strategic forces. An airborne command post, the E-6B enables the President and the Secretary of Defense to directly contact crews on the nation's ballistic missile submarines, land-based intercontinental ballistic missiles and long-range bombers. The E-6B aircraft are assigned to Strategic Communications Wing One at Tinker AFB, Oklahoma.

index.jpeg
 
the secret squirrel outfits when flying operational missions will not show up using this.

True, they wont have the transponders turned on. Some secret planes are required by treaty to keep the transponders on at all times however, not sure which ones exactly. Unless its war I guess.
 
Last edited:
Thanks for posting, very interesting! Will have to look at the links more in depth, when kids are not running around hyped up on Christmas candy. :)
 
  • Like
Reactions: Titanium
Not .mil but here are 3 interesting aircraft:
A0FE19,N163PA,G-1159A,Ebola Patient Transport Plane
A12598,N173PA,G-1159A,Ebola Patient Transport Plane
A18372,N197PA,G-1159A,Ebola Patient Transport Plane

Add manually to db file and add the regex's to client, I have not seen them yet.

N173PA is scheduled to fly to Western Africa today:
http://flightaware.com/live/flight/N173PA

n173pa.jpg plane2.jpeg plane3.jpegroute.jpg
 
Last edited:
The .mil aircraft DB source url in my code is not valid after all these years.
I am working on updating my data source.
 
***

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Who Read This Thread (Total Members: 3)