forked from dB-SPL/takprotobuf
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixes #72: Add a config variable for users to set expected CN when using CA verification. Thanks @ahoenerBE - Added configuration parameter: PYTAK_TLS_SERVER_EXPECTED_HOSTNAME - Rewrote GitHub actions, moved most logic to shell script and Makefile. - Renamed Debian package from python3-pytak to pytak. - Standardized Makefile for all PyTAK based programs. - Cleaned, simplified and expanded documentation. - Created Makefile jobs for Debian packaging and PyTAK customization. - Moved all media to media sub directory under docs/. - Converted README.rst to README.md. - Style & Linting of code. - Refactored TLS client creation, abstracted many functions. - Added TLS client cert and key checks and improved error messages.
- Loading branch information
Showing
22 changed files
with
124 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
# Makefile from https://github.com/snstac/pytak | ||
# PyTAK Makefile | ||
# | ||
# Copyright Sensors & Signals LLC https://www.snstac.com | ||
# Copyright Sensors & Signals LLC https://www.snstac.com/ | ||
# | ||
# 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 | ||
# 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. | ||
# | ||
# Author:: Greg Albrecht <[email protected]> | ||
# Copyright:: Copyright Sensors & Signals LLC https://www.snstac.com | ||
# License:: Apache License, Version 2.0 | ||
# | ||
|
||
this_app = takproto | ||
.DEFAULT_GOAL := all | ||
REPO_NAME ?= $(shell echo $(wildcard */classes.py) | awk -F'/' '{print $$1}') | ||
SHELL := /bin/bash | ||
.DEFAULT_GOAL := editable | ||
# postinst = $(wildcard debian/*.postinst.sh) | ||
# service = $(wildcard debian/*.service) | ||
|
||
all: editable | ||
prepare: | ||
mkdir -p build/ | ||
|
||
develop: | ||
python3 setup.py develop | ||
|
@@ -30,13 +30,13 @@ editable: | |
python3 -m pip install -e . | ||
|
||
install_test_requirements: | ||
python3 -m pip install -r requirements_test.txt | ||
python3 -m pip install -r requirements_test.txt | ||
|
||
install: | ||
python3 setup.py install | ||
|
||
uninstall: | ||
python3 -m pip uninstall -y $(this_app) | ||
python3 -m pip uninstall -y $(REPO_NAME) | ||
|
||
reinstall: uninstall install | ||
|
||
|
@@ -47,16 +47,16 @@ clean: | |
@rm -rf *.egg* build dist *.py[oc] */*.py[co] cover doctest_pypi.cfg \ | ||
nosetests.xml pylint.log output.xml flake8.log tests.log \ | ||
test-result.xml htmlcov fab.log .coverage __pycache__ \ | ||
*/__pycache__ .mypy_cache .pytest_cache | ||
*/__pycache__ deb_dist .mypy_cache | ||
|
||
pep8: | ||
flake8 --max-line-length=88 --extend-ignore=E203,E231 --exit-zero $(this_app)/*.py | ||
flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(REPO_NAME)/*.py | ||
|
||
flake8: pep8 | ||
|
||
lint: | ||
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \ | ||
--max-line-length=88 -r n $(this_app)/*.py || exit 0 | ||
--max-line-length=88 -r n $(REPO_NAME)/*.py || exit 0 | ||
|
||
pylint: lint | ||
|
||
|
@@ -72,7 +72,7 @@ pytest: | |
test: editable install_test_requirements pytest | ||
|
||
test_cov: | ||
pytest --cov=$(this_app) --cov-report term-missing | ||
pytest --cov=$(REPO_NAME) --cov-report term-missing | ||
|
||
black: | ||
black . | ||
|
@@ -81,7 +81,23 @@ mkdocs: | |
pip install -r docs/requirements.txt | ||
mkdocs serve | ||
|
||
proto: | ||
for p in src-protobuf/*.proto; do \ | ||
protoc -v -I=src-protobuf --python_out=takprotobuf/proto $$p; \ | ||
done | ||
deb_dist: | ||
python3 setup.py --command-packages=stdeb.command sdist_dsc | ||
|
||
deb_custom: | ||
cp debian/$(REPO_NAME).conf $(wildcard deb_dist/*/debian)/$(REPO_NAME).default | ||
cp debian/$(REPO_NAME).postinst $(wildcard deb_dist/*/debian)/$(REPO_NAME).postinst | ||
cp debian/$(REPO_NAME).service $(wildcard deb_dist/*/debian)/$(REPO_NAME).service | ||
|
||
bdist_deb: deb_dist deb_custom | ||
cd deb_dist/$(REPO_NAME)-*/ && dpkg-buildpackage -rfakeroot -uc -us | ||
|
||
faux_latest: | ||
cp deb_dist/$(REPO_NAME)_*-1_all.deb deb_dist/$(REPO_NAME)_latest_all.deb | ||
cp deb_dist/$(REPO_NAME)_*-1_all.deb deb_dist/python3-$(REPO_NAME)_latest_all.deb | ||
|
||
package: bdist_deb faux_latest | ||
|
||
extract: | ||
dpkg-deb -e $(wildcard deb_dist/*latest_all.deb) deb_dist/extract | ||
dpkg-deb -x $(wildcard deb_dist/*latest_all.deb) deb_dist/extract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
.. image:: https://takproto.readthedocs.io/en/latest/atak_screenshot_with_pytak_logo-x25.jpg | ||
:alt: ATAK Screenshot with PyTAK Logo. | ||
:target: https://github.com/snstac/takproto/blob/main/docs/atak_screenshot_with_pytak_logo.jpg | ||
 | ||
|
||
TAKProto: TAK Protocol Python Module | ||
************************************ | ||
# Send & Receive data from TAK with Python | ||
|
||
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use with `TAK Products <https://tak.gov/>`_ including ATAK, WinTAK, iTAK, TAKX, TAK Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf. | ||
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use | ||
with [TAK Products](https://www.tak.gov/) including ATAK, WinTAK, iTAK, TAKX, TAK | ||
Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol | ||
Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf. | ||
|
||
`Documentation is available here. <https://takproto.rtfd.io/>`_ | ||
[Documentation is available here.](https://takproto.rtfd.io/) | ||
|
||
License | ||
======= | ||
## Copyright & License | ||
Copyright Sensors & Signals LLC https://www.snstac.com | ||
|
||
Copyright 2020 Delta Bravo-15 <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
echo "Installing Debian package build dependencies" | ||
|
||
apt-get update -qq | ||
|
||
apt-get install -y \ | ||
python3 python3-dev python3-pip python3-venv python3-all \ | ||
dh-python debhelper devscripts dput software-properties-common \ | ||
python3-distutils python3-setuptools python3-wheel python3-stdeb |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
|
||
 | ||
|
||
# TAKProto - Send & Receive Team Awareness Kit (TAK) packets with Python. | ||
|
||
TAKProto is a Python module for encoding & decoding TAK Protocol Payloads, for use with [TAK Products](https://tak.gov) including ATAK, WinTAK, iTAK, TAKX, TAK Tracker & TAK Server. TAKProto includes functions for converting TAK Protocol Protobuf messages to Python objects, and serializing CoT XML messages as Protobuf. | ||
|
||
[Documentation is available here.](https://takproto.rtfd.io) | ||
|
||
{!README.md!} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Setup for the Python TAK Protocol Packet - Version 1 Module. | ||
# setup.cfg from https://github.com/snstac/takproto | ||
# | ||
# Copyright Sensors & Signals LLC https://www.snstac.com | ||
# Copyright 2020 Delta Bravo-15 | ||
|
@@ -31,9 +32,9 @@ project_urls = | |
CI: GitHub Actions = https://github.com/snstac/takproto/actions | ||
GitHub: issues = https://github.com/snstac/takproto/issues | ||
GitHub: repo = https://github.com/snstac/takproto | ||
description = A Python module to encode & decode 'TAK Protocol Payload - Version 1' Protocol Buffer based Cursor on Target (CoT) messages. | ||
long_description = file: README.rst | ||
long_description_content_type = text/x-rst | ||
description = TAKProto is a Python package for the TAK protocol. | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
maintainer = Greg Albrecht <[email protected]> | ||
maintainer_email = [email protected] | ||
license = MIT License | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# __init__.py from https://github.com/snstac/takproto | ||
# | ||
# Copyright Sensors & Signals LLC https://www.snstac.com | ||
# | ||
|
@@ -22,17 +23,11 @@ | |
# SOFTWARE. | ||
# | ||
|
||
"""TAKProto: Encode & Decode TAK Protocol Payloads using Python. | ||
"""TAKProto: Encode & Decode TAK Protocol Payloads using Python.""" | ||
|
||
:author: Greg Albrecht <[email protected]> | ||
:copyright: Copyright Sensors & Signals LLC https://www.snstac.com | ||
:license: MIT License | ||
:source: <https://github.com/snstac/takproto> | ||
""" | ||
__version__ = "3.0.0-beta1" | ||
|
||
__version__ = "2.1.1" | ||
|
||
# Python 3.6 test/build work-around: | ||
# COMPAT Python 3.6 import work-around. | ||
try: | ||
from .functions import ( # NOQA | ||
xml2proto, | ||
|
@@ -44,12 +39,5 @@ | |
from .constants import TAKProtoVer # NOQA | ||
except ImportError as exc: | ||
import warnings | ||
warnings.warn( | ||
"Unable to import required modules, IGNORING for Python 3.6 compat. Original Exception: " | ||
) | ||
warnings.warn(str(exc)) | ||
|
||
__author__ = "Greg Albrecht <[email protected]>" | ||
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" | ||
__license__ = "MIT License" | ||
__source__ = "https://github.com/snstac/takproto" | ||
warnings.warn(f"COMPAT Python 3.6. Ignoring Exception: {str(exc)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# constants.py from https://github.com/snstac/takproto | ||
# | ||
# Copyright Sensors & Signals LLC https://www.snstac.com | ||
# | ||
|
@@ -26,11 +27,6 @@ | |
|
||
from enum import Enum | ||
|
||
__author__ = "Greg Albrecht <[email protected]>" | ||
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com" | ||
__license__ = "Apache License, Version 2.0" | ||
|
||
|
||
DEFAULT_PROTO_HEADER = bytearray(b"\xbf") | ||
DEFAULT_MESH_HEADER = bytearray(b"\xbf\x01\xbf") | ||
DEFAULT_XML_HEADER = bytearray(b"<?xml") | ||
|
Oops, something went wrong.