Code Monkey home page Code Monkey logo

aprscot's Introduction

aprscot - APRS Cursor-on-Target Gateway.

Screenshot of APRS PLI in ATAK.

The APRS to Cursor On Target Gateway (APRSCOT) provides beyond line-of-sight blue force tracking capabilities using commercial off the shelf components. This gateway uses the Automatic Packet Reporting System (APRS) and APRS-IS network to forward APRS position reports to Cursor On Target (COT) clients such as the Android Team Awareness Kit (ATAK), WinTAK, et al. Other situational awareness & common operating picture platforms are supported through use of COT, such as TAKX & COPERS.

APRS Frames can also be transformed or callsigns normalized before forwarding as COT. Almost any network destination is available, including TCP & UDP Mulitcast.

Features of aprscot:

  • Handles APRS-IS transported APRS Frames from over-the-air or Internet-based stations.
  • Can transform APRS station callsign, COT Type and COT Icon for display in TAK systems.
  • Can run as a service ('daemon') on any Linux system.
  • Can send COT Events to any destination supported by PyTAK: TLS/SSL, TCP, UDP, UDP Multicast.

See also:

Concept:

APRSCOT concept diagram.

Support Development

Tech Support: Email [email protected] or Signal/WhatsApp: +1-310-621-9598

This tool has been developed for the Disaster Response, Public Safety and Frontline Healthcare community. This software is currently provided at no-cost to users. Any contribution you can make to further this project's development efforts is greatly appreciated.

Support Development: Buy me a coffee!

Installation

The APRS to COT gateway is service started with a command-line tool called aprscot. There are three options for installing aprscot, in order preferred option they are:

Option I: Install as a Debian / Ubuntu Package:

$ wget https://github.com/ampledata/pytak/releases/latest/download/python3-pytak_latest_all.deb
$ sudo apt install -f ./python3-pytak_latest_all.deb
$ wget https://github.com/ampledata/aprs-python/releases/latest/download/python3-aprslib_latest_all.deb
$ sudo apt install -f ./python3-aprslib_latest_all.deb
$ wget https://github.com/ampledata/aprscot/releases/latest/download/python3-aprscot_latest_all.deb
$ sudo apt install -f ./python3-aprscot_latest_all.deb

Option II: Install from the Python Package Index (PyPI):

$ python3 -m pip install aprscot

Option III: Install from this source tree:

$ git clone https://github.com/ampledata/aprscot.git
$ cd aprscot/
$ python3 setup.py install

Usage

The aprscot program has one command-line argument:

$ aprscot -h
usage: aprscot [-h] [-c CONFIG_FILE]

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --CONFIG_FILE CONFIG_FILE

You must create a configuration file, see example-config.ini in the source repository.

An example config, COT_URL is our COT destination server or client:

[aprscot]
COT_URL = tcp://takserver.example.com:8088

APRS-IS Server-side Filter Commands can be used to filter incoming APRS Frames:

[aprscot]
COT_URL = tcp:takserver.example.com:8088
APRSIS_FILTER = f/W6PW-10/50

PLI Transforms can be created using per-station sections. In this example, we're overriding W2GMD-9's COT Type & Callsign, and NB6F-2's Callsign:

[aprscot]
COT_URL = tcp:takserver.example.com:8088

[W2GMD-9]
COT_TYPE = a-f-G-U-C
COT_STALE = 600
COT_NAME = Medic 52

[NB6F-2]
COT_NAME = Transport 2

Source

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

Author

Greg Albrecht W2GMD [email protected]

https://ampledata.org/

Copyright

License

Copyright 2022 Greg Albrecht <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

aprscot's People

Contributors

ampledata avatar sn1per avatar sniporbob 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

Watchers

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

aprscot's Issues

Local RF Only Option

It is possible to use an Xastir instance as a server instead of connecting to aprs.net over the internet.

It may be possible to pass variables in the config.ini file to specify the host and port in the modified lines below:

To do this:
Run Xastir, with the "Enable Server Ports" function enabled under the Interface menu.
Setup your interfaces in Xastir to use local RF - there are many ways to do this, Direwolf and an audio feed from a transceiver or SDR for example.

modify constants.py, changing the following lines:

#DEFAULT_APRSIS_PORT: int = 14580
#DEFAULT_APRSIS_HOST: str = "rotate.aprs.net"
DEFAULT_APRSIS_PORT: int = 2023
DEFAULT_APRSIS_HOST: str = "localhost"

The above assumes that aprscot is running on the same machine as Xastir.
aprscot will now connect to the local Xastir instance instead of aprs.net servers.

Issue running on Ubuntu 20.04

Using fresh Ubuntu 20.04 image along with the Debian/Ubuntu packages or the PIP install or even building from source with fresh images each time getting the following when trying to run the software:

