This tool converts AIS (Automatic Identification System) vessel data to Cursor on Target (CoT) format in real-time. It connects to the AISstream.io service to receive vessel positions and information, converts them to CoT format, and forwards them to a specified destination.
- Real-time AIS data conversion to CoT
- Support for both TCP and UDP forwarding
- Vessel type differentiation with distinct icons:
- US Military vessels
- NATO/Allied military vessels
- Law Enforcement vessels
- Fishing vessels
- Passenger vessels
- Cargo vessels
- Tankers
- High-speed craft
- Other civilian vessels
- Filtering options to include/exclude specific vessel types
- Automatic reconnection on connection loss
- Proper handling of vessel metadata and position information
python >= 3.7
websockets
asyncio
Install requirements using:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Edit the
API_KEYvariable inais_to_cot.pywith your AISstream.io API key - (Optional) Modify the military MMSI prefixes in the
military_prefixesdictionary
- Activate the virtual environment:
source venv/bin/activate # On Windows: venv\Scripts\activate- Run the script:
python ais_to_cot.py- Follow the prompts to enter:
- Destination IP address
- Destination port
- Protocol (TCP/UDP)
- Vessel types to include/exclude
Available vessel type filters:
mil-us: US Military vesselsmil-nato: NATO/Allied military vesselslaw: Law Enforcement vesselsfishing: Fishing vesselspassenger: Passenger vesselscargo: Cargo vesselstanker: Tankershighspeed: High-speed craftother: Other civilian vessels
Example filter combinations:
- Show all vessels: Enter 'all' when prompted for inclusion
- Military only:
mil-us,mil-nato - Commercial only:
cargo,tanker,passenger - Everything except passenger ships: Use 'all' for include and
passengerfor exclude
| Vessel Category | CoT Type | Description |
|---|---|---|
| US Military | a-n-G-U-C-F | US Navy vessels |
| NATO Military | a-n-G-E-V-A | Allied military vessels |
| Law Enforcement | a-f-G-U-L-E | Coast Guard/Police vessels |
| Fishing | a-f-G-E-V-F | Commercial fishing vessels |
| Passenger | a-f-G-E-V-P | Passenger ships/ferries |
| Cargo | a-f-G-E-V-C | Cargo ships |
| Tanker | a-f-G-E-V-T | Tanker vessels |
| High-speed | a-f-G-E-V-H | High-speed craft |
| Other | a-f-G-E-V | Generic civilian vessels |
- Military vessel detection is based on MMSI prefixes and AIS ship type codes
- Some military vessels may not broadcast AIS or may use civilian identifiers
- AIS data quality depends on vessels properly configuring and broadcasting their information
- The script automatically reconnects if the connection to AISstream.io is lost
The script includes error handling for:
- Invalid IP addresses
- Invalid port numbers
- Connection losses
- Invalid AIS messages
- Socket errors