Skip to main content

Python Team Awareness Kit (PyTAK) Module

Project description

PyTAK is a Python Module for creating TAK clients & servers.

This module include Classes for handling CoT Events & non-CoT Messages, as well as functions for serializing CoT Events. As a bonus, there are helper functions for classifying Aircraft attitude/affiliation/posture based on ICAO, Emitter Category, Flight Name, et al.

IF YOU HAVE AN URGENT OPERATIONAL NEED: Email ops@undef.net or call/sms +1-415-598-8226

Examples of TAK Clients using the this module:

  • aiscot: Automatic Identification System (AIS) to Cursor on Target (CoT) Gateway. Transforms AIS position messages to CoT PLI Events.

  • adsbcot: Automatic Dependent Surveillance-Broadcast (ADS-B) to Cursor on Target (CoT) Gateway. Transforms ADS-B position messages to CoT PLI Events.

  • adsbxcot: ADS-B Exchange to Cursor on Target (CoT) Gateway. Transforms ADS-B position messages to CoT PLI Events.

  • stratuxcot: Stratux ADS-B to Cursor on Target (CoT) Gateway. Transforms position messages to CoT PLI Events.

  • aprscot: Automatic Packet Reporting System (APRS) to Cursor on Target (CoT) Gateway. Transforms APRS position messages to CoT PLI Events.

See also:

  • pycot: Python Cursor on Target (CoT), a Python Module for serializing CoT Events, for use with TAK clients & servers.

Usage

The following Python 3.7 code example creates a Cursor on Target Client that gets events from a CoT Event Queue and transmits them to our destination URL using TCP. Events are put onto the Queue by the Message Worker (QED). Events are expected to be serialized using the pycot Module:

#!/usr/bin/env python3.7
import asyncio
import urllib
import pytak

loop = asyncio.get_running_loop()
tx_queue: asyncio.Queue = asyncio.Queue()
rx_queue: asyncio.Queue = asyncio.Queue()
cot_url: urllib.parse.ParseResult = urllib.parse.urlparse("tcp:fts.example.com:8087")

# Create our CoT Event Queue Worker
reader, writer = await pytak.protocol_factory(cot_url)
write_worker = pytak.EventTransmitter(tx_queue, writer)
read_worker = pytak.EventReceiver(rx_queue, reader)

message_worker = MyMessageWorker(
    event_queue=tx_queue,
    cot_stale=opts.cot_stale
)

done, pending = await asyncio.wait(
    set([message_worker.run(), read_worker.run(), write_worker.run()]),
    return_when=asyncio.FIRST_COMPLETED)

for task in done:
    print(f"Task completed: {task}")

Requirements

PyTAK requires the FFI Library libffi (or libffi-dev), to install follow these instructions.

Debian & Ubuntu:

$ sudo apt-get install libffi-dev

RedHat, Fedora, CentOS:

$ sudo yum install libffi-devel
# or
$ sudo dnf install libffi-devel

Installation

Option A) Install from the Python Package Index:

$ pip install pytak

Option B) Install from this source tree:

$ git clone https://github.com/ampledata/pytak.git
$ cd pytak/
$ python setup.py install

Build Status

https://travis-ci.com/ampledata/pytak.svg?branch=main

Source

Github: https://github.com/ampledata/pytak

Author

Greg Albrecht W2GMD oss@undef.net

https://www.orionlabs.io/

License

Apache License, Version 2.0. See LICENSE for details.

Style

  1. Prefer double-quotes over single quotes.

  2. Prefer spaces over tabs.

  3. Follow PEP-8.

  4. Follow Google Python Style.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytak-3.1.0.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file pytak-3.1.0.tar.gz.

File metadata

  • Download URL: pytak-3.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for pytak-3.1.0.tar.gz
Algorithm Hash digest
SHA256 3bbafa4bc6d903371c56e935b572800776e9393a0385076d5db37c63615b83a1
MD5 7b1fdf031b3a0e4ad10d8615bd08696f
BLAKE2b-256 b8ff902fd41077aae8d68115344f350e551eea42439754cdce62b6d9b53efc5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page