snstac / pytak

PyTAK is a Python package for rapid TAK integration.
https://pytak.readthedocs.io/en/stable/
Apache License 2.0
162 stars 46 forks source link

Add support for authenticated TAK Server connections #20

Open ampledata opened 2 years ago

ampledata commented 2 years ago

Add support for TAK Server connections that require authentication (username & password).

ampledata commented 2 years ago

Haven't figured out the auth method TAK Server uses yet.

ampledata commented 2 years ago

Brian Y.:

When the "Use Authentication" option is enabled I believe TAK Server expects the first packet through that connection from the client to include the user/client credentials. If missing or not authenticated, TS will promptly close the connection. I believe the packet is TAK-custom (not standardized) in this case. IIRC the authorization can be handled a couple different ways by TS e.g. file based user database, LDAP, etc Josh or Joe can correct where this is offbase

https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/commoncommo/core/impl/streamingsocketmanagement.cpp#L1752

ampledata commented 1 year ago

This is what the initial payload from an ATAK EUD looks like when connecting to a TAK Server that requires authentication (pasted as-is, no linefeeds added):

<?xml version="1.0"?>
<auth><cot username="test_username" password="test_password" uid="ANDROID-359307100100375"/></auth><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<event version="2.0" uid="ANDROID-359307100100375" type="a-f-G-E-V-C" time="2023-03-21T05:06:38.436Z" start="2023-03-21T05:06:38.436Z" stale="2023-03-21T05:12:53.436Z" how="h-g-i-g-o"><point lat="0.0" lon="0.0" hae="9999999.0" ce="9999999.0" le="9999999.0"/><detail><takv os="28" version="4.8.1.11 (129b362d)[playstore].1677947871-CIV" device="SAMSUNG SM-T547U" platform="ATAK-CIV"/><contact endpoint="*:-1:stcp" callsign="CA-SF-GregA-TabA"/><uid Droid="CA-SF-GregA-TabA"/><__group role="Medic" name="Blue"/><status battery="100"/><track course="207.2594673459405" speed="0.0"/></detail></event>