aprscot -c ./aprs.ini
Traceback (most recent call last):
File "/usr/bin/aprscot", line 11, in
load_entry_point('aprscot==5.0.5', 'console_scripts', 'aprscot')()
File "/usr/lib/python3/dist-packages/aprscot/commands.py", line 74, in cli
asyncio.run(main(config), debug=config["aprscot"].getboolean("DEBUG"))
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/usr/lib/python3/dist-packages/aprscot/commands.py", line 39, in main
reader, writer = await pytak.protocol_factory(cot_url)
File "/usr/lib/python3/dist-packages/pytak/client_functions.py", line 53, in protocol_factory
reader, writer = await asyncio.open_connection(host, port)
File "/usr/lib/python3.8/asyncio/streams.py", line 52, in open_connection
transport, _ = await loop.create_connection(
File "/usr/lib/python3.8/asyncio/base_events.py", line 986, in create_connection
infos = await self._ensure_resolved(
File "/usr/lib/python3.8/asyncio/base_events.py", line 1365, in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

Don't raise on bad APRS frames.

ubuntu@ubuntu:~$ aprscot -c xxx-10 -U tcp:1.2.3.4:8088 -f 'm/200'
2021-05-14 17:52:53,641 pytak INFO - Using APRS Host: rotate.aprs.net:14580
2021-05-14 17:52:53,642 pytak INFO - Running EventTransmitter
2021-05-14 17:52:53,643 pytak INFO - Running APRSWorker
2021-05-14 17:52:53,647 pytak INFO - Running EventReceiver
2021-05-14 17:52:55,266 pytak INFO - Using APRS Filter: 'm/200'
Task completed: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py:71> exception=ParseError('invalid format')>
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py:71> exception=ParseError('invalid format')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py", line 91, in run
    await self.handle_message(frame)
  File "/usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py", line 56, in handle_message
    aprs_frame = aprslib.parsing.parse(message)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/_init_.py", line 114, in parse
    _try_toparse_body(packet_type, body, parsed)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/_init_.py", line 204, in _try_toparse_body
    body, result = parse_position(packet_type, body)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/position.py", line 59, in parse_position
    raise ParseError("invalid format")
aprslib.exceptions.ParseError: invalid format

When is started with tpc, cannot be changed to udp

When start the aprscot with config containing COT URL = TCP *******, cannot start again with COT URL = UDP
i have 2 different configs one for TCP and second for UDP and start server with one of them depend on the need.
pytak is not installed on my system - cannot be installed it returns some errors which i cannot fix

when i run aprscor -c conf.ini return: and exit
the error:
2023-01-04 11:16:46,531 pytak INFO - COT Dest: udp://239.2.3.1:6969
2023-01-04 11:16:46,531 aprscot - Run: <class 'pytak.classes.CLITool'>
2023-01-04 11:16:46,533 aprscot - Run: <class 'pytak.classes.TXWorker'>
2023-01-04 11:16:46,534 aprscot - Running <class 'aprscot.classes.APRSWorker'>
2023-01-04 11:16:46,534 aprscot - Using APRS-IS server: noam..aprs2.net:14580
2023-01-04 11:16:46,536 aprscot - Run: <class 'pytak.classes.RXWorker'>
2023-01-04 11:16:46,541 aprscot - Complete: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /home/ubuntu/.local/lib/python3.8/site-packages/aprscot/classes.py:73> exception=UnicodeError("encoding with 'idna' codec failed (UnicodeError: label empty or too long)")>
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /home/ubuntu/.local/lib/python3.8/site-packages/aprscot/classes.py:73> exception=UnicodeError("encoding with 'idna' codec failed (UnicodeError: label empty or too long)")>
Traceback (most recent call last):
File "/usr/lib/python3.8/encodings/idna.py", line 163, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/aprscot/classes.py", line 83, in run
reader, writer = await asyncio.open_connection(aprs_host, int(aprs_port))
File "/usr/lib/python3.8/asyncio/streams.py", line 52, in open_connection
transport, _ = await loop.create_connection(
File "/usr/lib/python3.8/asyncio/base_events.py", line 986, in create_connection
infos = await self._ensure_resolved(
File "/usr/lib/python3.8/asyncio/base_events.py", line 1365, in _ensure_resolved
return await loop.getaddrinfo(host, port, family=family, type=type,
File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

with DEBUG =1 aprscot it seams to work properly even pull the packets to the network

More Configuration Ability

Any way we can get some more of the configuration options moved to the ini?
We are missing really basic configuration options like connection methods built into PyTak such as TLS, and the ability to change call signs/ APRIS hosts that tare all hard-coded into the library itself.
It's kind of a deal breaker for the library right now for me.

AttributeError: module 'asyncio' has no attribute 'get_running_loop'

Traceback (most recent call last):
  File "/usr/local/bin/aprscot", line 11, in <module>
    load_entry_point('aprscot', 'console_scripts', 'aprscot')()
  File "/home/admin/src/aprscot/aprscot/commands.py", line 102, in cli
    loop.run_until_complete(main(opts))
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/home/admin/src/aprscot/aprscot/commands.py", line 33, in main
    loop = asyncio.get_running_loop()
AttributeError: module 'asyncio' has no attribute 'get_running_loop'

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.