From 1697395e84e17e73def7d1d6cc7aa80f738c9c14 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Fri, 8 Jan 2021 11:02:57 -0800 Subject: [PATCH 01/50] add null reply for send_email --- aprsd/plugin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index 9408bc3..b7f350b 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -510,6 +510,7 @@ class EmailPlugin(APRSDPluginBase): if not too_soon or ack == 0: LOG.info("Send email '{}'".format(content)) send_result = email.send_email(to_addr, content) + reply = messaging.NULL_MESSAGE if send_result != 0: reply = "-{} failed".format(to_addr) # messaging.send_message(fromcall, "-" + to_addr + " failed") From dbc891f7385f03d4b8871007fd3bd9492128b580 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 15:11:27 -0500 Subject: [PATCH 02/50] Cleaned out old ack_dict This patch removes remnants of ack_dict from the code. The new mechanism is the MsgTrack object queue. --- aprsd/messaging.py | 7 ------- aprsd/threads.py | 1 - 2 files changed, 8 deletions(-) diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 57f9465..34627f3 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -13,11 +13,6 @@ from aprsd import client, threads, utils LOG = logging.getLogger("APRSD") -# message_nubmer:ack combos so we stop sending a message after an -# ack from radio {int:int} -# FIXME -ack_dict = {} - # What to return from a plugin if we have processed the message # and it's ok, but don't send a usage string back NULL_MESSAGE = -1 @@ -240,8 +235,6 @@ class TextMessage(Message): return re.sub("fuck|shit|cunt|piss|cock|bitch", "****", message) def send(self): - global ack_dict - tracker = MsgTrack() tracker.add(self) LOG.debug("Length of MsgTrack is {}".format(len(tracker))) diff --git a/aprsd/threads.py b/aprsd/threads.py index 9de0c0c..e352bf9 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -116,7 +116,6 @@ class APRSDRXThread(APRSDThread): tracker = messaging.MsgTrack() tracker.remove(ack_num) LOG.debug("Length of MsgTrack is {}".format(len(tracker))) - # messaging.ack_dict.update({int(ack_num): 1}) return def process_mic_e_packet(self, packet): From f976a1c32002bd4f0757c5cb1055f1fbc1c7179a Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 17:23:35 -0500 Subject: [PATCH 03/50] Added Makefile for easy dev setup This patch adds a Makefile for helping setup a dev environment as well as running tox tests for those that aren't used to python development. --- Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..15d22b2 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +.PHONY: virtual install build-requirements black isort flake8 + +virtual: .venv/bin/pip # Creates an isolated python 3 environment + +.venv/bin/pip: + virtualenv -p /usr/bin/python3 .venv + +install: + .venv/bin/pip install -Ur requirements.txt + +dev: virtual + .venv/bin/pip install -e . + .venv/bin/pre-commit install + +test: dev + tox -p + +update-requirements: install + .venv/bin/pip freeze > requirements.txt + +.venv/bin/tox: # install tox + .venv/bin/pip install -U tox + +check: .venv/bin/tox # Code format check with isort and black + tox -efmt-check + tox -epep8 + +fix: .venv/bin/tox # fixes code formatting with isort and black + tox -efmt From 9f4cc27a11966b9fe6d9ce3503a7100c44258569 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 19:35:16 -0500 Subject: [PATCH 04/50] Fixed email shortcut lookup This patch fixes the email.get_email_from_shortcut. It ensures that if the lookup isn't found in the shortcut list, it simply returns the original value. This patch also adds a unit test to specifically test this function to always return the correct value. --- aprsd/email.py | 8 +++++--- tests/test_email.py | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 tests/test_email.py diff --git a/aprsd/email.py b/aprsd/email.py index 0e6ffad..85110df 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -112,9 +112,11 @@ def validate_shortcuts(config): LOG.info("Available shortcuts: {}".format(config["shortcuts"])) -def get_email_from_shortcut(shortcut): - if shortcut in CONFIG.get("shortcuts", None): - return CONFIG["shortcuts"].get(shortcut, None) +def get_email_from_shortcut(addr): + if CONFIG.get("shortcuts", False): + return CONFIG["shortcuts"].get(addr, addr) + else: + return addr def validate_email_config(config, disable_validation=False): diff --git a/tests/test_email.py b/tests/test_email.py new file mode 100644 index 0000000..ce9b5ac --- /dev/null +++ b/tests/test_email.py @@ -0,0 +1,25 @@ +import unittest + +from aprsd import email + + +class TestEmail(unittest.TestCase): + def test_get_email_from_shortcut(self): + email.CONFIG = {"shortcuts": {}} + email_address = "something@something.com" + addr = "-{}".format(email_address) + actual = email.get_email_from_shortcut(addr) + self.assertEqual(addr, actual) + + email.CONFIG = {"nothing": "nothing"} + actual = email.get_email_from_shortcut(addr) + self.assertEqual(addr, actual) + + email.CONFIG = {"shortcuts": {"not_used": "empty"}} + actual = email.get_email_from_shortcut(addr) + self.assertEqual(addr, actual) + + email.CONFIG = {"shortcuts": {"-wb": email_address}} + short = "-wb" + actual = email.get_email_from_shortcut(short) + self.assertEqual(email_address, actual) From 4c0150dd975fc6c2303e9eae937abafc6a5f33bc Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 7 Jan 2021 17:00:42 -0500 Subject: [PATCH 05/50] Added more pre-commit hook tests also added pre-commit job for tox. --- .pre-commit-config.yaml | 11 +++++++++++ aprsd/client.py | 1 + aprsd/email.py | 1 + aprsd/fake_aprs.py | 1 + aprsd/fuzzyclock.py | 1 + aprsd/messaging.py | 1 + aprsd/plugin.py | 1 + aprsd/threads.py | 1 + aprsd/utils.py | 1 + dev-requirements.in | 10 +++++----- examples/plugins/example_plugin.py | 1 + setup.py | 1 + tox.ini | 7 ++++++- 13 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f4e04d..2c31010 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,11 +6,22 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files + - id: fix-encoding-pragma + - id: detect-private-key + - id: check-merge-conflict + - id: check-case-conflict + - id: check-docstring-first + - id: check-builtin-literals - repo: https://github.com/psf/black rev: 19.3b0 hooks: - id: black +- repo: https://github.com/pre-commit/mirrors-isort + rev: v5.7.0 + hooks: + - id: isort + - repo: https://gitlab.com/pycqa/flake8 rev: 3.8.1 hooks: diff --git a/aprsd/client.py b/aprsd/client.py index 9f256c7..281c830 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import logging import select import socket diff --git a/aprsd/email.py b/aprsd/email.py index 85110df..f7084bc 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import datetime import email import imaplib diff --git a/aprsd/fake_aprs.py b/aprsd/fake_aprs.py index 3472feb..086a7e4 100644 --- a/aprsd/fake_aprs.py +++ b/aprsd/fake_aprs.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import argparse import logging import socketserver diff --git a/aprsd/fuzzyclock.py b/aprsd/fuzzyclock.py index 19f105b..ba92596 100644 --- a/aprsd/fuzzyclock.py +++ b/aprsd/fuzzyclock.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # @author Sinu John # sinuvian at gmail dot com diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 34627f3..fd6cd4d 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import abc import datetime import logging diff --git a/aprsd/plugin.py b/aprsd/plugin.py index b7f350b..aab9ac3 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # The base plugin class import abc import fnmatch diff --git a/aprsd/threads.py b/aprsd/threads.py index e352bf9..31fca98 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import abc import logging import queue diff --git a/aprsd/utils.py b/aprsd/utils.py index f92c7d9..4257ac9 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Utilities and helper functions.""" import errno diff --git a/dev-requirements.in b/dev-requirements.in index dcd980a..51e6336 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1,9 +1,9 @@ -tox +black +flake8 +isort +mypy pytest pytest-cov -mypy -flake8 pep8-naming -black -isort Sphinx +tox diff --git a/examples/plugins/example_plugin.py b/examples/plugins/example_plugin.py index c4eb1d0..e01281e 100644 --- a/examples/plugins/example_plugin.py +++ b/examples/plugins/example_plugin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import logging from aprsd import plugin diff --git a/setup.py b/setup.py index 90623e2..fda5a1c 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tox.ini b/tox.ini index ba64524..dd53ec5 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ minversion = 2.9.0 skipdist = True skip_missing_interpreters = true -envlist = pep8,py{36,37,38},fmt-check +envlist = pre-commit,pep8,fmt-check,py{36,37,38} # Activate isolated build environment. tox will use a virtual environment # to build a source distribution from the source tree. For build tools and @@ -91,3 +91,8 @@ deps = -r{toxinidir}/dev-requirements.txt commands = mypy aprsd + +[testenv:pre-commit] +skip_install = true +deps = pre-commit +commands = pre-commit run --all-files --show-diff-on-failure From 231c15b1af4bb384644efcfded90d0bc6c0e8ec2 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 15:47:30 -0500 Subject: [PATCH 06/50] Lots of fixes --- .pre-commit-config.yaml | 71 +++++++++++++++++++----------- aprsd/__init__.py | 2 - aprsd/client.py | 15 ++++--- aprsd/email.py | 62 ++++++++++++++------------ aprsd/fake_aprs.py | 5 +-- aprsd/fuzzyclock.py | 1 - aprsd/main.py | 53 ++++++++++++++-------- aprsd/messaging.py | 38 +++++++++------- aprsd/plugin.py | 54 +++++++++++++---------- aprsd/threads.py | 32 +++++++++----- aprsd/utils.py | 22 +++++---- examples/plugins/example_plugin.py | 1 - pyproject.toml | 36 +++++++++++++++ setup.cfg | 11 ++--- setup.py | 1 - tests/test_main.py | 3 +- tests/test_plugin.py | 6 ++- 17 files changed, 258 insertions(+), 155 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c31010..f2074b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,48 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - - id: fix-encoding-pragma - - id: detect-private-key - - id: check-merge-conflict - - id: check-case-conflict - - id: check-docstring-first - - id: check-builtin-literals -- repo: https://github.com/psf/black - rev: 19.3b0 - hooks: - - id: black +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: detect-private-key + - id: check-merge-conflict + - id: check-case-conflict + - id: check-docstring-first + - id: check-builtin-literals + - id: double-quote-string-fixer -- repo: https://github.com/pre-commit/mirrors-isort - rev: v5.7.0 - hooks: - - id: isort +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v1.16.0 + hooks: + - id: setup-cfg-fmt -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.1 - hooks: - - id: flake8 - additional_dependencies: [flake8-bugbear] +- repo: https://github.com/asottile/add-trailing-comma + rev: v2.0.2 + hooks: + - id: add-trailing-comma + args: [--py36-plus] + +- repo: https://github.com/asottile/pyupgrade + rev: v2.7.4 + hooks: + - id: pyupgrade + args: + - --py3-plus + +- repo: https://github.com/pre-commit/mirrors-isort + rev: v5.7.0 + hooks: + - id: isort + +- repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 + additional_dependencies: [flake8-bugbear] diff --git a/aprsd/__init__.py b/aprsd/__init__.py index 0863171..221b6c8 100644 --- a/aprsd/__init__.py +++ b/aprsd/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # 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 diff --git a/aprsd/client.py b/aprsd/client.py index 281c830..0f3fa44 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -1,7 +1,5 @@ -# -*- coding: utf-8 -*- import logging import select -import socket import time import aprslib @@ -9,7 +7,7 @@ import aprslib LOG = logging.getLogger("APRSD") -class Client(object): +class Client: """Singleton client class that constructs the aprslib connection.""" _instance = None @@ -19,7 +17,7 @@ class Client(object): def __new__(cls, *args, **kwargs): """This magic turns this into a singleton.""" if cls._instance is None: - cls._instance = super(Client, cls).__new__(cls) + cls._instance = super().__new__(cls) # Put any initialization here. return cls._instance @@ -82,7 +80,7 @@ class Aprsdis(aprslib.IS): """ try: self.sock.setblocking(0) - except socket.error as e: + except OSError as e: self.logger.error("socket error when setblocking(0): %s" % str(e)) raise aprslib.ConnectionDrop("connection dropped") @@ -93,7 +91,10 @@ class Aprsdis(aprslib.IS): # set a select timeout, so we get a chance to exit # when user hits CTRL-C readable, writable, exceptional = select.select( - [self.sock], [], [], self.select_timeout + [self.sock], + [], + [], + self.select_timeout, ) if not readable: continue @@ -105,7 +106,7 @@ class Aprsdis(aprslib.IS): if not short_buf: self.logger.error("socket.recv(): returned empty") raise aprslib.ConnectionDrop("connection dropped") - except socket.error as e: + except OSError as e: # self.logger.error("socket error on recv(): %s" % str(e)) if "Resource temporarily unavailable" in str(e): if not blocking: diff --git a/aprsd/email.py b/aprsd/email.py index f7084bc..ed562e8 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -1,18 +1,15 @@ -# -*- coding: utf-8 -*- import datetime import email +from email.mime.text import MIMEText import imaplib import logging import re import smtplib import time -from email.mime.text import MIMEText - -import imapclient -import six -from validate_email import validate_email from aprsd import messaging, threads +import imapclient +from validate_email import validate_email LOG = logging.getLogger("APRSD") @@ -30,7 +27,10 @@ def _imap_connect(): try: server = imapclient.IMAPClient( - CONFIG["imap"]["host"], port=imap_port, use_uid=True, ssl=use_ssl + CONFIG["imap"]["host"], + port=imap_port, + use_uid=True, + ssl=use_ssl, ) except Exception: LOG.error("Failed to connect IMAP server") @@ -53,7 +53,7 @@ def _smtp_connect(): use_ssl = CONFIG["smtp"].get("use_ssl", False) msg = "{}{}:{}".format("SSL " if use_ssl else "", host, smtp_port) LOG.debug( - "Connect to SMTP host {} with user '{}'".format(msg, CONFIG["imap"]["login"]) + "Connect to SMTP host {} with user '{}'".format(msg, CONFIG["imap"]["login"]), ) try: @@ -84,7 +84,7 @@ def validate_shortcuts(config): LOG.info( "Validating {} Email shortcuts. This can take up to 10 seconds" - " per shortcut".format(len(shortcuts)) + " per shortcut".format(len(shortcuts)), ) delete_keys = [] for key in shortcuts: @@ -102,8 +102,8 @@ def validate_shortcuts(config): if not is_valid: LOG.error( "'{}' is an invalid email address. Removing shortcut".format( - shortcuts[key] - ) + shortcuts[key], + ), ) delete_keys.append(key) @@ -173,14 +173,18 @@ def parse_email(msgid, data, server): if part.get_content_type() == "text/plain": LOG.debug("Email got text/plain") - text = six.text_type( - part.get_payload(decode=True), str(charset), "ignore" + text = str( + part.get_payload(decode=True), + str(charset), + "ignore", ).encode("utf8", "replace") if part.get_content_type() == "text/html": LOG.debug("Email got text/html") - html = six.text_type( - part.get_payload(decode=True), str(charset), "ignore" + html = str( + part.get_payload(decode=True), + str(charset), + "ignore", ).encode("utf8", "replace") if text is not None: @@ -192,12 +196,15 @@ def parse_email(msgid, data, server): # email.uscc.net sends no charset, blows up unicode function below LOG.debug("Email is not multipart") if msg.get_content_charset() is None: - text = six.text_type( - msg.get_payload(decode=True), "US-ASCII", "ignore" - ).encode("utf8", "replace") + text = str(msg.get_payload(decode=True), "US-ASCII", "ignore").encode( + "utf8", + "replace", + ) else: - text = six.text_type( - msg.get_payload(decode=True), msg.get_content_charset(), "ignore" + text = str( + msg.get_payload(decode=True), + msg.get_content_charset(), + "ignore", ).encode("utf8", "replace") body = text.strip() @@ -266,11 +273,11 @@ def resend_email(count, fromcall): month = date.strftime("%B")[:3] # Nov, Mar, Apr day = date.day year = date.year - today = "%s-%s-%s" % (day, month, year) + today = "{}-{}-{}".format(day, month, year) shortcuts = CONFIG["shortcuts"] # swap key/value - shortcuts_inverted = dict([[v, k] for k, v in shortcuts.items()]) + shortcuts_inverted = {v: k for k, v in shortcuts.items()} try: server = _imap_connect() @@ -310,7 +317,7 @@ def resend_email(count, fromcall): # thinking this is a duplicate message. # The FT1XDR pretty much ignores the aprs message number in this # regard. The FTM400 gets it right. - reply = "No new msg %s:%s:%s" % ( + reply = "No new msg {}:{}:{}".format( str(h).zfill(2), str(m).zfill(2), str(s).zfill(2), @@ -328,7 +335,7 @@ def resend_email(count, fromcall): class APRSDEmailThread(threads.APRSDThread): def __init__(self, msg_queues, config): - super(APRSDEmailThread, self).__init__("EmailThread") + super().__init__("EmailThread") self.msg_queues = msg_queues self.config = config @@ -354,13 +361,13 @@ class APRSDEmailThread(threads.APRSDThread): shortcuts = CONFIG["shortcuts"] # swap key/value - shortcuts_inverted = dict([[v, k] for k, v in shortcuts.items()]) + shortcuts_inverted = {v: k for k, v in shortcuts.items()} date = datetime.datetime.now() month = date.strftime("%B")[:3] # Nov, Mar, Apr day = date.day year = date.year - today = "%s-%s-%s" % (day, month, year) + today = "{}-{}-{}".format(day, month, year) server = None try: @@ -378,7 +385,8 @@ class APRSDEmailThread(threads.APRSDThread): envelope = data[b"ENVELOPE"] # LOG.debug('ID:%d "%s" (%s)' % (msgid, envelope.subject.decode(), envelope.date)) f = re.search( - r"'([[A-a][0-9]_-]+@[[A-a][0-9]_-\.]+)", str(envelope.from_[0]) + r"'([[A-a][0-9]_-]+@[[A-a][0-9]_-\.]+)", + str(envelope.from_[0]), ) if f is not None: from_addr = f.group(1) diff --git a/aprsd/fake_aprs.py b/aprsd/fake_aprs.py index 086a7e4..f6ed353 100644 --- a/aprsd/fake_aprs.py +++ b/aprsd/fake_aprs.py @@ -1,10 +1,9 @@ -# -*- coding: utf-8 -*- import argparse import logging +from logging.handlers import RotatingFileHandler import socketserver import sys import time -from logging.handlers import RotatingFileHandler from aprsd import utils @@ -74,7 +73,7 @@ def main(): ip = CONFIG["aprs"]["host"] port = CONFIG["aprs"]["port"] - LOG.info("Start server listening on %s:%s" % (args.ip, args.port)) + LOG.info("Start server listening on {}:{}".format(args.ip, args.port)) with socketserver.TCPServer((ip, port), MyAPRSTCPHandler) as server: server.serve_forever() diff --git a/aprsd/fuzzyclock.py b/aprsd/fuzzyclock.py index ba92596..19f105b 100644 --- a/aprsd/fuzzyclock.py +++ b/aprsd/fuzzyclock.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # @author Sinu John # sinuvian at gmail dot com diff --git a/aprsd/main.py b/aprsd/main.py index 2e58e5a..51ab8b2 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Listen on amateur radio aprs-is network for messages and respond to them. # You must have an amateur radio callsign to use this software. You must @@ -22,23 +21,22 @@ # python included libs import logging +from logging import NullHandler +from logging.handlers import RotatingFileHandler import os import queue import signal import sys import threading import time -from logging import NullHandler -from logging.handlers import RotatingFileHandler - -import aprslib -import click -import click_completion -import yaml # local imports here import aprsd from aprsd import client, email, messaging, plugin, threads, utils +import aprslib +import click +import click_completion +import yaml # setup the global logger # logging.basicConfig(level=logging.DEBUG) # level=10 @@ -99,7 +97,9 @@ def main(): @main.command() @click.option( - "-i", "--case-insensitive/--no-case-insensitive", help="Case insensitive completion" + "-i", + "--case-insensitive/--no-case-insensitive", + help="Case insensitive completion", ) @click.argument( "shell", @@ -118,10 +118,14 @@ def show(shell, case_insensitive): @main.command() @click.option( - "--append/--overwrite", help="Append the completion code to the file", default=None + "--append/--overwrite", + help="Append the completion code to the file", + default=None, ) @click.option( - "-i", "--case-insensitive/--no-case-insensitive", help="Case insensitive completion" + "-i", + "--case-insensitive/--no-case-insensitive", + help="Case insensitive completion", ) @click.argument( "shell", @@ -137,16 +141,19 @@ def install(append, case_insensitive, shell, path): else {} ) shell, path = click_completion.core.install( - shell=shell, path=path, append=append, extra_env=extra_env + shell=shell, + path=path, + append=append, + extra_env=extra_env, ) - click.echo("%s completion installed in %s" % (shell, path)) + click.echo("{} completion installed in {}".format(shell, path)) def signal_handler(signal, frame): global server_vent LOG.info( - "Ctrl+C, Sending all threads exit! Can take up to 10 seconds to exit all threads" + "Ctrl+C, Sending all threads exit! Can take up to 10 seconds to exit all threads", ) threads.APRSDThreadList().stop_all() server_event.set() @@ -191,7 +198,8 @@ def sample_config(): default="DEBUG", show_default=True, type=click.Choice( - ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"], case_sensitive=False + ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"], + case_sensitive=False, ), show_choices=True, help="The log level to use for aprsd.log", @@ -220,7 +228,13 @@ def sample_config(): @click.argument("tocallsign") @click.argument("command", nargs=-1) def send_message( - loglevel, quiet, config_file, aprs_login, aprs_password, tocallsign, command + loglevel, + quiet, + config_file, + aprs_login, + aprs_password, + tocallsign, + command, ): """Send a message to a callsign via APRS_IS.""" global got_ack, got_response @@ -273,7 +287,9 @@ def send_message( got_response = True # Send the ack back? ack = messaging.AckMessage( - config["aprs"]["login"], fromcall, msg_id=msg_number + config["aprs"]["login"], + fromcall, + msg_id=msg_number, ) ack.send_direct() @@ -312,7 +328,8 @@ def send_message( default="DEBUG", show_default=True, type=click.Choice( - ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"], case_sensitive=False + ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"], + case_sensitive=False, ), show_choices=True, help="The log level to use for aprsd.log", diff --git a/aprsd/messaging.py b/aprsd/messaging.py index fd6cd4d..3f1f36d 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -1,14 +1,13 @@ -# -*- coding: utf-8 -*- import abc import datetime import logging +from multiprocessing import RawValue import os import pathlib import pickle import re import threading import time -from multiprocessing import RawValue from aprsd import client, threads, utils @@ -19,7 +18,7 @@ LOG = logging.getLogger("APRSD") NULL_MESSAGE = -1 -class MsgTrack(object): +class MsgTrack: """Class to keep track of outstanding text messages. This is a thread safe class that keeps track of active @@ -47,7 +46,7 @@ class MsgTrack(object): def __new__(cls, *args, **kwargs): if cls._instance is None: - cls._instance = super(MsgTrack, cls).__new__(cls) + cls._instance = super().__new__(cls) cls._instance.track = {} cls._instance.lock = threading.Lock() return cls._instance @@ -129,7 +128,7 @@ class MsgTrack(object): self.track = {} -class MessageCounter(object): +class MessageCounter: """ Global message id counter class. @@ -147,7 +146,7 @@ class MessageCounter(object): def __new__(cls, *args, **kwargs): """Make this a singleton class.""" if cls._instance is None: - cls._instance = super(MessageCounter, cls).__new__(cls) + cls._instance = super().__new__(cls) cls._instance.val = RawValue("i", 1) cls._instance.lock = threading.Lock() return cls._instance @@ -173,7 +172,7 @@ class MessageCounter(object): return str(self.val.value) -class Message(object, metaclass=abc.ABCMeta): +class Message(metaclass=abc.ABCMeta): """Base Message Class.""" # The message id to send over the air @@ -204,7 +203,7 @@ class TextMessage(Message): message = None def __init__(self, fromcall, tocall, message, msg_id=None, allow_delay=True): - super(TextMessage, self).__init__(fromcall, tocall, msg_id) + super().__init__(fromcall, tocall, msg_id) self.message = message # do we try and save this message for later if we don't get # an ack? Some messages we don't want to do this ever. @@ -213,7 +212,10 @@ class TextMessage(Message): def __repr__(self): """Build raw string to send over the air.""" return "{}>APRS::{}:{}{{{}\n".format( - self.fromcall, self.tocall.ljust(9), self._filter_for_send(), str(self.id) + self.fromcall, + self.tocall.ljust(9), + self._filter_for_send(), + str(self.id), ) def __str__(self): @@ -222,7 +224,11 @@ class TextMessage(Message): now = datetime.datetime.now() delta = now - self.last_send_time return "{}>{} Msg({})({}): '{}'".format( - self.fromcall, self.tocall, self.id, delta, self.message + self.fromcall, + self.tocall, + self.id, + delta, + self.message, ) def _filter_for_send(self): @@ -259,9 +265,7 @@ class SendMessageThread(threads.APRSDThread): def __init__(self, message): self.msg = message name = self.msg.message[:5] - super(SendMessageThread, self).__init__( - "SendMessage-{}-{}".format(self.msg.id, name) - ) + super().__init__("SendMessage-{}-{}".format(self.msg.id, name)) def loop(self): """Loop until a message is acked or it gets delayed. @@ -326,11 +330,13 @@ class AckMessage(Message): """Class for building Acks and sending them.""" def __init__(self, fromcall, tocall, msg_id): - super(AckMessage, self).__init__(fromcall, tocall, msg_id=msg_id) + super().__init__(fromcall, tocall, msg_id=msg_id) def __repr__(self): return "{}>APRS::{}:ack{}\n".format( - self.fromcall, self.tocall.ljust(9), self.id + self.fromcall, + self.tocall.ljust(9), + self.id, ) def __str__(self): @@ -378,7 +384,7 @@ class AckMessage(Message): class SendAckThread(threads.APRSDThread): def __init__(self, ack): self.ack = ack - super(SendAckThread, self).__init__("SendAck-{}".format(self.ack.id)) + super().__init__("SendAck-{}".format(self.ack.id)) def loop(self): """Separate thread to send acks with retries.""" diff --git a/aprsd/plugin.py b/aprsd/plugin.py index aab9ac3..eae9569 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The base plugin class import abc import fnmatch @@ -12,14 +11,12 @@ import shutil import subprocess import time -import pluggy -import requests -import six -from thesmuggler import smuggle - import aprsd from aprsd import email, messaging from aprsd.fuzzyclock import fuzzy +import pluggy +import requests +from thesmuggler import smuggle # setup the global logger LOG = logging.getLogger("APRSD") @@ -39,7 +36,7 @@ CORE_PLUGINS = [ ] -class PluginManager(object): +class PluginManager: # The singleton instance object for this class _instance = None @@ -52,7 +49,7 @@ class PluginManager(object): def __new__(cls, *args, **kwargs): """This magic turns this into a singleton.""" if cls._instance is None: - cls._instance = super(PluginManager, cls).__new__(cls) + cls._instance = super().__new__(cls) # Put any initialization here. return cls._instance @@ -79,7 +76,7 @@ class PluginManager(object): for mem_name, obj in inspect.getmembers(module): if inspect.isclass(obj) and self.is_plugin(obj): self.obj_list.append( - {"name": mem_name, "obj": obj(self.config)} + {"name": mem_name, "obj": obj(self.config)}, ) return self.obj_list @@ -108,14 +105,16 @@ class PluginManager(object): return assert hasattr(module, class_name), "class {} is not in {}".format( - class_name, module_name + class_name, + module_name, ) # click.echo('reading class {} from module {}'.format( # class_name, module_name)) cls = getattr(module, class_name) if super_cls is not None: assert issubclass(cls, super_cls), "class {} should inherit from {}".format( - class_name, super_cls.__name__ + class_name, + super_cls.__name__, ) # click.echo('initialising {} with params {}'.format(class_name, kwargs)) obj = cls(**kwargs) @@ -131,13 +130,17 @@ class PluginManager(object): plugin_obj = None try: plugin_obj = self._create_class( - plugin_name, APRSDPluginBase, config=self.config + plugin_name, + APRSDPluginBase, + config=self.config, ) if plugin_obj: LOG.info( "Registering Command plugin '{}'({}) '{}'".format( - plugin_name, plugin_obj.version, plugin_obj.command_regex - ) + plugin_name, + plugin_obj.version, + plugin_obj.command_regex, + ), ) self._pluggy_pm.register(plugin_obj) except Exception as ex: @@ -173,8 +176,10 @@ class PluginManager(object): if plugin_obj: LOG.info( "Registering Command plugin '{}'({}) '{}'".format( - o["name"], o["obj"].version, o["obj"].command_regex - ) + o["name"], + o["obj"].version, + o["obj"].command_regex, + ), ) self._pluggy_pm.register(o["obj"]) @@ -203,8 +208,7 @@ class APRSDCommandSpec: pass -@six.add_metaclass(abc.ABCMeta) -class APRSDPluginBase(object): +class APRSDPluginBase(metaclass=abc.ABCMeta): def __init__(self, config): """The aprsd config object is stored.""" self.config = config @@ -257,7 +261,8 @@ class FortunePlugin(APRSDPluginBase): try: process = subprocess.Popen( - [fortune_path, "-s", "-n 60"], stdout=subprocess.PIPE + [fortune_path, "-s", "-n 60"], + stdout=subprocess.PIPE, ) reply = process.communicate()[0] reply = reply.decode(errors="ignore").rstrip() @@ -406,7 +411,10 @@ class TimePlugin(APRSDPluginBase): m = stm.tm_min cur_time = fuzzy(h, m, 1) reply = "{} ({}:{} PDT) ({})".format( - cur_time, str(h), str(m).rjust(2, "0"), message.rstrip() + cur_time, + str(h), + str(m).rjust(2, "0"), + message.rstrip(), ) return reply @@ -497,7 +505,7 @@ class EmailPlugin(APRSDPluginBase): # send recipient link to aprs.fi map if content == "mapme": content = "Click for my location: http://aprs.fi/{}".format( - self.config["ham"]["callsign"] + self.config["ham"]["callsign"], ) too_soon = 0 now = time.time() @@ -521,7 +529,7 @@ class EmailPlugin(APRSDPluginBase): LOG.debug( "DEBUG: email_sent_dict is big (" + str(len(self.email_sent_dict)) - + ") clearing out." + + ") clearing out.", ) self.email_sent_dict.clear() self.email_sent_dict[ack] = now @@ -529,7 +537,7 @@ class EmailPlugin(APRSDPluginBase): LOG.info( "Email for message number " + ack - + " recently sent, not sending again." + + " recently sent, not sending again.", ) else: reply = "Bad email address" diff --git a/aprsd/threads.py b/aprsd/threads.py index 31fca98..4c61779 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -1,13 +1,11 @@ -# -*- coding: utf-8 -*- import abc import logging import queue import threading import time -import aprslib - from aprsd import client, messaging, plugin +import aprslib LOG = logging.getLogger("APRSD") @@ -16,7 +14,7 @@ TX_THREAD = "TX" EMAIL_THREAD = "Email" -class APRSDThreadList(object): +class APRSDThreadList: """Singleton class that keeps track of application wide threads.""" _instance = None @@ -26,7 +24,7 @@ class APRSDThreadList(object): def __new__(cls, *args, **kwargs): if cls._instance is None: - cls._instance = super(APRSDThreadList, cls).__new__(cls) + cls._instance = super().__new__(cls) cls.lock = threading.Lock() cls.threads_list = [] return cls._instance @@ -48,7 +46,7 @@ class APRSDThreadList(object): class APRSDThread(threading.Thread, metaclass=abc.ABCMeta): def __init__(self, name): - super(APRSDThread, self).__init__(name=name) + super().__init__(name=name) self.thread_stop = False APRSDThreadList().add(self) @@ -67,7 +65,7 @@ class APRSDThread(threading.Thread, metaclass=abc.ABCMeta): class APRSDRXThread(APRSDThread): def __init__(self, msg_queues, config): - super(APRSDRXThread, self).__init__("RX_MSG") + super().__init__("RX_MSG") self.msg_queues = msg_queues self.config = config @@ -112,7 +110,11 @@ class APRSDRXThread(APRSDThread): ack_num = packet.get("msgNo") LOG.info("Got ack for message {}".format(ack_num)) messaging.log_message( - "ACK", packet["raw"], None, ack=ack_num, fromcall=packet["from"] + "ACK", + packet["raw"], + None, + ack=ack_num, + fromcall=packet["from"], ) tracker = messaging.MsgTrack() tracker.remove(ack_num) @@ -153,7 +155,9 @@ class APRSDRXThread(APRSDThread): LOG.debug("Sending '{}'".format(reply)) msg = messaging.TextMessage( - self.config["aprs"]["login"], fromcall, reply + self.config["aprs"]["login"], + fromcall, + reply, ) self.msg_queues["tx"].put(msg) else: @@ -166,7 +170,9 @@ class APRSDRXThread(APRSDThread): reply = "Usage: {}".format(", ".join(names)) msg = messaging.TextMessage( - self.config["aprs"]["login"], fromcall, reply + self.config["aprs"]["login"], + fromcall, + reply, ) self.msg_queues["tx"].put(msg) except Exception as ex: @@ -178,7 +184,9 @@ class APRSDRXThread(APRSDThread): # let any threads do their thing, then ack # send an ack last ack = messaging.AckMessage( - self.config["aprs"]["login"], fromcall, msg_id=msg_id + self.config["aprs"]["login"], + fromcall, + msg_id=msg_id, ) self.msg_queues["tx"].put(ack) LOG.debug("Packet processing complete") @@ -213,7 +221,7 @@ class APRSDRXThread(APRSDThread): class APRSDTXThread(APRSDThread): def __init__(self, msg_queues, config): - super(APRSDTXThread, self).__init__("TX_MSG") + super().__init__("TX_MSG") self.msg_queues = msg_queues self.config = config diff --git a/aprsd/utils.py b/aprsd/utils.py index 4257ac9..d8bf573 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -1,17 +1,15 @@ -# -*- coding: utf-8 -*- """Utilities and helper functions.""" import errno import functools import os +from pathlib import Path import sys import threading -from pathlib import Path - -import click -import yaml from aprsd import plugin +import click +import yaml # an example of what should be in the ~/.aprsd/config.yml DEFAULT_CONFIG_DICT = { @@ -103,13 +101,13 @@ def get_config(config_file): """This tries to read the yaml config from .""" config_file_expanded = os.path.expanduser(config_file) if os.path.exists(config_file_expanded): - with open(config_file_expanded, "r") as stream: + with open(config_file_expanded) as stream: config = yaml.load(stream, Loader=yaml.FullLoader) return config else: if config_file == DEFAULT_CONFIG_FILE: click.echo( - "{} is missing, creating config file".format(config_file_expanded) + "{} is missing, creating config file".format(config_file_expanded), ) create_default_config() msg = ( @@ -144,7 +142,10 @@ def parse_config(config_file): if name and name not in config[section]: if not default: fail( - "'%s' was not in '%s' section of config file" % (name, section) + "'{}' was not in '{}' section of config file".format( + name, + section, + ), ) else: config[section][name] = default @@ -166,7 +167,10 @@ def parse_config(config_file): # special check here to make sure user has edited the config file # and changed the ham callsign check_option( - config, "ham", "callsign", default_fail=DEFAULT_CONFIG_DICT["ham"]["callsign"] + config, + "ham", + "callsign", + default_fail=DEFAULT_CONFIG_DICT["ham"]["callsign"], ) check_option(config, "aprs", "login") check_option(config, "aprs", "password") diff --git a/examples/plugins/example_plugin.py b/examples/plugins/example_plugin.py index e01281e..c4eb1d0 100644 --- a/examples/plugins/example_plugin.py +++ b/examples/plugins/example_plugin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging from aprsd import plugin diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..09592fb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,36 @@ +[build-system] +requires = ["setuptools>=46.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.black] +# Use the more relaxed max line length permitted in PEP8. +line-length = 88 +target-version = ["py36", "py37", "py38"] +# black will automatically exclude all files listed in .gitignore +include = '\.pyi?$' +exclude = ''' +/( + \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist +)/ +''' + +[tool.isort] +profile = "black" +line_length = 88 +force_sort_within_sections = true +# Inform isort of paths to import names that should be considered part of the "First Party" group. +src_paths = ["src/openstack_loadtest"] +skip_gitignore = true +# If you need to skip/exclude folders, consider using skip_glob as that will allow the +# isort defaults for skip to remain without the need to duplicate them. + +[tool.coverage.run] +branch = true diff --git a/setup.cfg b/setup.cfg index ac24c17..125cd1f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,15 +1,16 @@ [metadata] name = aprsd -summary = Amateur radio APRS daemon which listens for messages and responds -description-file = - README.rst -long-description-content-type = text/x-rst; charset=UTF-8 +long_description = file: README.rst +long_description_content_type = text/x-rst author = Craig Lamparter -author-email = something@somewhere.com +author_email = something@somewhere.com classifier = Topic :: Communications :: Ham Radio Operating System :: POSIX :: Linux Programming Language :: Python +description_file = + README.rst +summary = Amateur radio APRS daemon which listens for messages and responds [global] setup-hooks = diff --git a/setup.py b/setup.py index fda5a1c..90623e2 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tests/test_main.py b/tests/test_main.py index 1aecc1c..7996fcd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import sys import unittest @@ -7,7 +6,7 @@ from aprsd import email if sys.version_info >= (3, 2): from unittest import mock else: - import mock + from unittest import mock class TestMain(unittest.TestCase): diff --git a/tests/test_plugin.py b/tests/test_plugin.py index c2f860d..8512f34 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import unittest from unittest import mock @@ -57,7 +56,10 @@ class TestPlugin(unittest.TestCase): message = "time" expected = "{} ({}:{} PDT) ({})".format( - cur_time, str(h), str(m).rjust(2, "0"), message.rstrip() + cur_time, + str(h), + str(m).rjust(2, "0"), + message.rstrip(), ) actual = time_plugin.run(fromcall, message, ack) self.assertEqual(expected, actual) From a7c20430fe0611af7c757900adccd98c26cb4c94 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 16:18:48 -0500 Subject: [PATCH 07/50] removed double-quote-string-fixer --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2074b5..42761b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: - id: check-case-conflict - id: check-docstring-first - id: check-builtin-literals - - id: double-quote-string-fixer - repo: https://github.com/asottile/setup-cfg-fmt rev: v1.16.0 From c51a9452d94fc9a4879eb698eaf648a81bbd0d5f Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 20:56:39 -0500 Subject: [PATCH 08/50] Updated Makefile This patch updates the Makefile to only run deps if certain files don't exist already. Also added the build and upload tasks to make it easier to test, build and upload a release to pypi --- Makefile | 45 +++++++-- dev-requirements.in | 1 + dev-requirements.txt | 212 ++++++++++++++++++++++++++++++++----------- requirements.txt | 4 +- 4 files changed, 200 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 15d22b2..e6cb2aa 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,54 @@ -.PHONY: virtual install build-requirements black isort flake8 +.PHONY: virtual dev build-requirements black isort flake8 + +all: pip dev virtual: .venv/bin/pip # Creates an isolated python 3 environment .venv/bin/pip: virtualenv -p /usr/bin/python3 .venv -install: +.venv/bin/aprsd: virtual + test -s .venv/bin/aprsd || .venv/bin/pip install -q -e . + +install: .venv/bin/aprsd .venv/bin/pip install -Ur requirements.txt -dev: virtual - .venv/bin/pip install -e . - .venv/bin/pre-commit install +dev-pre-commit: + test -s .git/hooks/pre-commit || .venv/bin/pre-commit install + +dev-requirements: + test -s .venv/bin/twine || .venv/bin/pip install -q -r dev-requirements.txt + +pip: virtual + .venv/bin/pip install -q -U pip + +dev: pip .venv/bin/aprsd dev-requirements dev-pre-commit + +pip-tools: + test -s .venv/bin/pip-compile || .venv/bin/pip install pip-tools + +clean: + rm -rf dist/* + rm -rf .venv test: dev + .venv/bin/pre-commit run --all-files tox -p -update-requirements: install - .venv/bin/pip freeze > requirements.txt +build: test + rm -rf dist/* + .venv/bin/python3 setup.py sdist bdist_wheel + .venv/bin/twine check dist/* + +upload: build + .venv/bin/twine upload dist/* + +update-requirements: dev pip-tools + .venv/bin/pip-compile -q -U requirements.in + .venv/bin/pip-compile -q -U dev-requirements.in .venv/bin/tox: # install tox - .venv/bin/pip install -U tox + test -s .venv/bin/tox || .venv/bin/pip install -q -U tox check: .venv/bin/tox # Code format check with isort and black tox -efmt-check diff --git a/dev-requirements.in b/dev-requirements.in index 51e6336..61d89bb 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -7,3 +7,4 @@ pytest-cov pep8-naming Sphinx tox +twine diff --git a/dev-requirements.txt b/dev-requirements.txt index 087a674..57100ae 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,58 +4,166 @@ # # pip-compile dev-requirements.in # -alabaster==0.7.12 # via sphinx -appdirs==1.4.4 # via black, virtualenv -attrs==20.3.0 # via pytest -babel==2.9.0 # via sphinx -black==20.8b1 # via -r dev-requirements.in -certifi==2020.12.5 # via requests -chardet==4.0.0 # via requests -click==7.1.2 # via black -coverage==5.3 # via pytest-cov -distlib==0.3.1 # via virtualenv -docutils==0.16 # via sphinx -filelock==3.0.12 # via tox, virtualenv -flake8-polyfill==1.0.2 # via pep8-naming -flake8==3.8.4 # via -r dev-requirements.in, flake8-polyfill -idna==2.10 # via requests -imagesize==1.2.0 # via sphinx -iniconfig==1.1.1 # via pytest -isort==5.6.4 # via -r dev-requirements.in -jinja2==2.11.2 # via sphinx -markupsafe==1.1.1 # via jinja2 -mccabe==0.6.1 # via flake8 -mypy-extensions==0.4.3 # via black, mypy -mypy==0.790 # via -r dev-requirements.in -packaging==20.8 # via pytest, sphinx, tox -pathspec==0.8.1 # via black -pep8-naming==0.11.1 # via -r dev-requirements.in -pluggy==0.13.1 # via pytest, tox -py==1.10.0 # via pytest, tox -pycodestyle==2.6.0 # via flake8 -pyflakes==2.2.0 # via flake8 -pygments==2.7.3 # via sphinx -pyparsing==2.4.7 # via packaging -pytest-cov==2.10.1 # via -r dev-requirements.in -pytest==6.2.1 # via -r dev-requirements.in, pytest-cov -pytz==2020.4 # via babel -regex==2020.11.13 # via black -requests==2.25.1 # via sphinx -six==1.15.0 # via tox, virtualenv -snowballstemmer==2.0.0 # via sphinx -sphinx==3.3.1 # via -r dev-requirements.in -sphinxcontrib-applehelp==1.0.2 # via sphinx -sphinxcontrib-devhelp==1.0.2 # via sphinx -sphinxcontrib-htmlhelp==1.0.3 # via sphinx -sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 # via sphinx -sphinxcontrib-serializinghtml==1.1.4 # via sphinx -toml==0.10.2 # via black, pytest, tox -tox==3.20.1 # via -r dev-requirements.in -typed-ast==1.4.1 # via black, mypy -typing-extensions==3.7.4.3 # via black, mypy -urllib3==1.26.2 # via requests -virtualenv==20.2.2 # via tox +alabaster==0.7.12 + # via sphinx +appdirs==1.4.4 + # via + # black + # virtualenv +attrs==20.3.0 + # via pytest +babel==2.9.0 + # via sphinx +black==20.8b1 + # via -r dev-requirements.in +bleach==3.2.1 + # via readme-renderer +certifi==2020.12.5 + # via requests +chardet==4.0.0 + # via requests +click==7.1.2 + # via black +colorama==0.4.4 + # via twine +coverage==5.3.1 + # via pytest-cov +distlib==0.3.1 + # via virtualenv +docutils==0.16 + # via + # readme-renderer + # sphinx +filelock==3.0.12 + # via + # tox + # virtualenv +flake8-polyfill==1.0.2 + # via pep8-naming +flake8==3.8.4 + # via + # -r dev-requirements.in + # flake8-polyfill +idna==2.10 + # via requests +imagesize==1.2.0 + # via sphinx +iniconfig==1.1.1 + # via pytest +isort==5.7.0 + # via -r dev-requirements.in +jinja2==2.11.2 + # via sphinx +keyring==21.8.0 + # via twine +markupsafe==1.1.1 + # via jinja2 +mccabe==0.6.1 + # via flake8 +mypy-extensions==0.4.3 + # via + # black + # mypy +mypy==0.790 + # via -r dev-requirements.in +packaging==20.8 + # via + # bleach + # pytest + # sphinx + # tox +pathspec==0.8.1 + # via black +pep8-naming==0.11.1 + # via -r dev-requirements.in +pkginfo==1.6.1 + # via twine +pluggy==0.13.1 + # via + # pytest + # tox +py==1.10.0 + # via + # pytest + # tox +pycodestyle==2.6.0 + # via flake8 +pyflakes==2.2.0 + # via flake8 +pygments==2.7.3 + # via + # readme-renderer + # sphinx +pyparsing==2.4.7 + # via packaging +pytest-cov==2.10.1 + # via -r dev-requirements.in +pytest==6.2.1 + # via + # -r dev-requirements.in + # pytest-cov +pytz==2020.5 + # via babel +readme-renderer==28.0 + # via twine +regex==2020.11.13 + # via black +requests-toolbelt==0.9.1 + # via twine +requests==2.25.1 + # via + # requests-toolbelt + # sphinx + # twine +rfc3986==1.4.0 + # via twine +six==1.15.0 + # via + # bleach + # readme-renderer + # tox + # virtualenv +snowballstemmer==2.0.0 + # via sphinx +sphinx==3.4.3 + # via -r dev-requirements.in +sphinxcontrib-applehelp==1.0.2 + # via sphinx +sphinxcontrib-devhelp==1.0.2 + # via sphinx +sphinxcontrib-htmlhelp==1.0.3 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.3 + # via sphinx +sphinxcontrib-serializinghtml==1.1.4 + # via sphinx +toml==0.10.2 + # via + # black + # pytest + # tox +tox==3.21.0 + # via -r dev-requirements.in +tqdm==4.55.1 + # via twine +twine==3.3.0 + # via -r dev-requirements.in +typed-ast==1.4.2 + # via + # black + # mypy +typing-extensions==3.7.4.3 + # via + # black + # mypy +urllib3==1.26.2 + # via requests +virtualenv==20.2.2 + # via tox +webencodings==0.5.1 + # via bleach # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements.txt b/requirements.txt index 8fbbf88..ed86b36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile # To update, run: # -# pip-compile +# pip-compile requirements.in # appdirs==1.4.4 # via virtualenv @@ -22,7 +22,7 @@ click==7.1.2 # click-completion distlib==0.3.1 # via virtualenv -dnspython==2.0.0 +dnspython==2.1.0 # via py3-validate-email filelock==3.0.12 # via From d5a34b4d11dd8350b6b27d1a70b349544f929160 Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 09:58:56 -0500 Subject: [PATCH 09/50] refactor Plugin objects to plugins directory This patch moves all of the plugins out of plugin.py into their own separate plugins/.py file. This makes it easier to maintain each plugin. NOTE: You will have to update your ~/.config/aprsd/aprsd.yml to change the python location path for each plugin enabled. For example: OLD: enabled_plugins: - aprsd.plugin.EmailPlugin TO NEW enabled_plugins: - aprsd.plugins.email.EmailPlugin --- Makefile | 2 +- aprsd/plugin.py | 431 +++++--------------------------------- aprsd/plugins/__init__.py | 0 aprsd/plugins/email.py | 88 ++++++++ aprsd/plugins/fortune.py | 37 ++++ aprsd/plugins/location.py | 77 +++++++ aprsd/plugins/ping.py | 25 +++ aprsd/plugins/query.py | 43 ++++ aprsd/plugins/time.py | 28 +++ aprsd/plugins/version.py | 22 ++ aprsd/plugins/weather.py | 53 +++++ tests/test_plugin.py | 29 +-- 12 files changed, 442 insertions(+), 393 deletions(-) create mode 100644 aprsd/plugins/__init__.py create mode 100644 aprsd/plugins/email.py create mode 100644 aprsd/plugins/fortune.py create mode 100644 aprsd/plugins/location.py create mode 100644 aprsd/plugins/ping.py create mode 100644 aprsd/plugins/query.py create mode 100644 aprsd/plugins/time.py create mode 100644 aprsd/plugins/version.py create mode 100644 aprsd/plugins/weather.py diff --git a/Makefile b/Makefile index 5340686..e6cb2aa 100644 --- a/Makefile +++ b/Makefile @@ -55,4 +55,4 @@ check: .venv/bin/tox # Code format check with isort and black tox -epep8 fix: .venv/bin/tox # fixes code formatting with isort and black - tox -efmt \ No newline at end of file + tox -efmt diff --git a/aprsd/plugin.py b/aprsd/plugin.py index eae9569..224b475 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -3,19 +3,11 @@ import abc import fnmatch import importlib import inspect -import json import logging import os import re -import shutil -import subprocess -import time -import aprsd -from aprsd import email, messaging -from aprsd.fuzzyclock import fuzzy import pluggy -import requests from thesmuggler import smuggle # setup the global logger @@ -25,17 +17,61 @@ hookspec = pluggy.HookspecMarker("aprsd") hookimpl = pluggy.HookimplMarker("aprsd") CORE_PLUGINS = [ - "aprsd.plugin.EmailPlugin", - "aprsd.plugin.FortunePlugin", - "aprsd.plugin.LocationPlugin", - "aprsd.plugin.PingPlugin", - "aprsd.plugin.QueryPlugin", - "aprsd.plugin.TimePlugin", - "aprsd.plugin.WeatherPlugin", - "aprsd.plugin.VersionPlugin", + "aprsd.plugins.email.EmailPlugin", + "aprsd.plugins.fortune.FortunePlugin", + "aprsd.plugins.location.LocationPlugin", + "aprsd.plugins.ping.PingPlugin", + "aprsd.plugins.query.QueryPlugin", + "aprsd.plugins.time.TimePlugin", + "aprsd.plugins.weather.WeatherPlugin", + "aprsd.plugins.version.VersionPlugin", ] +class APRSDCommandSpec: + """A hook specification namespace.""" + + @hookspec + def run(self, fromcall, message, ack): + """My special little hook that you can customize.""" + pass + + +class APRSDPluginBase(metaclass=abc.ABCMeta): + def __init__(self, config): + """The aprsd config object is stored.""" + self.config = config + + @property + def command_name(self): + """The usage string help.""" + raise NotImplementedError + + @property + def command_regex(self): + """The regex to match from the caller""" + raise NotImplementedError + + @property + def version(self): + """Version""" + raise NotImplementedError + + @hookimpl + def run(self, fromcall, message, ack): + if re.search(self.command_regex, message): + return self.command(fromcall, message, ack) + + @abc.abstractmethod + def command(self, fromcall, message, ack): + """This is the command that runs when the regex matches. + + To reply with a message over the air, return a string + to send. + """ + pass + + class PluginManager: # The singleton instance object for this class _instance = None @@ -197,366 +233,3 @@ class PluginManager: def get_plugins(self): return self._pluggy_pm.get_plugins() - - -class APRSDCommandSpec: - """A hook specification namespace.""" - - @hookspec - def run(self, fromcall, message, ack): - """My special little hook that you can customize.""" - pass - - -class APRSDPluginBase(metaclass=abc.ABCMeta): - def __init__(self, config): - """The aprsd config object is stored.""" - self.config = config - - @property - def command_name(self): - """The usage string help.""" - raise NotImplementedError - - @property - def command_regex(self): - """The regex to match from the caller""" - raise NotImplementedError - - @property - def version(self): - """Version""" - raise NotImplementedError - - @hookimpl - def run(self, fromcall, message, ack): - if re.search(self.command_regex, message): - return self.command(fromcall, message, ack) - - @abc.abstractmethod - def command(self, fromcall, message, ack): - """This is the command that runs when the regex matches. - - To reply with a message over the air, return a string - to send. - """ - pass - - -class FortunePlugin(APRSDPluginBase): - """Fortune.""" - - version = "1.0" - command_regex = "^[fF]" - command_name = "fortune" - - def command(self, fromcall, message, ack): - LOG.info("FortunePlugin") - reply = None - - fortune_path = shutil.which("fortune") - if not fortune_path: - reply = "Fortune command not installed" - return reply - - try: - process = subprocess.Popen( - [fortune_path, "-s", "-n 60"], - stdout=subprocess.PIPE, - ) - reply = process.communicate()[0] - reply = reply.decode(errors="ignore").rstrip() - except Exception as ex: - reply = "Fortune command failed '{}'".format(ex) - LOG.error(reply) - - return reply - - -class LocationPlugin(APRSDPluginBase): - """Location!""" - - version = "1.0" - command_regex = "^[lL]" - command_name = "location" - - config_items = {"apikey": "aprs.fi api key here"} - - def command(self, fromcall, message, ack): - LOG.info("Location Plugin") - # get last location of a callsign, get descriptive name from weather service - try: - # optional second argument is a callsign to search - a = re.search(r"^.*\s+(.*)", message) - if a is not None: - searchcall = a.group(1) - searchcall = searchcall.upper() - else: - # if no second argument, search for calling station - searchcall = fromcall - url = ( - "http://api.aprs.fi/api/get?name=" - + searchcall - + "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" - ) - response = requests.get(url) - # aprs_data = json.loads(response.read()) - aprs_data = json.loads(response.text) - LOG.debug("LocationPlugin: aprs_data = {}".format(aprs_data)) - lat = aprs_data["entries"][0]["lat"] - lon = aprs_data["entries"][0]["lng"] - try: # altitude not always provided - alt = aprs_data["entries"][0]["altitude"] - except Exception: - alt = 0 - altfeet = int(alt * 3.28084) - aprs_lasttime_seconds = aprs_data["entries"][0]["lasttime"] - # aprs_lasttime_seconds = aprs_lasttime_seconds.encode( - # "ascii", errors="ignore" - # ) # unicode to ascii - delta_seconds = time.time() - int(aprs_lasttime_seconds) - delta_hours = delta_seconds / 60 / 60 - url2 = ( - "https://forecast.weather.gov/MapClick.php?lat=" - + str(lat) - + "&lon=" - + str(lon) - + "&FcstType=json" - ) - response2 = requests.get(url2) - wx_data = json.loads(response2.text) - - reply = "{}: {} {}' {},{} {}h ago".format( - searchcall, - wx_data["location"]["areaDescription"], - str(altfeet), - str(alt), - str(lon), - str("%.1f" % round(delta_hours, 1)), - ).rstrip() - except Exception as e: - LOG.debug("Locate failed with: " + "%s" % str(e)) - reply = "Unable to find station " + searchcall + ". Sending beacons?" - - return reply - - -class PingPlugin(APRSDPluginBase): - """Ping.""" - - version = "1.0" - command_regex = "^[pP]" - command_name = "ping" - - def command(self, fromcall, message, ack): - LOG.info("PINGPlugin") - stm = time.localtime() - h = stm.tm_hour - m = stm.tm_min - s = stm.tm_sec - reply = ( - "Pong! " + str(h).zfill(2) + ":" + str(m).zfill(2) + ":" + str(s).zfill(2) - ) - return reply.rstrip() - - -class QueryPlugin(APRSDPluginBase): - """Query command.""" - - version = "1.0" - command_regex = r"^\?.*" - command_name = "query" - - def command(self, fromcall, message, ack): - LOG.info("Query COMMAND") - - tracker = messaging.MsgTrack() - reply = "Pending Messages ({})".format(len(tracker)) - - searchstring = "^" + self.config["ham"]["callsign"] + ".*" - # only I can do admin commands - if re.search(searchstring, fromcall): - r = re.search(r"^\?-\*", message) - if r is not None: - if len(tracker) > 0: - reply = "Resend ALL Delayed msgs" - LOG.debug(reply) - tracker.restart_delayed() - else: - reply = "No Delayed Msgs" - LOG.debug(reply) - return reply - - r = re.search(r"^\?-[fF]!", message) - if r is not None: - reply = "Deleting ALL Delayed msgs." - LOG.debug(reply) - tracker.flush() - return reply - - return reply - - -class TimePlugin(APRSDPluginBase): - """Time command.""" - - version = "1.0" - command_regex = "^[tT]" - command_name = "time" - - def command(self, fromcall, message, ack): - LOG.info("TIME COMMAND") - stm = time.localtime() - h = stm.tm_hour - m = stm.tm_min - cur_time = fuzzy(h, m, 1) - reply = "{} ({}:{} PDT) ({})".format( - cur_time, - str(h), - str(m).rjust(2, "0"), - message.rstrip(), - ) - return reply - - -class WeatherPlugin(APRSDPluginBase): - """Weather Command""" - - version = "1.0" - command_regex = "^[wW]" - command_name = "weather" - - def command(self, fromcall, message, ack): - LOG.info("Weather Plugin") - try: - url = ( - "http://api.aprs.fi/api/get?" - "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" - "&name=%s" % fromcall - ) - response = requests.get(url) - # aprs_data = json.loads(response.read()) - aprs_data = json.loads(response.text) - lat = aprs_data["entries"][0]["lat"] - lon = aprs_data["entries"][0]["lng"] - url2 = ( - "https://forecast.weather.gov/MapClick.php?lat=%s" - "&lon=%s&FcstType=json" % (lat, lon) - ) - response2 = requests.get(url2) - # wx_data = json.loads(response2.read()) - wx_data = json.loads(response2.text) - reply = ( - "%sF(%sF/%sF) %s. %s, %s." - % ( - wx_data["currentobservation"]["Temp"], - wx_data["data"]["temperature"][0], - wx_data["data"]["temperature"][1], - wx_data["data"]["weather"][0], - wx_data["time"]["startPeriodName"][1], - wx_data["data"]["weather"][1], - ) - ).rstrip() - LOG.debug("reply: '{}' ".format(reply)) - except Exception as e: - LOG.debug("Weather failed with: " + "%s" % str(e)) - reply = "Unable to find you (send beacon?)" - - return reply - - -class EmailPlugin(APRSDPluginBase): - """Email Plugin.""" - - version = "1.0" - command_regex = "^-.*" - command_name = "email" - - # message_number:time combos so we don't resend the same email in - # five mins {int:int} - email_sent_dict = {} - - def command(self, fromcall, message, ack): - LOG.info("Email COMMAND") - reply = None - - searchstring = "^" + self.config["ham"]["callsign"] + ".*" - # only I can do email - if re.search(searchstring, fromcall): - # digits only, first one is number of emails to resend - r = re.search("^-([0-9])[0-9]*$", message) - if r is not None: - LOG.debug("RESEND EMAIL") - email.resend_email(r.group(1), fromcall) - reply = messaging.NULL_MESSAGE - # -user@address.com body of email - elif re.search(r"^-([A-Za-z0-9_\-\.@]+) (.*)", message): - # (same search again) - a = re.search(r"^-([A-Za-z0-9_\-\.@]+) (.*)", message) - if a is not None: - to_addr = a.group(1) - content = a.group(2) - - email_address = email.get_email_from_shortcut(to_addr) - if not email_address: - reply = "Bad email address" - return reply - - # send recipient link to aprs.fi map - if content == "mapme": - content = "Click for my location: http://aprs.fi/{}".format( - self.config["ham"]["callsign"], - ) - too_soon = 0 - now = time.time() - # see if we sent this msg number recently - if ack in self.email_sent_dict: - # BUG(hemna) - when we get a 2 different email command - # with the same ack #, we don't send it. - timedelta = now - self.email_sent_dict[ack] - if timedelta < 300: # five minutes - too_soon = 1 - if not too_soon or ack == 0: - LOG.info("Send email '{}'".format(content)) - send_result = email.send_email(to_addr, content) - reply = messaging.NULL_MESSAGE - if send_result != 0: - reply = "-{} failed".format(to_addr) - # messaging.send_message(fromcall, "-" + to_addr + " failed") - else: - # clear email sent dictionary if somehow goes over 100 - if len(self.email_sent_dict) > 98: - LOG.debug( - "DEBUG: email_sent_dict is big (" - + str(len(self.email_sent_dict)) - + ") clearing out.", - ) - self.email_sent_dict.clear() - self.email_sent_dict[ack] = now - else: - LOG.info( - "Email for message number " - + ack - + " recently sent, not sending again.", - ) - else: - reply = "Bad email address" - # messaging.send_message(fromcall, "Bad email address") - - return reply - - -class VersionPlugin(APRSDPluginBase): - """Version of APRSD Plugin.""" - - version = "1.0" - command_regex = "^[vV]" - command_name = "version" - - # message_number:time combos so we don't resend the same email in - # five mins {int:int} - email_sent_dict = {} - - def command(self, fromcall, message, ack): - LOG.info("Version COMMAND") - return "APRSD version '{}'".format(aprsd.__version__) diff --git a/aprsd/plugins/__init__.py b/aprsd/plugins/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/aprsd/plugins/email.py b/aprsd/plugins/email.py new file mode 100644 index 0000000..1372327 --- /dev/null +++ b/aprsd/plugins/email.py @@ -0,0 +1,88 @@ +import logging +import re +import time + +from aprsd import email, messaging, plugin + +LOG = logging.getLogger("APRSD") + + +class EmailPlugin(plugin.APRSDPluginBase): + """Email Plugin.""" + + version = "1.0" + command_regex = "^-.*" + command_name = "email" + + # message_number:time combos so we don't resend the same email in + # five mins {int:int} + email_sent_dict = {} + + def command(self, fromcall, message, ack): + LOG.info("Email COMMAND") + reply = None + + searchstring = "^" + self.config["ham"]["callsign"] + ".*" + # only I can do email + if re.search(searchstring, fromcall): + # digits only, first one is number of emails to resend + r = re.search("^-([0-9])[0-9]*$", message) + if r is not None: + LOG.debug("RESEND EMAIL") + email.resend_email(r.group(1), fromcall) + reply = messaging.NULL_MESSAGE + # -user@address.com body of email + elif re.search(r"^-([A-Za-z0-9_\-\.@]+) (.*)", message): + # (same search again) + a = re.search(r"^-([A-Za-z0-9_\-\.@]+) (.*)", message) + if a is not None: + to_addr = a.group(1) + content = a.group(2) + + email_address = email.get_email_from_shortcut(to_addr) + if not email_address: + reply = "Bad email address" + return reply + + # send recipient link to aprs.fi map + if content == "mapme": + content = "Click for my location: http://aprs.fi/{}".format( + self.config["ham"]["callsign"], + ) + too_soon = 0 + now = time.time() + # see if we sent this msg number recently + if ack in self.email_sent_dict: + # BUG(hemna) - when we get a 2 different email command + # with the same ack #, we don't send it. + timedelta = now - self.email_sent_dict[ack] + if timedelta < 300: # five minutes + too_soon = 1 + if not too_soon or ack == 0: + LOG.info("Send email '{}'".format(content)) + send_result = email.send_email(to_addr, content) + reply = messaging.NULL_MESSAGE + if send_result != 0: + reply = "-{} failed".format(to_addr) + # messaging.send_message(fromcall, "-" + to_addr + " failed") + else: + # clear email sent dictionary if somehow goes over 100 + if len(self.email_sent_dict) > 98: + LOG.debug( + "DEBUG: email_sent_dict is big (" + + str(len(self.email_sent_dict)) + + ") clearing out.", + ) + self.email_sent_dict.clear() + self.email_sent_dict[ack] = now + else: + LOG.info( + "Email for message number " + + ack + + " recently sent, not sending again.", + ) + else: + reply = "Bad email address" + # messaging.send_message(fromcall, "Bad email address") + + return reply diff --git a/aprsd/plugins/fortune.py b/aprsd/plugins/fortune.py new file mode 100644 index 0000000..52e59e1 --- /dev/null +++ b/aprsd/plugins/fortune.py @@ -0,0 +1,37 @@ +import logging +import shutil +import subprocess + +from aprsd import plugin + +LOG = logging.getLogger("APRSD") + + +class FortunePlugin(plugin.APRSDPluginBase): + """Fortune.""" + + version = "1.0" + command_regex = "^[fF]" + command_name = "fortune" + + def command(self, fromcall, message, ack): + LOG.info("FortunePlugin") + reply = None + + fortune_path = shutil.which("fortune") + if not fortune_path: + reply = "Fortune command not installed" + return reply + + try: + process = subprocess.Popen( + [fortune_path, "-s", "-n 60"], + stdout=subprocess.PIPE, + ) + reply = process.communicate()[0] + reply = reply.decode(errors="ignore").rstrip() + except Exception as ex: + reply = "Fortune command failed '{}'".format(ex) + LOG.error(reply) + + return reply diff --git a/aprsd/plugins/location.py b/aprsd/plugins/location.py new file mode 100644 index 0000000..be75e34 --- /dev/null +++ b/aprsd/plugins/location.py @@ -0,0 +1,77 @@ +import json +import logging +import re +import time + +from aprsd import plugin +import requests + +LOG = logging.getLogger("APRSD") + + +class LocationPlugin(plugin.APRSDPluginBase): + """Location!""" + + version = "1.0" + command_regex = "^[lL]" + command_name = "location" + + config_items = {"apikey": "aprs.fi api key here"} + + def command(self, fromcall, message, ack): + LOG.info("Location Plugin") + # get last location of a callsign, get descriptive name from weather service + try: + # optional second argument is a callsign to search + a = re.search(r"^.*\s+(.*)", message) + if a is not None: + searchcall = a.group(1) + searchcall = searchcall.upper() + else: + # if no second argument, search for calling station + searchcall = fromcall + url = ( + "http://api.aprs.fi/api/get?name=" + + searchcall + + "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" + ) + response = requests.get(url) + # aprs_data = json.loads(response.read()) + aprs_data = json.loads(response.text) + LOG.debug("LocationPlugin: aprs_data = {}".format(aprs_data)) + lat = aprs_data["entries"][0]["lat"] + lon = aprs_data["entries"][0]["lng"] + try: # altitude not always provided + alt = aprs_data["entries"][0]["altitude"] + except Exception: + alt = 0 + altfeet = int(alt * 3.28084) + aprs_lasttime_seconds = aprs_data["entries"][0]["lasttime"] + # aprs_lasttime_seconds = aprs_lasttime_seconds.encode( + # "ascii", errors="ignore" + # ) # unicode to ascii + delta_seconds = time.time() - int(aprs_lasttime_seconds) + delta_hours = delta_seconds / 60 / 60 + url2 = ( + "https://forecast.weather.gov/MapClick.php?lat=" + + str(lat) + + "&lon=" + + str(lon) + + "&FcstType=json" + ) + response2 = requests.get(url2) + wx_data = json.loads(response2.text) + + reply = "{}: {} {}' {},{} {}h ago".format( + searchcall, + wx_data["location"]["areaDescription"], + str(altfeet), + str(alt), + str(lon), + str("%.1f" % round(delta_hours, 1)), + ).rstrip() + except Exception as e: + LOG.debug("Locate failed with: " + "%s" % str(e)) + reply = "Unable to find station " + searchcall + ". Sending beacons?" + + return reply diff --git a/aprsd/plugins/ping.py b/aprsd/plugins/ping.py new file mode 100644 index 0000000..754da05 --- /dev/null +++ b/aprsd/plugins/ping.py @@ -0,0 +1,25 @@ +import logging +import time + +from aprsd import plugin + +LOG = logging.getLogger("APRSD") + + +class PingPlugin(plugin.APRSDPluginBase): + """Ping.""" + + version = "1.0" + command_regex = "^[pP]" + command_name = "ping" + + def command(self, fromcall, message, ack): + LOG.info("PINGPlugin") + stm = time.localtime() + h = stm.tm_hour + m = stm.tm_min + s = stm.tm_sec + reply = ( + "Pong! " + str(h).zfill(2) + ":" + str(m).zfill(2) + ":" + str(s).zfill(2) + ) + return reply.rstrip() diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py new file mode 100644 index 0000000..e5a4bfc --- /dev/null +++ b/aprsd/plugins/query.py @@ -0,0 +1,43 @@ +import logging +import re + +from aprsd import messaging, plugin + +LOG = logging.getLogger("APRSD") + + +class QueryPlugin(plugin.APRSDPluginBase): + """Query command.""" + + version = "1.0" + command_regex = r"^\?.*" + command_name = "query" + + def command(self, fromcall, message, ack): + LOG.info("Query COMMAND") + + tracker = messaging.MsgTrack() + reply = "Pending Messages ({})".format(len(tracker)) + + searchstring = "^" + self.config["ham"]["callsign"] + ".*" + # only I can do admin commands + if re.search(searchstring, fromcall): + r = re.search(r"^\?-\*", message) + if r is not None: + if len(tracker) > 0: + reply = "Resend ALL Delayed msgs" + LOG.debug(reply) + tracker.restart_delayed() + else: + reply = "No Delayed Msgs" + LOG.debug(reply) + return reply + + r = re.search(r"^\?-[fF]!", message) + if r is not None: + reply = "Deleting ALL Delayed msgs." + LOG.debug(reply) + tracker.flush() + return reply + + return reply diff --git a/aprsd/plugins/time.py b/aprsd/plugins/time.py new file mode 100644 index 0000000..3c0c3b9 --- /dev/null +++ b/aprsd/plugins/time.py @@ -0,0 +1,28 @@ +import logging +import time + +from aprsd import fuzzyclock, plugin + +LOG = logging.getLogger("APRSD") + + +class TimePlugin(plugin.APRSDPluginBase): + """Time command.""" + + version = "1.0" + command_regex = "^[tT]" + command_name = "time" + + def command(self, fromcall, message, ack): + LOG.info("TIME COMMAND") + stm = time.localtime() + h = stm.tm_hour + m = stm.tm_min + cur_time = fuzzyclock.fuzzy(h, m, 1) + reply = "{} ({}:{} PDT) ({})".format( + cur_time, + str(h), + str(m).rjust(2, "0"), + message.rstrip(), + ) + return reply diff --git a/aprsd/plugins/version.py b/aprsd/plugins/version.py new file mode 100644 index 0000000..d037ac7 --- /dev/null +++ b/aprsd/plugins/version.py @@ -0,0 +1,22 @@ +import logging + +import aprsd +from aprsd import plugin + +LOG = logging.getLogger("APRSD") + + +class VersionPlugin(plugin.APRSDPluginBase): + """Version of APRSD Plugin.""" + + version = "1.0" + command_regex = "^[vV]" + command_name = "version" + + # message_number:time combos so we don't resend the same email in + # five mins {int:int} + email_sent_dict = {} + + def command(self, fromcall, message, ack): + LOG.info("Version COMMAND") + return "APRSD version '{}'".format(aprsd.__version__) diff --git a/aprsd/plugins/weather.py b/aprsd/plugins/weather.py new file mode 100644 index 0000000..6071c1e --- /dev/null +++ b/aprsd/plugins/weather.py @@ -0,0 +1,53 @@ +import json +import logging + +from aprsd import plugin +import requests + +LOG = logging.getLogger("APRSD") + + +class WeatherPlugin(plugin.APRSDPluginBase): + """Weather Command""" + + version = "1.0" + command_regex = "^[wW]" + command_name = "weather" + + def command(self, fromcall, message, ack): + LOG.info("Weather Plugin") + try: + url = ( + "http://api.aprs.fi/api/get?" + "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" + "&name=%s" % fromcall + ) + response = requests.get(url) + # aprs_data = json.loads(response.read()) + aprs_data = json.loads(response.text) + lat = aprs_data["entries"][0]["lat"] + lon = aprs_data["entries"][0]["lng"] + url2 = ( + "https://forecast.weather.gov/MapClick.php?lat=%s" + "&lon=%s&FcstType=json" % (lat, lon) + ) + response2 = requests.get(url2) + # wx_data = json.loads(response2.read()) + wx_data = json.loads(response2.text) + reply = ( + "%sF(%sF/%sF) %s. %s, %s." + % ( + wx_data["currentobservation"]["Temp"], + wx_data["data"]["temperature"][0], + wx_data["data"]["temperature"][1], + wx_data["data"]["weather"][0], + wx_data["time"]["startPeriodName"][1], + wx_data["data"]["weather"][1], + ) + ).rstrip() + LOG.debug("reply: '{}' ".format(reply)) + except Exception as e: + LOG.debug("Weather failed with: " + "%s" % str(e)) + reply = "Unable to find you (send beacon?)" + + return reply diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 8512f34..48e3c44 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -2,8 +2,11 @@ import unittest from unittest import mock import aprsd -from aprsd import plugin from aprsd.fuzzyclock import fuzzy +from aprsd.plugins import fortune as fortune_plugin +from aprsd.plugins import ping as ping_plugin +from aprsd.plugins import time as time_plugin +from aprsd.plugins import version as version_plugin class TestPlugin(unittest.TestCase): @@ -14,17 +17,17 @@ class TestPlugin(unittest.TestCase): @mock.patch("shutil.which") def test_fortune_fail(self, mock_which): - fortune_plugin = plugin.FortunePlugin(self.config) + fortune = fortune_plugin.FortunePlugin(self.config) mock_which.return_value = None message = "fortune" expected = "Fortune command not installed" - actual = fortune_plugin.run(self.fromcall, message, self.ack) + actual = fortune.run(self.fromcall, message, self.ack) self.assertEqual(expected, actual) @mock.patch("subprocess.Popen") @mock.patch("shutil.which") def test_fortune_success(self, mock_which, mock_popen): - fortune_plugin = plugin.FortunePlugin(self.config) + fortune = fortune_plugin.FortunePlugin(self.config) mock_which.return_value = "/usr/bin/games" mock_process = mock.MagicMock() @@ -33,7 +36,7 @@ class TestPlugin(unittest.TestCase): message = "fortune" expected = "Funny fortune" - actual = fortune_plugin.run(self.fromcall, message, self.ack) + actual = fortune.run(self.fromcall, message, self.ack) self.assertEqual(expected, actual) @mock.patch("time.localtime") @@ -43,13 +46,13 @@ class TestPlugin(unittest.TestCase): m = fake_time.tm_min = 12 fake_time.tm_sec = 55 mock_time.return_value = fake_time - time_plugin = plugin.TimePlugin(self.config) + time = time_plugin.TimePlugin(self.config) fromcall = "KFART" message = "location" ack = 1 - actual = time_plugin.run(fromcall, message, ack) + actual = time.run(fromcall, message, ack) self.assertEqual(None, actual) cur_time = fuzzy(h, m, 1) @@ -61,7 +64,7 @@ class TestPlugin(unittest.TestCase): str(m).rjust(2, "0"), message.rstrip(), ) - actual = time_plugin.run(fromcall, message, ack) + actual = time.run(fromcall, message, ack) self.assertEqual(expected, actual) @mock.patch("time.localtime") @@ -72,7 +75,7 @@ class TestPlugin(unittest.TestCase): s = fake_time.tm_sec = 55 mock_time.return_value = fake_time - ping = plugin.PingPlugin(self.config) + ping = ping_plugin.PingPlugin(self.config) fromcall = "KFART" message = "location" @@ -102,19 +105,19 @@ class TestPlugin(unittest.TestCase): def test_version(self): expected = "APRSD version '{}'".format(aprsd.__version__) - version_plugin = plugin.VersionPlugin(self.config) + version = version_plugin.VersionPlugin(self.config) fromcall = "KFART" message = "No" ack = 1 - actual = version_plugin.run(fromcall, message, ack) + actual = version.run(fromcall, message, ack) self.assertEqual(None, actual) message = "version" - actual = version_plugin.run(fromcall, message, ack) + actual = version.run(fromcall, message, ack) self.assertEqual(expected, actual) message = "Version" - actual = version_plugin.run(fromcall, message, ack) + actual = version.run(fromcall, message, ack) self.assertEqual(expected, actual) From ee2aeb5157344ea02852c61e6acb25c3e7272f28 Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 14:12:13 -0500 Subject: [PATCH 10/50] Added Sphinx based documentation This patch adds the docuemntation source tree in docs. You can build the documentation with tox -edocs View the documentation by opening a browser and viewing aprsd/docs/_build/index.html --- LICENSE | 175 +++++++++++++++ README.rst | 127 +++++------ docs/_static/.keep | 0 docs/_templates/.keep | 0 docs/apidoc/aprsd.plugins.rst | 77 +++++++ docs/apidoc/aprsd.rst | 93 ++++++++ docs/apidoc/modules.rst | 7 + docs/clean_docs.py | 22 ++ docs/conf.py | 188 ++++++++++++++++ docs/configure.rst | 71 ++++++ docs/index.rst | 30 +++ docs/install.rst | 67 ++++++ docs/links.rst | 31 +++ docs/plugin.rst | 55 +++++ docs/readme.rst | 392 ++++++++++++++++++++++++++++++++++ docs/server.rst | 53 +++++ setup.cfg | 20 +- tox.ini | 11 +- 18 files changed, 1338 insertions(+), 81 deletions(-) create mode 100644 LICENSE create mode 100644 docs/_static/.keep create mode 100644 docs/_templates/.keep create mode 100644 docs/apidoc/aprsd.plugins.rst create mode 100644 docs/apidoc/aprsd.rst create mode 100644 docs/apidoc/modules.rst create mode 100644 docs/clean_docs.py create mode 100644 docs/conf.py create mode 100644 docs/configure.rst create mode 100644 docs/index.rst create mode 100644 docs/install.rst create mode 100644 docs/links.rst create mode 100644 docs/plugin.rst create mode 100644 docs/readme.rst create mode 100644 docs/server.rst diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..67db858 --- /dev/null +++ b/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/README.rst b/README.rst index a540d8d..3ba3bd0 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,9 @@ APRSD ===== +.. image:: https://badge.fury.io/py/aprsd.svg + :target: https://badge.fury.io/py/aprsd + .. image:: https://github.com/craigerl/aprsd/workflows/python/badge.svg :target: https://github.com/craigerl/aprsd/actions @@ -11,9 +14,17 @@ APRSD .. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 :target: https://timothycrosley.github.io/isort/ +.. image:: https://static.pepy.tech/personalized-badge/aprsd?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads + :target: https://pepy.tech/project/aprsd + .. contents:: :local: -Listen on amateur radio aprs-is network for messages and respond to them. +`APRSD `_ is a Ham radio `APRS `_ message command gateway built on python. + +APRSD listens on amateur radio aprs-is network for messages and respond to them. +It has a plugin architecture for extensibility. Users of APRSD can write their own +plugins that can respond to APRS-IS messages. + You must have an amateur radio callsign to use this software. APRSD gets messages for the configured HAM callsign, and sends those messages to a list of plugins for processing. There are a set of core plugins that @@ -27,14 +38,13 @@ Typical use case Ham radio operator using an APRS enabled HAM radio sends a message to check the weather. an APRS message is sent, and then picked up by APRSD. The APRS packet is decoded, and the message is sent through the list of plugins -for processing. The WeatherPlugin picks up the message, fetches the weather +for processing. For example, the WeatherPlugin picks up the message, fetches the weather for the area around the user who sent the request, and then responds with the weather conditions in that area. - APRSD Capabilities ------------------- +================== * server - The main aprsd server processor. Send/Rx APRS messages to HAM callsign * send-message - use aprsd to send a command/message to aprsd server. Used for development testing @@ -52,6 +62,7 @@ If it matches, the plugin runs. IF the regex doesn't match, the plugin is skipp * FortunePlugin - Replies with old unix fortune random fortune! * LocationPlugin - Checks location of ham operator * PingPlugin - Sends pong with timestamp +* QueryPlugin - Allows querying the list of delayed messages that were not ACK'd by radio * TimePlugin - Current time of day * WeatherPlugin - Get weather conditions for current location of HAM callsign * VersionPlugin - Reports the version information for aprsd @@ -72,6 +83,7 @@ Current messages this will respond to: -email_addr email text = send an email, say "mapme" to send a current position/map -2 = resend the last 2 emails from your imap inbox to this radio p(ing) = respond with Pong!/time + v(ersion) = Respond with current APRSD Version string anything else = respond with usage @@ -86,7 +98,7 @@ email server, and associated logins, passwords. search for "yourdomain", Installation: -------------- +============= pip install aprsd @@ -118,13 +130,14 @@ Help show Show the click-completion-command completion code -Commands --------- -sample-config +Commands +======== + +Configuration ============= This command outputs a sample config yml formatted block that you can edit -and use to pass in to aprsd with -c. +and use to pass in to aprsd with -c. By default aprsd looks in ~/.config/aprsd/aprsd.yml aprsd sample-config @@ -235,8 +248,9 @@ test messages -h, --help Show this message and exit. + Example output: ---------------- +=============== SEND EMAIL (radio to smtp server) @@ -278,60 +292,30 @@ RECEIVE EMAIL (imap server to radio) Msg number : 0 -WEATHER -======= - -:: - - Received message______________ - Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :weather{27 - From : KM6XXX - Message : weather - Msg number : 27 - - Sending message_______________ 6(Tx3) - Raw : KM6XXX-9>APRS::KM6XXX :58F(58F/46F) Partly cloudy. Tonight, Heavy Rain.{6 - To : KM6XXX - Message : 58F(58F/46F) Party Cloudy. Tonight, Heavy Rain. - - Sending ack __________________ Tx(3) - Raw : KM6XXX-9>APRS::KM6XXX :ack27 - To : KM6XXX - Ack number : 27 - - Received message______________ - Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack6 - From : KM6XXX - Message : ack6 - Msg number : 0 - - LOCATION ======== :: - Received message______________ - Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :location{28 - From : KM6XXX + Received Message _______________ + Raw : KM6XXX-6>APRS,TCPIP*,qAC,T2CAEAST::KM6XXX-14:location{2 + From : KM6XXX-6 Message : location - Msg number : 28 + Msg number : 2 + Received Message _______________ Complete - Sending message_______________ 7(Tx3) - Raw : KM6XXX-9>APRS::KM6XXX :8 Miles NE Auburn CA 1673' 39.91150,-120.93450 0.1h ago{7 - To : KM6XXX - Message : 8 Miles E Auburn CA 1673' 38.91150,-120.93450 0.1h ago + Sending Message _______________ + Raw : KM6XXX-14>APRS::KM6XXX-6 :KM6XXX-6: 8 Miles E Auburn CA 0' 0,-120.93584 1873.7h ago{2 + To : KM6XXX-6 + Message : KM6XXX-6: 8 Miles E Auburn CA 0' 0,-120.93584 1873.7h ago + Msg number : 2 + Sending Message _______________ Complete - Sending ack __________________ Tx(3) - Raw : KM6XXX-9>APRS::KM6XXX :ack28 - To : KM6XXX - Ack number : 28 - - Received message______________ - Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack7 - From : KM6XXX - Message : ack7 - Msg number : 0 + Sending ack _______________ + Raw : KM6XXX-14>APRS::KM6XXX-6 :ack2 + To : KM6XXX-6 + Ack : 2 + Sending ack _______________ Complete AND... ping, fortune, time..... @@ -341,25 +325,21 @@ Development * git clone git@github.com:craigerl/aprsd.git * cd aprsd -* virtualenv .venv -* source .venv/bin/activate -* pip install -e . -* pre-commit install +* make Workflow --------- +======== While working aprsd, The workflow is as follows * Edit code, save file -* run tox -epep8 * run tox -efmt * run tox -p * git commit ( This will run the pre-commit hooks which does checks too ) Release -------- +======= To do release to pypi: @@ -371,25 +351,20 @@ To do release to pypi: git push origin master --tags -* Build dist and wheel +* Do a test build and verify build is valid - python setup.py sdist bdist_wheel - -* Verify build is valid for pypi (need twine installed ) - - pip install twine - twine check dist/* + make build * Once twine is happy, upload release to pypi - twine upload dist/* + make upload Docker Container ----------------- +================ Building --------- +======== There are 2 versions of the container Dockerfile that can be used. The main Dockerfile, which is for building the official release container @@ -398,18 +373,18 @@ which is used for building a container based off of a git branch of the repo. Official Build --------------- +============== docker build -t hemna6969/aprsd:latest . Development Build ------------------ +================= docker build -t hemna6969/aprsd:latest -f Dockerfile-dev . Running the container ---------------------- +===================== There is a docker-compose.yml file that can be used to run your container. There are 2 volumes defined that can be used to store your configuration diff --git a/docs/_static/.keep b/docs/_static/.keep new file mode 100644 index 0000000..e69de29 diff --git a/docs/_templates/.keep b/docs/_templates/.keep new file mode 100644 index 0000000..e69de29 diff --git a/docs/apidoc/aprsd.plugins.rst b/docs/apidoc/aprsd.plugins.rst new file mode 100644 index 0000000..7c6718a --- /dev/null +++ b/docs/apidoc/aprsd.plugins.rst @@ -0,0 +1,77 @@ +aprsd.plugins package +===================== + +Submodules +---------- + +aprsd.plugins.email module +-------------------------- + +.. automodule:: aprsd.plugins.email + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.fortune module +---------------------------- + +.. automodule:: aprsd.plugins.fortune + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.location module +----------------------------- + +.. automodule:: aprsd.plugins.location + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.ping module +------------------------- + +.. automodule:: aprsd.plugins.ping + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.query module +-------------------------- + +.. automodule:: aprsd.plugins.query + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.time module +------------------------- + +.. automodule:: aprsd.plugins.time + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.version module +---------------------------- + +.. automodule:: aprsd.plugins.version + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugins.weather module +---------------------------- + +.. automodule:: aprsd.plugins.weather + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aprsd.plugins + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/apidoc/aprsd.rst b/docs/apidoc/aprsd.rst new file mode 100644 index 0000000..2056c90 --- /dev/null +++ b/docs/apidoc/aprsd.rst @@ -0,0 +1,93 @@ +aprsd package +============= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aprsd.plugins + +Submodules +---------- + +aprsd.client module +------------------- + +.. automodule:: aprsd.client + :members: + :undoc-members: + :show-inheritance: + +aprsd.email module +------------------ + +.. automodule:: aprsd.email + :members: + :undoc-members: + :show-inheritance: + +aprsd.fake\_aprs module +----------------------- + +.. automodule:: aprsd.fake_aprs + :members: + :undoc-members: + :show-inheritance: + +aprsd.fuzzyclock module +----------------------- + +.. automodule:: aprsd.fuzzyclock + :members: + :undoc-members: + :show-inheritance: + +aprsd.main module +----------------- + +.. automodule:: aprsd.main + :members: + :undoc-members: + :show-inheritance: + +aprsd.messaging module +---------------------- + +.. automodule:: aprsd.messaging + :members: + :undoc-members: + :show-inheritance: + +aprsd.plugin module +------------------- + +.. automodule:: aprsd.plugin + :members: + :undoc-members: + :show-inheritance: + +aprsd.threads module +-------------------- + +.. automodule:: aprsd.threads + :members: + :undoc-members: + :show-inheritance: + +aprsd.utils module +------------------ + +.. automodule:: aprsd.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aprsd + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/apidoc/modules.rst b/docs/apidoc/modules.rst new file mode 100644 index 0000000..ab430eb --- /dev/null +++ b/docs/apidoc/modules.rst @@ -0,0 +1,7 @@ +aprsd +===== + +.. toctree:: + :maxdepth: 4 + + aprsd diff --git a/docs/clean_docs.py b/docs/clean_docs.py new file mode 100644 index 0000000..771bfd3 --- /dev/null +++ b/docs/clean_docs.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +"""Removes temporary Sphinx build artifacts to ensure a clean build. + +This is needed if the Python source being documented changes significantly. Old sphinx-apidoc +RST files can be left behind. +""" + +from pathlib import Path +import shutil + + +def main() -> None: + docs_dir = Path(__file__).resolve().parent + for folder in ("_build", "apidoc"): + delete_dir = docs_dir / folder + if delete_dir.exists(): + shutil.rmtree(delete_dir) + + +if __name__ == "__main__": + main() diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..b71f155 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,188 @@ +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +import os +import sys + +sys.path.insert(0, os.path.abspath("../src")) + + +# -- Project information ----------------------------------------------------- + +project = "APRSD" +copyright = "" +author = "Craig Lamparter" + +# The short X.Y version +version = "v1.5.0" +# The full version, including alpha/beta/rc tags +release = "" + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + # Override the default alabaster line wrap, which wraps tightly at 940px. + "page_width": "auto", +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = "adoc" + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, "a.tex", "a Documentation", "a", "manual"), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [(master_doc, "a", "a Documentation", [author], 1)] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + master_doc, + "a", + "a Documentation", + author, + "a", + "One line description of project.", + "Miscellaneous", + ), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ["search.html"] + + +# -- Extension configuration ------------------------------------------------- + +# -- Options for todo extension ---------------------------------------------- + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True diff --git a/docs/configure.rst b/docs/configure.rst new file mode 100644 index 0000000..dfb2a6c --- /dev/null +++ b/docs/configure.rst @@ -0,0 +1,71 @@ +APRSD Configure +=============== + +Configure APRSD +------------------------ + +Once APRSD is :doc:`installed ` You will need to configure the config file +for running. + + +Generate config file +--------------------- +If you have never run the server, running it the first time will generate +a sample config file in the default location of ~/.config/aprsd/aprsd.yml + +.. code-block:: shell + + └─[$] -> aprsd server + Load config + /home/aprsd/.config/aprsd/aprsd.yml is missing, creating config file + Default config file created at /home/aprsd/.config/aprsd/aprsd.yml. Please edit with your settings. + +You can see the sample config file output + +Sample config file +------------------ + +.. code-block:: shell + + └─[$] -> cat ~/.config/aprsd/aprsd.yml + aprs: + host: rotate.aprs.net + logfile: /tmp/arsd.log + login: someusername + password: somepassword + port: 14580 + aprsd: + enabled_plugins: + - aprsd.plugins.email.EmailPlugin + - aprsd.plugins.fortune.FortunePlugin + - aprsd.plugins.location.LocationPlugin + - aprsd.plugins.ping.PingPlugin + - aprsd.plugins.query.QueryPlugin + - aprsd.plugins.time.TimePlugin + - aprsd.plugins.weather.WeatherPlugin + - aprsd.plugins.version.VersionPlugin + plugin_dir: ~/.config/aprsd/plugins + ham: + callsign: KFART + imap: + host: imap.gmail.com + login: imapuser + password: something here too + port: 993 + use_ssl: true + shortcuts: + aa: 5551239999@vtext.com + cl: craiglamparter@somedomain.org + wb: 555309@vtext.com + smtp: + host: imap.gmail.com + login: something + password: some lame password + port: 465 + use_ssl: false + + +Note, You must edit the config file and change the ham callsign to your +legal FCC HAM callsign, or aprsd server will not start. + +.. include:: links.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..8b1a043 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,30 @@ +.. a documentation master file, created by + sphinx-quickstart on Wed Dec 19 18:34:22 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +``APRSD`` Documentation +======================= + +.. include:: readme.rst + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + readme + install + configure + server + plugin + + apidoc/modules.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +.. include:: links.rst diff --git a/docs/install.rst b/docs/install.rst new file mode 100644 index 0000000..d904432 --- /dev/null +++ b/docs/install.rst @@ -0,0 +1,67 @@ +APRSD installation +================== + +Install info in a nutshell +-------------------------- + +**Pythons**: Python 3.6 or later + +**Operating systems**: Linux, OSX, Unix + +**Installer Requirements**: setuptools_ + +**License**: Apache license + +**git repository**: https://github.com/craigerl/aprsd + +Installation with pip +-------------------------------------- + +Use the following command: + +.. code-block:: shell + + pip install aprsd + +It is fine to install ``aprsd`` itself into a virtualenv_ environment. + +Install from clone +------------------------- + +Consult the GitHub page how to clone the git repository: + + https://github.com/craigerl/aprsd + +and then install in your environment with something like: + +.. code-block:: shell + + $ cd + $ pip install . + +or install it `editable `_ if you want code changes to propagate automatically: + +.. code-block:: shell + + $ cd + $ pip install --editable . + +so that you can do changes and submit patches. + + +Install for development +---------------------------- + +For developers you should clone the repo from github, then use the Makefile + +.. code-block:: shell + + $ cd + $ make + +This creates a virtualenv_ directory, install all the requirements for +development as well as aprsd in `editable `_ mode. +It will install all of the pre-commit git hooks required to test prior to committing code. + + +.. include:: links.rst diff --git a/docs/links.rst b/docs/links.rst new file mode 100644 index 0000000..ba75c60 --- /dev/null +++ b/docs/links.rst @@ -0,0 +1,31 @@ +.. _`Cookiecutter`: https://cookiecutter.readthedocs.io +.. _`pluggy`: https://pluggy.readthedocs.io +.. _`cookiecutter-tox-plugin`: https://github.com/tox-dev/cookiecutter-tox-plugin +.. _devpi: https://doc.devpi.net +.. _Python: https://www.python.org +.. _virtualenv: https://pypi.org/project/virtualenv +.. _`pytest`: https://pytest.org +.. _nosetests: +.. _`nose`: https://pypi.org/project/nose +.. _`Holger Krekel`: https://twitter.com/hpk42 +.. _`pytest-xdist`: https://pypi.org/project/pytest-xdist +.. _ConfigParser: https://docs.python.org/3/library/configparser.html + +.. _`easy_install`: http://peak.telecommunity.com/DevCenter/EasyInstall +.. _pip: https://pypi.org/project/pip +.. _setuptools: https://pypi.org/project/setuptools +.. _`jenkins`: https://jenkins.io/index.html +.. _sphinx: https://pypi.org/project/Sphinx +.. _discover: https://pypi.org/project/discover +.. _unittest2: https://pypi.org/project/unittest2 +.. _mock: https://pypi.org/project/mock/ +.. _flit: https://flit.readthedocs.io/en/latest/ +.. _poetry: https://poetry.eustace.io/ +.. _pypy: https://pypy.org + +.. _`Python Packaging Guide`: https://packaging.python.org/tutorials/packaging-projects/ +.. _`tox.ini`: :doc:configfile + +.. _`PEP-508`: https://www.python.org/dev/peps/pep-0508/ +.. _`PEP-517`: https://www.python.org/dev/peps/pep-0517/ +.. _`PEP-518`: https://www.python.org/dev/peps/pep-0518/ diff --git a/docs/plugin.rst b/docs/plugin.rst new file mode 100644 index 0000000..6f74ce3 --- /dev/null +++ b/docs/plugin.rst @@ -0,0 +1,55 @@ +APRSD Command Plugin Development +================================ + +APRSDPluginBase +------------------------ + +Plugins are written as python objects that extend the APRSDPluginBase class. +This is an abstract class that has several properties and a method that must be implemented +by your subclass. + +Properties +---------- + +* name - the Command name +* regex - The regular expression that if matched against the incoming APRS message, + will cause your plugin to be called. + +Methods +------- + +* command - This method is called when the regex matches the incoming message from APRS. + If you want to send a message back to the sending, just return a string + in your method implementation. If you get called and don't want to reply, then + you should return a messaging.NULL_MESSAGE to signal to the plugin processor + that you got called and processed the message correctly. Otherwise a usage + string may get returned to the sender. + + +Example Plugin +-------------- + +There is an example plugin in the aprsd source code here: +aprsd/examples/plugins/example_plugin.py + +.. code-block:: python + + import logging + + from aprsd import plugin + + LOG = logging.getLogger("APRSD") + + + class HelloPlugin(plugin.APRSDPluginBase): + """Hello World.""" + + version = "1.0" + # matches any string starting with h or H + command_regex = "^[hH]" + command_name = "hello" + + def command(self, fromcall, message, ack): + LOG.info("HelloPlugin") + reply = "Hello '{}'".format(fromcall) + return reply diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 0000000..9f44907 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1,392 @@ +APRSD +----- + +.. image:: https://badge.fury.io/py/aprsd.svg + :target: https://badge.fury.io/py/aprsd + +.. image:: https://github.com/craigerl/aprsd/workflows/python/badge.svg + :target: https://github.com/craigerl/aprsd/actions + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://black.readthedocs.io/en/stable/ + +.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 + :target: https://timothycrosley.github.io/isort/ + +.. image:: https://static.pepy.tech/personalized-badge/aprsd?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads + :target: https://pepy.tech/project/aprsd + + +Summary +======= + +`APRSD `_ is a Ham radio `APRS `_ message command gateway built on python. + +APRSD listens on amateur radio aprs-is network for messages and respond to them. +It has a plugin architecture for extensibility. Users of APRSD can write their own +plugins that can respond to APRS-IS messages. + +You must have an amateur radio callsign to use this software. APRSD gets +messages for the configured HAM callsign, and sends those messages to a +list of plugins for processing. There are a set of core plugins that +provide responding to messages to check email, get location, ping, +time of day, get weather, and fortune telling as well as version information +of aprsd itself. + +Typical use case +================ + +Ham radio operator using an APRS enabled HAM radio sends a message to check +the weather. an APRS message is sent, and then picked up by APRSD. The +APRS packet is decoded, and the message is sent through the list of plugins +for processing. For example, the WeatherPlugin picks up the message, fetches the weather +for the area around the user who sent the request, and then responds with +the weather conditions in that area. + + +APRSD Capabilities +================== + +* server - The main aprsd server processor. Send/Rx APRS messages to HAM callsign +* send-message - use aprsd to send a command/message to aprsd server. Used for development testing +* sample-config - generate a sample aprsd.yml config file for use/editing +* bash completion generation. Uses python click bash completion to generate completion code for your .bashrc/.zshrc + + +List of core server plugins +=========================== + +Plugins function by specifying a regex that is searched for in the APRS message. +If it matches, the plugin runs. IF the regex doesn't match, the plugin is skipped. + +* EmailPlugin - Check email and reply with contents. Have to configure IMAP and SMTP settings in aprs.yml +* FortunePlugin - Replies with old unix fortune random fortune! +* LocationPlugin - Checks location of ham operator +* PingPlugin - Sends pong with timestamp +* QueryPlugin - Allows querying the list of delayed messages that were not ACK'd by radio +* TimePlugin - Current time of day +* WeatherPlugin - Get weather conditions for current location of HAM callsign +* VersionPlugin - Reports the version information for aprsd + + +Current messages this will respond to: +====================================== + +:: + + APRS messages: + l(ocation) [callsign] = descriptive current location of your radio + 8 Miles E Auburn CA 1673' 39.92150,-120.93950 0.1h ago + w(eather) = weather forecast for your radio's current position + 58F(58F/46F) Partly Cloudy. Tonight, Heavy Rain. + t(ime) = respond with the current time + f(ortune) = respond with a short fortune + -email_addr email text = send an email, say "mapme" to send a current position/map + -2 = resend the last 2 emails from your imap inbox to this radio + p(ing) = respond with Pong!/time + v(ersion) = Respond with current APRSD Version string + anything else = respond with usage + + +Meanwhile this code will monitor a single imap mailbox and forward email +to your BASECALLSIGN over the air. Only radios using the BASECALLSIGN are allowed +to send email, so consider this security risk before using this (or Amatuer radio in +general). Email is single user at this time. + +There are additional parameters in the code (sorry), so be sure to set your +email server, and associated logins, passwords. search for "yourdomain", +"password". Search for "shortcuts" to setup email aliases as well. + + +Example usage: +============== + + aprsd -h + +Help +==== +:: + + └─[$] > aprsd -h + Usage: aprsd [OPTIONS] COMMAND [ARGS]... + + Shell completion for click-completion-command Available shell types: + bash Bourne again shell fish Friendly interactive shell + powershell Windows PowerShell zsh Z shell Default type: auto + + Options: + --version Show the version and exit. + -h, --help Show this message and exit. + + Commands: + install Install the click-completion-command completion + sample-config This dumps the config to stdout. + send-message Send a message to a callsign via APRS_IS. + server Start the aprsd server process. + show Show the click-completion-command completion code + + + + +Configuration +------------- +This command outputs a sample config yml formatted block that you can edit +and use to pass in to aprsd with -c. By default aprsd looks in ~/.config/aprsd/aprsd.yml + + aprsd sample-config + +Output +====== +:: + + └─[$] > aprsd sample-config + + aprs: + host: rotate.aprs.net + logfile: /tmp/arsd.log + login: someusername + password: somepassword + port: 14580 + aprsd: + enabled_plugins: + - aprsd.plugin.EmailPlugin + - aprsd.plugin.FortunePlugin + - aprsd.plugin.LocationPlugin + - aprsd.plugin.PingPlugin + - aprsd.plugin.TimePlugin + - aprsd.plugin.WeatherPlugin + - aprsd.plugin.VersionPlugin + plugin_dir: ~/.config/aprsd/plugins + ham: + callsign: KFART + imap: + host: imap.gmail.com + login: imapuser + password: something here too + port: 993 + use_ssl: true + shortcuts: + aa: 5551239999@vtext.com + cl: craiglamparter@somedomain.org + wb: 555309@vtext.com + smtp: + host: imap.gmail.com + login: something + password: some lame password + port: 465 + use_ssl: false + + +server +------ + +This is the main server command that will listen to APRS-IS servers and +look for incomming commands to the callsign configured in the config file + +:: + + └─[$] > aprsd server --help + Usage: aprsd server [OPTIONS] + + Start the aprsd server process. + + Options: + --loglevel [CRITICAL|ERROR|WARNING|INFO|DEBUG] + The log level to use for aprsd.log + [default: DEBUG] + + --quiet Don't log to stdout + --disable-validation Disable email shortcut validation. Bad + email addresses can result in broken email + responses!! + + -c, --config TEXT The aprsd config file to use for options. + [default: ~/.config/aprsd/aprsd.yml] + + -h, --help Show this message and exit. + (.venv3) ┌─[waboring@dl360-1] - [~/devel/aprsd] - [Sun Dec 20, 12:32] - + └─[$] aprsd server + Load config + [12/20/2020 12:33:03 PM] [MainThread ] [INFO ] APRSD Started version: 1.0.2 + [12/20/2020 12:33:03 PM] [MainThread ] [INFO ] Checking IMAP configuration + [12/20/2020 12:33:04 PM] [MainThread ] [INFO ] Checking SMTP configuration + + +send-message +------------ + +This command is typically used for development to send another aprsd instance +test messages + +:: + + └─[$] > aprsd send-message -h + Usage: aprsd send-message [OPTIONS] TOCALLSIGN [COMMAND]... + + Send a message to a callsign via APRS_IS. + + Options: + --loglevel [CRITICAL|ERROR|WARNING|INFO|DEBUG] + The log level to use for aprsd.log + [default: DEBUG] + + --quiet Don't log to stdout + -c, --config TEXT The aprsd config file to use for options. + [default: ~/.config/aprsd/aprsd.yml] + + --aprs-login TEXT What callsign to send the message from. + [env var: APRS_LOGIN] + + --aprs-password TEXT the APRS-IS password for APRS_LOGIN [env + var: APRS_PASSWORD] + + -h, --help Show this message and exit. + + +Example Message output: +----------------------- + + +SEND EMAIL (radio to smtp server) +================================= + +:: + + Received message______________ + Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :-user@host.com test new shortcuts global, radio to pc{29 + From : KM6XXX + Message : -user@host.com test new shortcuts global, radio to pc + Msg number : 29 + + Sending Email_________________ + To : user@host.com + Subject : KM6XXX + Body : test new shortcuts global, radio to pc + + Sending ack __________________ Tx(3) + Raw : KM6XXX-9>APRS::KM6XXX :ack29 + To : KM6XXX + Ack number : 29 + + +RECEIVE EMAIL (imap server to radio) +==================================== + +:: + + Sending message_______________ 6(Tx3) + Raw : KM6XXX-9>APRS::KM6XXX :-somebody@gmail.com email from internet to radio{6 + To : KM6XXX + Message : -somebody@gmail.com email from internet to radio + + Received message______________ + Raw : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack6 + From : KM6XXX + Message : ack6 + Msg number : 0 + + +LOCATION +======== + +:: + + Received Message _______________ + Raw : KM6XXX-6>APRS,TCPIP*,qAC,T2CAEAST::KM6XXX-14:location{2 + From : KM6XXX-6 + Message : location + Msg number : 2 + Received Message _______________ Complete + + Sending Message _______________ + Raw : KM6XXX-14>APRS::KM6XXX-6 :KM6XXX-6: 8 Miles E Auburn CA 0' 0,-120.93584 1873.7h ago{2 + To : KM6XXX-6 + Message : KM6XXX-6: 8 Miles E Auburn CA 0' 0,-120.93584 1873.7h ago + Msg number : 2 + Sending Message _______________ Complete + + Sending ack _______________ + Raw : KM6XXX-14>APRS::KM6XXX-6 :ack2 + To : KM6XXX-6 + Ack : 2 + Sending ack _______________ Complete + +AND... ping, fortune, time..... + + +Development +----------- + +* git clone git@github.com:craigerl/aprsd.git +* cd aprsd +* make + +Workflow +======== + +While working aprsd, The workflow is as follows + +* Edit code, save file +* run tox -efmt +* run tox -p +* git commit ( This will run the pre-commit hooks which does checks too ) + + +Release +======= + +To do release to pypi: + +* Tag release with + + git tag -v1.XX -m "New release" + +* push release tag up + + git push origin master --tags + +* Do a test build and verify build is valid + + make build + +* Once twine is happy, upload release to pypi + + make upload + + +Docker Container +---------------- + +Building +======== + +There are 2 versions of the container Dockerfile that can be used. +The main Dockerfile, which is for building the official release container +based off of the pip install version of aprsd and the Dockerfile-dev, +which is used for building a container based off of a git branch of +the repo. + +Official Build +============== + + docker build -t hemna6969/aprsd:latest . + +Development Build +================= + + docker build -t hemna6969/aprsd:latest -f Dockerfile-dev . + + +Running the container +===================== + +There is a docker-compose.yml file that can be used to run your container. +There are 2 volumes defined that can be used to store your configuration +and the plugins directory: /config and /plugins + +If you want to install plugins at container start time, then use the +environment var in docker-compose.yml specified as APRS_PLUGINS +Provide a csv list of pypi installable plugins. Then make sure the plugin +python file is in your /plugins volume and the plugin will be installed at +container startup. The plugin may have dependencies that are required. +The plugin file should be copied to /plugins for loading by aprsd diff --git a/docs/server.rst b/docs/server.rst new file mode 100644 index 0000000..8fc28fd --- /dev/null +++ b/docs/server.rst @@ -0,0 +1,53 @@ +APRSD server +============ + +Running the APRSD server +------------------------ + +Once APRSD is :doc:`installed ` and :doc:`configured ` the server can be started by +running. + +.. code-block:: shell + + aprsd server + +The server will start several threads to deal handle incoming messages, outgoing +messages, checking and sending email. + +.. code-block:: shell + + [MainThread ] [INFO ] APRSD Started version: 1.5.1 + [MainThread ] [INFO ] Checking IMAP configuration + [MainThread ] [INFO ] Checking SMTP configuration + [MainThread ] [DEBUG] Connect to SMTP host SSL smtp.gmail.com:465 with user 'test@hemna.com' + [MainThread ] [DEBUG] Connected to smtp host SSL smtp.gmail.com:465 + [MainThread ] [DEBUG] Logged into SMTP server SSL smtp.gmail.com:465 + [MainThread ] [INFO ] Validating 2 Email shortcuts. This can take up to 10 seconds per shortcut + [MainThread ] [ERROR] 'craiglamparter@somedomain.org' is an invalid email address. Removing shortcut + [MainThread ] [INFO ] Available shortcuts: {'wb': 'waboring@hemna.com'} + [MainThread ] [INFO ] Loading Core APRSD Command Plugins + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.email.EmailPlugin'(1.0) '^-.*' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.fortune.FortunePlugin'(1.0) '^[fF]' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.location.LocationPlugin'(1.0) '^[lL]' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.ping.PingPlugin'(1.0) '^[pP]' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.query.QueryPlugin'(1.0) '^\?.*' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.time.TimePlugin'(1.0) '^[tT]' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.weather.WeatherPlugin'(1.0) '^[wW]' + [MainThread ] [INFO ] Registering Command plugin 'aprsd.plugins.version.VersionPlugin'(1.0) '^[vV]' + [MainThread ] [INFO ] Skipping Custom Plugins directory. + [MainThread ] [INFO ] Completed Plugin Loading. + [MainThread ] [DEBUG] Loading saved MsgTrack object. + [RX_MSG ] [INFO ] Starting + [TX_MSG ] [INFO ] Starting + [MainThread ] [DEBUG] KeepAlive Tracker(0): {} + [RX_MSG ] [INFO ] Creating aprslib client + [RX_MSG ] [INFO ] Attempting connection to noam.aprs2.net:14580 + [RX_MSG ] [INFO ] Connected to ('198.50.198.139', 14580) + [RX_MSG ] [DEBUG] Banner: # aprsc 2.1.8-gf8824e8 + [RX_MSG ] [INFO ] Sending login information + [RX_MSG ] [DEBUG] Server: # logresp KM6XXX-14 verified, server T2VAN + [RX_MSG ] [INFO ] Login successful + [RX_MSG ] [DEBUG] Logging in to APRS-IS with user 'KM6XXX-14' + + +.. include:: links.rst diff --git a/setup.cfg b/setup.cfg index 125cd1f..e89d7a8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,14 +2,25 @@ name = aprsd long_description = file: README.rst long_description_content_type = text/x-rst +url = http://aprsd.readthedocs.org author = Craig Lamparter author_email = something@somewhere.com +license = Apache +license_file = LICENSE classifier = + License :: OSI Approved :: Apache Software License Topic :: Communications :: Ham Radio Operating System :: POSIX :: Linux Programming Language :: Python + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 description_file = README.rst +project_urls = + Source=https://github.com/craigerl/aprsd + Tracker=https://github.com/craigerl/aprsd/issues summary = Amateur radio APRS daemon which listens for messages and responds [global] @@ -26,9 +37,12 @@ console_scripts = fake_aprs = aprsd.fake_aprs:main [build_sphinx] -source-dir = doc/source -build-dir = doc/build +source-dir = docs +build-dir = docs/_build all_files = 1 [upload_sphinx] -upload-dir = doc/build/html +upload-dir = docs/_build + +[bdist_wheel] +universal = 1 diff --git a/tox.ini b/tox.ini index dd53ec5..69103ef 100644 --- a/tox.ini +++ b/tox.ini @@ -23,8 +23,15 @@ commands = {envpython} -bb -m pytest {posargs} [testenv:docs] -deps = -r{toxinidir}/test-requirements.txt -commands = sphinx-build -b html docs/source docs/html +skip_install = true +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/dev-requirements.txt +changedir = {toxinidir}/docs +commands = + {envpython} clean_docs.py + sphinx-apidoc --force --output-dir apidoc {toxinidir}/aprsd + sphinx-build -a -W . _build [testenv:pep8] commands = From a33462327a25ff807a6df2d50222b1cc79475729 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Sat, 9 Jan 2021 14:02:16 -0800 Subject: [PATCH 11/50] swap Query command characters a bit --- aprsd/plugin.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index b7f350b..cbcbbe6 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -370,20 +370,19 @@ class QueryPlugin(APRSDPluginBase): searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands if re.search(searchstring, fromcall): - r = re.search(r"^\?-\*", message) + r = re.search(r"^\?[rR].*", message) if r is not None: if len(tracker) > 0: - reply = "Resend ALL Delayed msgs" - LOG.debug(reply) + reply = messaging.NULL_MESSAGE tracker.restart_delayed() else: reply = "No Delayed Msgs" LOG.debug(reply) return reply - r = re.search(r"^\?-[fF]!", message) + r = re.search(r"^\?[dD].*", message) if r is not None: - reply = "Deleting ALL Delayed msgs." + reply = "Deleted ALL unacked msgs" LOG.debug(reply) tracker.flush() return reply From 1763e94f937258c96bd321e1ee817b67b71ac39b Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 18:44:36 -0500 Subject: [PATCH 12/50] Fix broken test --- aprsd/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index bf619a9..5b06f74 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -230,4 +230,3 @@ class PluginManager: def get_plugins(self): return self._pluggy_pm.get_plugins() - From e7f2ebf17ed47e7acd0b4b2511a325603f437580 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Sat, 9 Jan 2021 15:50:04 -0800 Subject: [PATCH 13/50] switch command characters for query plugin --- aprsd/plugins/query.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index e5a4bfc..dfb0f35 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -22,7 +22,7 @@ class QueryPlugin(plugin.APRSDPluginBase): searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands if re.search(searchstring, fromcall): - r = re.search(r"^\?-\*", message) + r = re.search(r"^\?[rR].*", message) if r is not None: if len(tracker) > 0: reply = "Resend ALL Delayed msgs" @@ -33,7 +33,7 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.debug(reply) return reply - r = re.search(r"^\?-[fF]!", message) + r = re.search(r"^\?[fF].*", message) if r is not None: reply = "Deleting ALL Delayed msgs." LOG.debug(reply) From bd35a610ffe4a3cdccd123d10a0a39e61ad261ed Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 19:36:09 -0500 Subject: [PATCH 14/50] Updated build for docs tox -edocs Can now run tox -edocs --- docs/readme.rst | 6 ++++++ setup.cfg | 3 ++- tox.ini | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/readme.rst b/docs/readme.rst index 9f44907..ede994d 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -7,6 +7,12 @@ APRSD .. image:: https://github.com/craigerl/aprsd/workflows/python/badge.svg :target: https://github.com/craigerl/aprsd/actions +.. image:: https://img.shields.io/pypi/pyversions/aprsd.svg + :target: https://pypi.python.org/pypi/aprsd + +.. image:: https://img.shields.io/:license-apache-blue.svg + :target: http://www.apache.org/licenses/LICENSE-2.0 + .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://black.readthedocs.io/en/stable/ diff --git a/setup.cfg b/setup.cfg index e89d7a8..f392860 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,8 @@ classifier = License :: OSI Approved :: Apache Software License Topic :: Communications :: Ham Radio Operating System :: POSIX :: Linux - Programming Language :: Python + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 diff --git a/tox.ini b/tox.ini index 69103ef..f2d935a 100644 --- a/tox.ini +++ b/tox.ini @@ -27,6 +27,7 @@ skip_install = true deps = -r{toxinidir}/requirements.txt -r{toxinidir}/dev-requirements.txt + {toxinidir}/. changedir = {toxinidir}/docs commands = {envpython} clean_docs.py From 7423df6b25d358f3c170f51b32762ccb98f7684a Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 20:12:23 -0500 Subject: [PATCH 15/50] Added some more badges to readme files Added badges for both docs/readme.rst and main README.rst --- README.rst | 4 ++++ docs/readme.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.rst b/README.rst index 3ba3bd0..744d771 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,10 @@ APRSD .. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 :target: https://timothycrosley.github.io/isort/ +.. image:: https://img.shields.io/github/issues/craigerl/aprsd + +.. image:: https://img.shields.io/github/last-commit/craigerl/aprsd + .. image:: https://static.pepy.tech/personalized-badge/aprsd?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads :target: https://pepy.tech/project/aprsd diff --git a/docs/readme.rst b/docs/readme.rst index ede994d..450db1d 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -19,6 +19,10 @@ APRSD .. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 :target: https://timothycrosley.github.io/isort/ +.. image:: https://img.shields.io/github/issues/craigerl/aprsd + +.. image:: https://img.shields.io/github/last-commit/craigerl/aprsd + .. image:: https://static.pepy.tech/personalized-badge/aprsd?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads :target: https://pepy.tech/project/aprsd From e6dee3a5b052cca12b98dc63dc102cb84520ad3a Mon Sep 17 00:00:00 2001 From: Hemna Date: Sun, 10 Jan 2021 13:22:23 -0500 Subject: [PATCH 16/50] Disable MX record validation This patch disables the MX record checking for email address shortcuts. verizon is a shit smtp host that won't let you check emails as existing/valid. Email validation still is checked against RFC based regex for email address as well as blacklist checking. TODO(hemna): make this optionally enabled by config file. --- aprsd/email.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aprsd/email.py b/aprsd/email.py index ed562e8..de8f8b8 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -88,15 +88,16 @@ def validate_shortcuts(config): ) delete_keys = [] for key in shortcuts: + LOG.info("Validating {}:{}".format(key, shortcuts[key])) is_valid = validate_email( email_address=shortcuts[key], check_regex=True, - check_mx=True, + check_mx=False, from_address=config["smtp"]["login"], helo_host=config["smtp"]["host"], smtp_timeout=10, dns_timeout=10, - use_blacklist=False, + use_blacklist=True, debug=False, ) if not is_valid: From cc0d0fd523a4029ef66d50351114ef8c0f2bf9ed Mon Sep 17 00:00:00 2001 From: Hemna Date: Sun, 10 Jan 2021 16:11:53 -0500 Subject: [PATCH 17/50] Added APRSD system diagram to docs This patch adds the aprsd overview diagram to the main README as well as the generated docs. --- README.rst | 7 +++++++ docs/_static/aprsd_overview.png | Bin 0 -> 65040 bytes docs/_static/aprsd_overview.svg | 3 +++ docs/readme.rst | 8 ++++++++ 4 files changed, 18 insertions(+) create mode 100644 docs/_static/aprsd_overview.png create mode 100644 docs/_static/aprsd_overview.svg diff --git a/README.rst b/README.rst index 744d771..edab27f 100644 --- a/README.rst +++ b/README.rst @@ -36,6 +36,13 @@ provide responding to messages to check email, get location, ping, time of day, get weather, and fortune telling as well as version information of aprsd itself. + +APRSD Overview Diagram +---------------------- + +.. image:: https://raw.githubusercontent.com/craigerl/aprsd/crager-stable/docs/_static/aprsd_overview.svg?sanitize=true + + Typical use case ================ diff --git a/docs/_static/aprsd_overview.png b/docs/_static/aprsd_overview.png new file mode 100644 index 0000000000000000000000000000000000000000..a65720262871bd90cf1f39f36beb738570d5c879 GIT binary patch literal 65040 zcmZ_01yo(hwl)d`g1fr~cTI42clSVWcXxujyAy)DyA#|cxVsblt)x%)>3iRQ83Xp( zrL$^Ht2w_SR9;pL9tH;n1Ox0r3q40eJ+9d=EfCoESksj`Tr5I8#7CFl{qh6u5y3Q)6`r6B!v0 zYTy|P1RV4|$UEQ(6a)QC&uw)5yk(-r%#1p)tLymF@2aAl$B;z@wG1qXChtm8G=< zrz;Q1pB9|J^Y3B?5~4p%94&ZA)Mey}glz1MiP-5G=^06QVTg!`xa~iia4HIm{--N z!N}gs*3rzyn&|hq28K3HjyxnJzbE?V=Px=P%}o9~leNQtmIW-3;dc!K6Fnot|Ers^ ztJ(k2?RU*z-TtiWuj#md55_5EV`Xb^?BD>9#mmI~XM+Dx_FwY;YOiSQU}Nd@dlf3y zW{$kf|LO9-ivM>nIeRl>U|W87`)8Jam;LYd@}@S9Hoz;gH#3s3b~LsJNc>OlzbE{^ zTl{OR-|Oa-H*+<%R2Me0GPeG+O7>5T+zkKEn*ZHX$i~vfUdh(L$oMzWf4cmu=zq8V zGmpmqInTdp{?n72;Wr=ri!c6Sx<91=*YUz|GyKEByfDi<>Hu5wgGdMqD7%85WI|{w zk75q`ILjO6<{0KuvXeOH7=Cni;nT`4pHMwHJNrV@V5py$muE<<{?*sNM8D%LBfQl| zUf6K^>@0O+-~K$4%WjX$WvTYd_>T`ya^SZ5VA8(OjG*LQ;3*)e`e4k&G1_eQRZ-t@ zqO@Uv@BdW#hM~=VmX7;ZQ=qCO5GYno9O?=B?+AZ-RQZoE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%Fn07D@5U<{amEAN&gz zOn$gs6!gZ^+cut(v#x-nrptCWX)giCHwu*oH0{G{1R#QryS$6B8I8y5W7lOd zzKAEn$}Ni5&!LzgO(L#@SNobVf5lNW?&CW~j3I9`B^yGS4Yyupt{Dp}I{Zfe2@RRm z{+iP|>oaTs5d1z3vg^(&7KmUm#Q;rqc#9H{L8;3=VTY|u0L1S8Pk@S$Qzg{HZ%35H-Yo*B()O%q&T{4w!AZ#!|c#Cg4awE3zH2>L_;?J zNB6=DNj_-qhma)4H0Z^`A1;n9Y9=X-8Lso8S|6N_;6jr*yuwFif7Lmoo^-bZS+mxZ zw`kEQ67b2-(*Rn@ZU_CR@f);gJgo6tk?tP^Xni`*x`NQh5R8Gq_-vE6hifpn#XoHP zmwII0v!*@GP!L>}bP6_jcWNB}&;(0kO#%i8fs1oVGXINbMS9>_pK}Bd0i3E6HPms0 z-V-O{4-j=Gl0?5A8R^_NM|bdC(gJ;ffYELYdPOb=d?E)>?R8^fdfWH)st8w84b? z>uCs{#@31j5H2}@nv(gCmnZoo3`|X|*N>~He;Zks2nefOJllQpOL&t0e|V3_$7o6c z!iBD1!B6DIQ!nEIy57Y18|UBS5DPD;#;w;wtO%3~h!Xlw#a|s!k8H(H0TvvViTdxh z`ah7($E00$f8Ry=VbV~>tHJ-J5neYypCR;=IsexXBLLFUZG+q!T + +
Main
Main
SendMessageThread
SendMessageThread
EmailThread
EmailThread
RecieveMessageThread
RecieveMessageThread
aprsd.yml
aprsd.yml
APRSD Server
APRSD Server
IMAP/SMTP
IMAP/SMTP
APRS-IS
Server
APRS-IS...
aprslib
aprslib
Email
Email
Fortune
Fortune
Location
Location
Ping
Ping
Query
Query
Time
Time
Version
Version
Command
Plugins
Command...
APRS IGATE
APRS IGATE
HAM Radio
HAM Radio
Viewer does not support full SVG 1.1
diff --git a/docs/readme.rst b/docs/readme.rst index 450db1d..f105469 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -43,6 +43,14 @@ provide responding to messages to check email, get location, ping, time of day, get weather, and fortune telling as well as version information of aprsd itself. +APRSD overview diagram +---------------------- + +.. figure:: _static/aprsd_overview.svg + :align: center + :width: 800px + + Typical use case ================ From 0aa7fe7a14790326a9c6cbf4c50b3c87d548b233 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Sun, 10 Jan 2021 14:44:40 -0800 Subject: [PATCH 18/50] change query character syntax, don't reply that we're resending stuff --- aprsd/plugins/query.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index dfb0f35..cd63c7c 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -25,7 +25,7 @@ class QueryPlugin(plugin.APRSDPluginBase): r = re.search(r"^\?[rR].*", message) if r is not None: if len(tracker) > 0: - reply = "Resend ALL Delayed msgs" + reply = messaging.NULL_MESSAGE LOG.debug(reply) tracker.restart_delayed() else: @@ -33,9 +33,9 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.debug(reply) return reply - r = re.search(r"^\?[fF].*", message) + r = re.search(r"^\?[dD].*", message) if r is not None: - reply = "Deleting ALL Delayed msgs." + reply = "Deleted ALL delayed msgs." LOG.debug(reply) tracker.flush() return reply From f534646288b45fec0a0c5973cce9993fd4129d43 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 8 Jan 2021 12:28:17 -0500 Subject: [PATCH 19/50] Updated README with more workflow details --- README.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index edab27f..a3e19b8 100644 --- a/README.rst +++ b/README.rst @@ -343,10 +343,18 @@ Workflow While working aprsd, The workflow is as follows -* Edit code, save file +* checkout a new branch to work on +* git checkout -b mybranch +* Edit code +* run tox -epep8 * run tox -efmt * run tox -p * git commit ( This will run the pre-commit hooks which does checks too ) +* Once you are done with all of your commits, then push up the branch to + github +* git push -u origin mybranch +* Create a pull request from your branch so github tests can run and we can do + a code review. Release From a385d171bd43291f8ed3346169a358f59b002d52 Mon Sep 17 00:00:00 2001 From: Hemna Date: Sat, 9 Jan 2021 09:58:56 -0500 Subject: [PATCH 20/50] refactor Plugin objects to plugins directory This patch moves all of the plugins out of plugin.py into their own separate plugins/.py file. This makes it easier to maintain each plugin. NOTE: You will have to update your ~/.config/aprsd/aprsd.yml to change the python location path for each plugin enabled. For example: OLD: enabled_plugins: - aprsd.plugin.EmailPlugin TO NEW enabled_plugins: - aprsd.plugins.email.EmailPlugin --- aprsd/plugin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index 5b06f74..d676b26 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -65,6 +65,7 @@ class APRSDPluginBase(metaclass=abc.ABCMeta): @abc.abstractmethod def command(self, fromcall, message, ack): """This is the command that runs when the regex matches. + To reply with a message over the air, return a string to send. """ From 1ce2a56140566b1f1fccc7eff3f0b84b45c01578 Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 11:03:41 -0500 Subject: [PATCH 21/50] Updated MsgTrack restart_delayed This patch updates the restart_delayed method to accept the count of messages to restart as well as the most_recent flag that sorts the messages based on most recent first. If you want the oldest first, then pass in False --- aprsd/messaging.py | 27 ++++++-- tests/test_messaging.py | 150 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 tests/test_messaging.py diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 3f1f36d..491ba11 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -112,13 +112,28 @@ class MsgTrack: if msg.last_send_attempt < msg.retry_count: msg.send() - def restart_delayed(self): + def _resend(self, msg): + msg.last_send_attempt = 0 + msg.send() + + def restart_delayed(self, count=None, most_recent=True): """Walk the list of delayed messages and restart them if any.""" - for key in self.track.keys(): - msg = self.track[key] - if msg.last_send_attempt == msg.retry_count: - msg.last_send_attempt = 0 - msg.send() + if not count: + # Send all the delayed messages + for key in self.track.keys(): + msg = self.track[key] + if msg.last_send_attempt == msg.retry_count: + self._resend(msg) + else: + # They want to resend delayed messages + tmp = sorted( + self.track.items(), + reverse=most_recent, + key=lambda x: x[1].last_send_time, + ) + msg_list = tmp[:count] + for (_key, msg) in msg_list: + self._resend(msg) def flush(self): """Nuke the old pickle file that stored the old results from last aprsd run.""" diff --git a/tests/test_messaging.py b/tests/test_messaging.py new file mode 100644 index 0000000..d7a9110 --- /dev/null +++ b/tests/test_messaging.py @@ -0,0 +1,150 @@ +import datetime +import unittest +from unittest import mock + +from aprsd import messaging + + +class TestMessageTrack(unittest.TestCase): + def _clean_track(self): + track = messaging.MsgTrack() + track.track = {} + track.total_messages_tracked = 0 + return track + + def test_create(self): + track1 = messaging.MsgTrack() + track2 = messaging.MsgTrack() + + self.assertEqual(track1, track2) + + def test_add(self): + track = self._clean_track() + fromcall = "KFART" + tocall = "KHELP" + message = "somthing" + msg = messaging.TextMessage(fromcall, tocall, message) + + track.add(msg) + self.assertEqual(msg, track.get(msg.id)) + + def test_remove(self): + track = self._clean_track() + fromcall = "KFART" + tocall = "KHELP" + message = "somthing" + msg = messaging.TextMessage(fromcall, tocall, message) + track.add(msg) + + track.remove(msg.id) + self.assertEqual(None, track.get(msg.id)) + + def test_len(self): + """Test getting length of tracked messages.""" + track = self._clean_track() + fromcall = "KFART" + tocall = "KHELP" + message = "somthing" + msg = messaging.TextMessage(fromcall, tocall, message) + track.add(msg) + self.assertEqual(1, len(track)) + msg2 = messaging.TextMessage(tocall, fromcall, message) + track.add(msg2) + self.assertEqual(2, len(track)) + + track.remove(msg.id) + self.assertEqual(1, len(track)) + + @mock.patch("aprsd.messaging.TextMessage.send") + def test__resend(self, mock_send): + """Test the _resend method.""" + track = self._clean_track() + fromcall = "KFART" + tocall = "KHELP" + message = "somthing" + msg = messaging.TextMessage(fromcall, tocall, message) + msg.last_send_attempt = 3 + track.add(msg) + + track._resend(msg) + msg.send.assert_called_with() + self.assertEqual(0, msg.last_send_attempt) + + @mock.patch("aprsd.messaging.TextMessage.send") + def test_restart_delayed(self, mock_send): + """Test the _resend method.""" + track = self._clean_track() + fromcall = "KFART" + tocall = "KHELP" + message1 = "something" + message2 = "something another" + message3 = "something another again" + + mock1_send = mock.MagicMock() + mock2_send = mock.MagicMock() + mock3_send = mock.MagicMock() + + msg1 = messaging.TextMessage(fromcall, tocall, message1) + msg1.last_send_attempt = 3 + msg1.last_send_time = datetime.datetime.now() + msg1.send = mock1_send + track.add(msg1) + + msg2 = messaging.TextMessage(tocall, fromcall, message2) + msg2.last_send_attempt = 3 + msg2.last_send_time = datetime.datetime.now() + msg2.send = mock2_send + track.add(msg2) + + track.restart_delayed(count=None) + msg1.send.assert_called_once() + self.assertEqual(0, msg1.last_send_attempt) + msg2.send.assert_called_once() + self.assertEqual(0, msg2.last_send_attempt) + + msg1.last_send_attempt = 3 + msg1.send.reset_mock() + msg2.last_send_attempt = 3 + msg2.send.reset_mock() + + track.restart_delayed(count=1) + msg1.send.assert_not_called() + msg2.send.assert_called_once() + self.assertEqual(3, msg1.last_send_attempt) + self.assertEqual(0, msg2.last_send_attempt) + + msg3 = messaging.TextMessage(tocall, fromcall, message3) + msg3.last_send_attempt = 3 + msg3.last_send_time = datetime.datetime.now() + msg3.send = mock3_send + track.add(msg3) + + msg1.last_send_attempt = 3 + msg1.send.reset_mock() + msg2.last_send_attempt = 3 + msg2.send.reset_mock() + msg3.last_send_attempt = 3 + msg3.send.reset_mock() + + track.restart_delayed(count=2) + msg1.send.assert_not_called() + msg2.send.assert_called_once() + msg3.send.assert_called_once() + self.assertEqual(3, msg1.last_send_attempt) + self.assertEqual(0, msg2.last_send_attempt) + self.assertEqual(0, msg3.last_send_attempt) + + msg1.last_send_attempt = 3 + msg1.send.reset_mock() + msg2.last_send_attempt = 3 + msg2.send.reset_mock() + msg3.last_send_attempt = 3 + msg3.send.reset_mock() + + track.restart_delayed(count=2, most_recent=False) + msg1.send.assert_called_once() + msg2.send.assert_called_once() + msg3.send.assert_not_called() + self.assertEqual(0, msg1.last_send_attempt) + self.assertEqual(0, msg2.last_send_attempt) + self.assertEqual(3, msg3.last_send_attempt) From 68e6f5b98619e4bd5480accc5c8961bcd729264a Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 12:09:29 -0500 Subject: [PATCH 22/50] Added unit test for QueryPlugin This patch adds a simple test for the QueryPlugin --- tests/test_plugin.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 48e3c44..fad3999 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -2,9 +2,11 @@ import unittest from unittest import mock import aprsd +from aprsd import messaging from aprsd.fuzzyclock import fuzzy from aprsd.plugins import fortune as fortune_plugin from aprsd.plugins import ping as ping_plugin +from aprsd.plugins import query as query_plugin from aprsd.plugins import time as time_plugin from aprsd.plugins import version as version_plugin @@ -13,7 +15,7 @@ class TestPlugin(unittest.TestCase): def setUp(self): self.fromcall = "KFART" self.ack = 1 - self.config = mock.MagicMock() + self.config = {"ham": {"callsign": self.fromcall}} @mock.patch("shutil.which") def test_fortune_fail(self, mock_which): @@ -39,6 +41,35 @@ class TestPlugin(unittest.TestCase): actual = fortune.run(self.fromcall, message, self.ack) self.assertEqual(expected, actual) + @mock.patch("aprsd.messaging.MsgTrack.flush") + def test_query_flush(self, mock_flush): + message = "?delete" + query = query_plugin.QueryPlugin(self.config) + + expected = "Deleted ALL delayed msgs." + actual = query.run(self.fromcall, message, self.ack) + mock_flush.assert_called_once() + self.assertEqual(expected, actual) + + @mock.patch("aprsd.messaging.MsgTrack.restart_delayed") + def test_query_restart_delayed(self, mock_restart): + track = messaging.MsgTrack() + track.track = {} + message = "?r4" + query = query_plugin.QueryPlugin(self.config) + + expected = "No Delayed Msgs" + actual = query.run(self.fromcall, message, self.ack) + mock_restart.assert_not_called() + self.assertEqual(expected, actual) + mock_restart.reset_mock() + + # add a message + msg = messaging.TextMessage(self.fromcall, "testing", self.ack) + track.add(msg) + actual = query.run(self.fromcall, message, self.ack) + mock_restart.assert_called_once() + @mock.patch("time.localtime") def test_time(self, mock_time): fake_time = mock.MagicMock() From d9141dc2d086f06c228751732fa58edcd1754f22 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Mon, 11 Jan 2021 09:13:37 -0800 Subject: [PATCH 23/50] update query plugin to resend last N messages. syntax: ?rN --- aprsd/plugins/query.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index cd63c7c..26420ac 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -22,6 +22,21 @@ class QueryPlugin(plugin.APRSDPluginBase): searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands if re.search(searchstring, fromcall): + + # resend last N most recent + r = re.search(r"^\?[rR]([0-9]).*", message) + if r is not None: + if len(tracker) > 0: + last_n = r.group(1) + reply = messaging.NULL_MESSAGE + LOG.debug(reply) + tracker.restart_delayed(count=int(last_n)) + else: + reply = "No delayed msgs to resend" + LOG.debug(reply) + return reply + + # resend all r = re.search(r"^\?[rR].*", message) if r is not None: if len(tracker) > 0: @@ -29,7 +44,7 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.debug(reply) tracker.restart_delayed() else: - reply = "No Delayed Msgs" + reply = "No delayed msgs" LOG.debug(reply) return reply From e1a292d8e0b03dbab6e705280decd79d87c6cb07 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Mon, 11 Jan 2021 09:20:25 -0800 Subject: [PATCH 24/50] expect different reply from query plugin --- tests/test_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index fad3999..1ec2622 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -58,7 +58,7 @@ class TestPlugin(unittest.TestCase): message = "?r4" query = query_plugin.QueryPlugin(self.config) - expected = "No Delayed Msgs" + expected = "No delayed msgs to resend" actual = query.run(self.fromcall, message, self.ack) mock_restart.assert_not_called() self.assertEqual(expected, actual) From 5de1b3e305b4afacf417e7cff7a06e067ae16f80 Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 12:43:51 -0500 Subject: [PATCH 25/50] Extend APRS.IS object to change login string This patch copies the aprslib.inet IS object's _send_login() method so we can change the login app identification string. --- aprsd/client.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/aprsd/client.py b/aprsd/client.py index 0f3fa44..fef03b1 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -2,7 +2,10 @@ import logging import select import time +import aprsd import aprslib +from aprslib import is_py3 +from aprslib.exceptions import LoginError LOG = logging.getLogger("APRSD") @@ -120,6 +123,53 @@ class Aprsdis(aprslib.IS): yield line + def _send_login(self): + """ + Sends login string to server + """ + login_str = "user {0} pass {1} vers aprsd {3}{2}\r\n" + login_str = login_str.format( + self.callsign, + self.passwd, + (" filter " + self.filter) if self.filter != "" else "", + aprsd.__version__, + ) + + self.logger.info("Sending login information") + + try: + self._sendall(login_str) + self.sock.settimeout(5) + test = self.sock.recv(len(login_str) + 100) + if is_py3: + test = test.decode("latin-1") + test = test.rstrip() + + self.logger.debug("Server: %s", test) + + _, _, callsign, status, _ = test.split(" ", 4) + + if callsign == "": + raise LoginError("Server responded with empty callsign???") + if callsign != self.callsign: + raise LoginError("Server: %s" % test) + if status != "verified," and self.passwd != "-1": + raise LoginError("Password is incorrect") + + if self.passwd == "-1": + self.logger.info("Login successful (receive only)") + else: + self.logger.info("Login successful") + + except LoginError as e: + self.logger.error(str(e)) + self.close() + raise + except Exception: + self.close() + self.logger.error("Failed to login") + raise LoginError("Failed to login") + def get_client(): cl = Client() From ac4c3d6562b9a6802ae069c21023d4016c146c7d Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 12:43:51 -0500 Subject: [PATCH 26/50] Extend APRS.IS object to change login string This patch copies the aprslib.inet IS object's _send_login() method so we can change the login app identification string. --- aprsd/client.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/aprsd/client.py b/aprsd/client.py index 0f3fa44..57d2683 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -2,7 +2,10 @@ import logging import select import time +import aprsd import aprslib +from aprslib import is_py3 +from aprslib.exceptions import LoginError LOG = logging.getLogger("APRSD") @@ -120,6 +123,53 @@ class Aprsdis(aprslib.IS): yield line + def _send_login(self): + """ + Sends login string to server + """ + login_str = "user {0} pass {1} vers github.com/craigerl/aprsd {3}{2}\r\n" + login_str = login_str.format( + self.callsign, + self.passwd, + (" filter " + self.filter) if self.filter != "" else "", + aprsd.__version__, + ) + + self.logger.info("Sending login information") + + try: + self._sendall(login_str) + self.sock.settimeout(5) + test = self.sock.recv(len(login_str) + 100) + if is_py3: + test = test.decode("latin-1") + test = test.rstrip() + + self.logger.debug("Server: %s", test) + + _, _, callsign, status, _ = test.split(" ", 4) + + if callsign == "": + raise LoginError("Server responded with empty callsign???") + if callsign != self.callsign: + raise LoginError("Server: %s" % test) + if status != "verified," and self.passwd != "-1": + raise LoginError("Password is incorrect") + + if self.passwd == "-1": + self.logger.info("Login successful (receive only)") + else: + self.logger.info("Login successful") + + except LoginError as e: + self.logger.error(str(e)) + self.close() + raise + except Exception: + self.close() + self.logger.error("Failed to login") + raise LoginError("Failed to login") + def get_client(): cl = Client() From 7ab26135c2410422ca17f87efa278049146515da Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 14:13:20 -0500 Subject: [PATCH 27/50] Fixed fortune plugin failures On alpine containers the fortune options aren't all available and we were silently failing. Updated the fortune plugin to capture shell failures. --- aprsd/plugins/fortune.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/aprsd/plugins/fortune.py b/aprsd/plugins/fortune.py index 52e59e1..d66255c 100644 --- a/aprsd/plugins/fortune.py +++ b/aprsd/plugins/fortune.py @@ -24,14 +24,17 @@ class FortunePlugin(plugin.APRSDPluginBase): return reply try: - process = subprocess.Popen( - [fortune_path, "-s", "-n 60"], - stdout=subprocess.PIPE, + cmnd = [fortune_path, "-s", "-n 60"] + command = " ".join(cmnd) + output = subprocess.check_output( + command, + shell=True, + timeout=3, + universal_newlines=True, ) - reply = process.communicate()[0] - reply = reply.decode(errors="ignore").rstrip() - except Exception as ex: - reply = "Fortune command failed '{}'".format(ex) - LOG.error(reply) + except subprocess.CalledProcessError as ex: + reply = "Fortune command failed '{}'".format(ex.output) + else: + reply = output return reply From 94708024da3e5db16dd67ad3582b111f705b1d89 Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 11 Jan 2021 14:29:02 -0500 Subject: [PATCH 28/50] Fixed unit test for fortune plugin --- tests/test_plugin.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 1ec2622..3be42f0 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -26,15 +26,13 @@ class TestPlugin(unittest.TestCase): actual = fortune.run(self.fromcall, message, self.ack) self.assertEqual(expected, actual) - @mock.patch("subprocess.Popen") + @mock.patch("subprocess.check_output") @mock.patch("shutil.which") - def test_fortune_success(self, mock_which, mock_popen): + def test_fortune_success(self, mock_which, mock_output): fortune = fortune_plugin.FortunePlugin(self.config) mock_which.return_value = "/usr/bin/games" - mock_process = mock.MagicMock() - mock_process.communicate.return_value = [b"Funny fortune"] - mock_popen.return_value = mock_process + mock_output.return_value = "Funny fortune" message = "fortune" expected = "Funny fortune" From 3dd23fa2ad1d248c815df4b60915a79bd01a2203 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 09:31:04 -0500 Subject: [PATCH 29/50] Added a fix for failed logins to APRS-IS This patch adds a check for a failed login to ARPS due to LoginError. This accounts for bad accounts or username/password failures. aprsd server will exit immediately upon failed login now. --- aprsd/client.py | 6 ++++++ aprsd/main.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/aprsd/client.py b/aprsd/client.py index 57d2683..81152ec 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -17,6 +17,8 @@ class Client: aprs_client = None config = None + connected = False + def __new__(cls, *args, **kwargs): """This magic turns this into a singleton.""" if cls._instance is None: @@ -55,6 +57,10 @@ class Client: aprs_client.connect() connected = True backoff = 1 + except LoginError as e: + LOG.error("Failed to login to APRS-IS Server '{}'".format(e)) + connected = False + raise e except Exception as e: LOG.error("Unable to connect to APRS-IS server. '{}' ".format(e)) time.sleep(backoff) diff --git a/aprsd/main.py b/aprsd/main.py index 51ab8b2..1b3fb89 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -34,6 +34,7 @@ import time import aprsd from aprsd import client, email, messaging, plugin, threads, utils import aprslib +from aprslib.exceptions import LoginError import click import click_completion import yaml @@ -387,7 +388,11 @@ def server(loglevel, quiet, disable_validation, config_file, flush): # Create the initial PM singleton and Register plugins plugin_manager = plugin.PluginManager(config) plugin_manager.setup_plugins() - client.Client(config) + try: + cl = client.Client(config) + cl.setup_connection() + except LoginError: + sys.exit(-1) # Now load the msgTrack from disk if any if flush: From bdeaf6348a5fa48c4aa65f9c8c4f9bf65d7d7689 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 09:51:36 -0500 Subject: [PATCH 30/50] Added new config for aprs.fi API Key This patch adds the new required aprs.fi api key. This key is used by 2 of the core plugins, locationPlugin and weatherPlugin. You must set the apiKey in the config, or aprsd won't start. --- aprsd/plugins/location.py | 3 ++- aprsd/plugins/weather.py | 5 +++-- aprsd/utils.py | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/aprsd/plugins/location.py b/aprsd/plugins/location.py index be75e34..a2fba84 100644 --- a/aprsd/plugins/location.py +++ b/aprsd/plugins/location.py @@ -21,6 +21,7 @@ class LocationPlugin(plugin.APRSDPluginBase): def command(self, fromcall, message, ack): LOG.info("Location Plugin") # get last location of a callsign, get descriptive name from weather service + api_key = self.config["aprs.fi"]["apiKey"] try: # optional second argument is a callsign to search a = re.search(r"^.*\s+(.*)", message) @@ -33,7 +34,7 @@ class LocationPlugin(plugin.APRSDPluginBase): url = ( "http://api.aprs.fi/api/get?name=" + searchcall - + "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" + + "&what=loc&apikey={}&format=json".format(api_key) ) response = requests.get(url) # aprs_data = json.loads(response.read()) diff --git a/aprsd/plugins/weather.py b/aprsd/plugins/weather.py index 6071c1e..19accc6 100644 --- a/aprsd/plugins/weather.py +++ b/aprsd/plugins/weather.py @@ -16,11 +16,12 @@ class WeatherPlugin(plugin.APRSDPluginBase): def command(self, fromcall, message, ack): LOG.info("Weather Plugin") + api_key = self.config["aprs.fi"]["apiKey"] try: url = ( "http://api.aprs.fi/api/get?" - "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json" - "&name=%s" % fromcall + "&what=loc&apikey={}&format=json" + "&name={}".format(api_key, fromcall) ) response = requests.get(url) # aprs_data = json.loads(response.read()) diff --git a/aprsd/utils.py b/aprsd/utils.py index d8bf573..a690871 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -21,6 +21,7 @@ DEFAULT_CONFIG_DICT = { "port": 14580, "logfile": "/tmp/arsd.log", }, + "aprs.fi": {"apiKey": "set me"}, "shortcuts": { "aa": "5551239999@vtext.com", "cl": "craiglamparter@somedomain.org", @@ -172,6 +173,12 @@ def parse_config(config_file): "callsign", default_fail=DEFAULT_CONFIG_DICT["ham"]["callsign"], ) + check_option( + config, + "aprs.fi", + "apiKey", + default_fail=DEFAULT_CONFIG_DICT["aprs.fi"]["apiKey"], + ) check_option(config, "aprs", "login") check_option(config, "aprs", "password") # check_option(config, "aprs", "host") From 90c4c6c59dbfc773087111c1a6a73e04c9883d23 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 11:18:17 -0500 Subject: [PATCH 31/50] Added send-message login checking and --no-ack This patch adds the login failure checking for the send-message command as well as a new command line option --no-ack. The new option enables sending the message directly to aprs-is servers and then exiting immediately. It doesn't wait for an ack to come back. --- aprsd/main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aprsd/main.py b/aprsd/main.py index 1b3fb89..c35849d 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -226,6 +226,14 @@ def sample_config(): show_envvar=True, help="the APRS-IS password for APRS_LOGIN", ) +@click.option( + "--no-ack", + "-n", + is_flag=True, + show_default=True, + default=False, + help="Don't wait for an ack, just sent it to APRS-IS and bail.", +) @click.argument("tocallsign") @click.argument("command", nargs=-1) def send_message( @@ -234,6 +242,7 @@ def send_message( config_file, aprs_login, aprs_password, + no_ack, tocallsign, command, ): @@ -297,7 +306,11 @@ def send_message( if got_ack and got_response: sys.exit(0) - cl = client.Client(config) + try: + cl = client.Client(config) + cl.setup_connection() + except LoginError: + sys.exit(-1) # Send a message # then we setup a consumer to rx messages @@ -307,6 +320,9 @@ def send_message( msg = messaging.TextMessage(aprs_login, tocallsign, command) msg.send_direct() + if no_ack: + sys.exit(0) + try: # This will register a packet consumer with aprslib # When new packets come in the consumer will process From f022a3e42158ff0d84fc354191ce2088351c7fe6 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 11:26:12 -0500 Subject: [PATCH 32/50] Fixed --quiet option This patch fixes the --quiet option for both send-message and server commands. Don't write anything to STDOUT. --- aprsd/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index c35849d..acc784c 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -249,9 +249,9 @@ def send_message( """Send a message to a callsign via APRS_IS.""" global got_ack, got_response - click.echo("{} {} {} {}".format(aprs_login, aprs_password, tocallsign, command)) - - click.echo("Load config") + if not quiet: + click.echo("{} {} {} {}".format(aprs_login, aprs_password, tocallsign, command)) + click.echo("Load config") config = utils.parse_config(config_file) if not aprs_login: click.echo("Must set --aprs_login or APRS_LOGIN") @@ -382,7 +382,8 @@ def server(loglevel, quiet, disable_validation, config_file, flush): event = threading.Event() signal.signal(signal.SIGINT, signal_handler) - click.echo("Load config") + if not quiet: + click.echo("Load config") config = utils.parse_config(config_file) # Force setting the config to the modules that need it From 54072a2103d9833dd3aadc3b9e200842b2cea7f5 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 14:50:49 -0500 Subject: [PATCH 33/50] Added --raw format for sending messages aprsd send-message --raw "RAW APRS MESSAGE HERE" --- aprsd/main.py | 22 +++++++++++++++------- aprsd/messaging.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index acc784c..ecec1c7 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -234,8 +234,9 @@ def sample_config(): default=False, help="Don't wait for an ack, just sent it to APRS-IS and bail.", ) -@click.argument("tocallsign") -@click.argument("command", nargs=-1) +@click.option("--raw", default=None, help="Send a raw message. Implies --no-ack") +@click.argument("tocallsign", required=False) +@click.argument("command", nargs=-1, required=False) def send_message( loglevel, quiet, @@ -243,15 +244,13 @@ def send_message( aprs_login, aprs_password, no_ack, + raw, tocallsign, command, ): """Send a message to a callsign via APRS_IS.""" global got_ack, got_response - if not quiet: - click.echo("{} {} {} {}".format(aprs_login, aprs_password, tocallsign, command)) - click.echo("Load config") config = utils.parse_config(config_file) if not aprs_login: click.echo("Must set --aprs_login or APRS_LOGIN") @@ -269,7 +268,11 @@ def send_message( LOG.info("APRSD Started version: {}".format(aprsd.__version__)) if type(command) is tuple: command = " ".join(command) - LOG.info("Sending Command '{}'".format(command)) + if not quiet: + if raw: + LOG.info("L'{}' R'{}'".format(aprs_login, raw)) + else: + LOG.info("L'{}' To'{}' C'{}'".format(aprs_login, tocallsign, command)) got_ack = False got_response = False @@ -317,7 +320,12 @@ def send_message( # We should get an ack back as well as a new message # we should bail after we get the ack and send an ack back for the # message - msg = messaging.TextMessage(aprs_login, tocallsign, command) + if raw: + msg = messaging.RawMessage(raw) + msg.send_direct() + sys.exit(0) + else: + msg = messaging.TextMessage(aprs_login, tocallsign, command) msg.send_direct() if no_ack: diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 491ba11..34044c9 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -212,6 +212,46 @@ class Message(metaclass=abc.ABCMeta): pass +class RawMessage(Message): + """Send a raw message. + + This class is used for custom messages that contain the entire + contents of an APRS message in the message field. + + """ + + message = None + + def __init__(self, message): + super().__init__(None, None, msg_id=None) + self.message = message + + def __repr__(self): + return self.message + + def __str__(self): + return self.message + + def send(self): + tracker = MsgTrack() + tracker.add(self) + LOG.debug("Length of MsgTrack is {}".format(len(tracker))) + thread = SendMessageThread(message=self) + thread.start() + + def send_direct(self): + """Send a message without a separate thread.""" + cl = client.get_client() + log_message( + "Sending Message Direct", + repr(self).rstrip("\n"), + self.message, + tocall=self.tocall, + fromcall=self.fromcall, + ) + cl.sendall(repr(self)) + + class TextMessage(Message): """Send regular ARPS text/command messages/replies.""" From 264b7536b431ea17aa86e01342eea80318e1f542 Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Jan 2021 16:17:11 -0500 Subject: [PATCH 34/50] Updated docker run.sh script This updates the run.sh script during container start time to change the env var APRS_PLUGINS to APRSD_PLUGINS --- build/bin/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/bin/run.sh b/build/bin/run.sh index a0d155c..be6b8c6 100755 --- a/build/bin/run.sh +++ b/build/bin/run.sh @@ -5,11 +5,11 @@ export PATH=$PATH:$HOME/.local/bin export VIRTUAL_ENV=$HOME/.venv3 source $VIRTUAL_ENV/bin/activate -if [ ! -z "${APRS_PLUGINS}" ]; then +if [ ! -z "${APRSD_PLUGINS}" ]; then OLDIFS=$IFS IFS=',' - echo "Installing pypi plugins '$APRS_PLUGINS'"; - for plugin in ${APRS_PLUGINS}; do + echo "Installing pypi plugins '$APRSD_PLUGINS'"; + for plugin in ${APRSD_PLUGINS}; do IFS=$OLDIFS # call your procedure/other scripts here below echo "Installing '$plugin'" From cdde9c290b2aaae12c819ced5a103aa252bfbc05 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 12:38:30 -0500 Subject: [PATCH 35/50] Added the ability to add comments to the config file This patch adds a new add_config_comments() function in utils.py that allows you to insert a comment string in a raw_yaml string that's already been created from the yaml.dump() call. --- aprsd/main.py | 2 +- aprsd/utils.py | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index ecec1c7..54ff778 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -190,7 +190,7 @@ def setup_logging(config, loglevel, quiet): @main.command() def sample_config(): """This dumps the config to stdout.""" - click.echo(yaml.dump(utils.DEFAULT_CONFIG_DICT)) + click.echo(utils.add_config_comments(yaml.dump(utils.DEFAULT_CONFIG_DICT))) @main.command() diff --git a/aprsd/utils.py b/aprsd/utils.py index a690871..492faff 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -86,6 +86,37 @@ def mkdir_p(path): raise +def insert_str(string, str_to_insert, index): + return string[:index] + str_to_insert + string[index:] + + +def end_substr(original, substr): + """Get the index of the end of the . + + So you can insert a string after + """ + idx = original.find(substr) + if idx != -1: + idx += len(substr) + return idx + + +def add_config_comments(raw_yaml): + end_idx = end_substr(raw_yaml, "aprs.fi:") + print("PENIS!!!!") + if end_idx != -1: + # lets insert a comment + print("Didn't find shit!") + raw_yaml = insert_str( + raw_yaml, + "\n # Get the apiKey from your aprs.fi account here: http://aprs.fi/account", + end_idx, + ) + print(raw_yaml) + + return raw_yaml + + def create_default_config(): """Create a default config file.""" # make sure the directory location exists @@ -95,7 +126,8 @@ def create_default_config(): click.echo("Config dir '{}' doesn't exist, creating.".format(config_dir)) mkdir_p(config_dir) with open(config_file_expanded, "w+") as cf: - yaml.dump(DEFAULT_CONFIG_DICT, cf) + raw_yaml = yaml.dump(DEFAULT_CONFIG_DICT) + cf.write(add_config_comments(raw_yaml)) def get_config(config_file): From 42b2e227e17a2065963e1c44d966d04a3b29fe3b Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 12:44:58 -0500 Subject: [PATCH 36/50] Fixed comments --- aprsd/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/aprsd/utils.py b/aprsd/utils.py index 492faff..0d8b50a 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -103,10 +103,8 @@ def end_substr(original, substr): def add_config_comments(raw_yaml): end_idx = end_substr(raw_yaml, "aprs.fi:") - print("PENIS!!!!") if end_idx != -1: # lets insert a comment - print("Didn't find shit!") raw_yaml = insert_str( raw_yaml, "\n # Get the apiKey from your aprs.fi account here: http://aprs.fi/account", From e11a84bf053485ee0ce7367d5b9715114cd4d8ae Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Thu, 14 Jan 2021 10:41:40 -0800 Subject: [PATCH 37/50] make sample config easier to interpret --- aprsd/utils.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aprsd/utils.py b/aprsd/utils.py index 0d8b50a..2de222b 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -13,13 +13,13 @@ import yaml # an example of what should be in the ~/.aprsd/config.yml DEFAULT_CONFIG_DICT = { - "ham": {"callsign": "KFART"}, + "ham": {"callsign": "CALLSIGN"}, "aprs": { - "login": "someusername", - "password": "somepassword", + "login": "CALLSIGN", + "password": "00000", "host": "rotate.aprs.net", "port": 14580, - "logfile": "/tmp/arsd.log", + "logfile": "/tmp/aprsd.log", }, "aprs.fi": {"apiKey": "set me"}, "shortcuts": { @@ -28,15 +28,15 @@ DEFAULT_CONFIG_DICT = { "wb": "555309@vtext.com", }, "smtp": { - "login": "something", - "password": "some lame password", - "host": "imap.gmail.com", + "login": "SMTP_USERNAME", + "password": "SMTP_PASSWORD", + "host": "smtp.gmail.com", "port": 465, "use_ssl": False, }, "imap": { - "login": "imapuser", - "password": "something here too", + "login": "IMAP_USERNAME", + "password": "IMAP_PASSWORD", "host": "imap.gmail.com", "port": 993, "use_ssl": True, From 18acd64334e0218bdffbc4d10da0b1559f65cf0b Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 13:43:10 -0500 Subject: [PATCH 38/50] fixed sample-config double print --- aprsd/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/aprsd/utils.py b/aprsd/utils.py index 2de222b..5cbaec4 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -110,7 +110,6 @@ def add_config_comments(raw_yaml): "\n # Get the apiKey from your aprs.fi account here: http://aprs.fi/account", end_idx, ) - print(raw_yaml) return raw_yaml From 7e3b95fd01628c3e7bb50536193f86cd6c4f1b23 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Thu, 14 Jan 2021 10:51:00 -0800 Subject: [PATCH 39/50] get rid of some debug noise from tracker and email delay --- aprsd/email.py | 2 +- aprsd/main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aprsd/email.py b/aprsd/email.py index de8f8b8..594be63 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -358,7 +358,7 @@ class APRSDEmailThread(threads.APRSDThread): # any send/receive/resend activity will reset this to 60 seconds if check_email_delay < 300: check_email_delay += 1 - LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds") + # LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds") shortcuts = CONFIG["shortcuts"] # swap key/value diff --git a/aprsd/main.py b/aprsd/main.py index 54ff778..33ab376 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -446,7 +446,7 @@ def server(loglevel, quiet, disable_validation, config_file, flush): # to keep the log noise down if cntr % 6 == 0: tracker = messaging.MsgTrack() - LOG.debug("KeepAlive Tracker({}): {}".format(len(tracker), str(tracker))) + # LOG.debug("KeepAlive Tracker({}): {}".format(len(tracker), str(tracker))) cntr += 1 time.sleep(10) From 4ca5c29d49c8a15884f08c6aa21880f45238f97e Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 14:02:02 -0500 Subject: [PATCH 40/50] Fixed latitude reporting in locationPlugin The latitude was always 0, because it was the altitude. --- aprsd/plugins/location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprsd/plugins/location.py b/aprsd/plugins/location.py index a2fba84..031b678 100644 --- a/aprsd/plugins/location.py +++ b/aprsd/plugins/location.py @@ -67,7 +67,7 @@ class LocationPlugin(plugin.APRSDPluginBase): searchcall, wx_data["location"]["areaDescription"], str(altfeet), - str(alt), + str(lat), str(lon), str("%.1f" % round(delta_hours, 1)), ).rstrip() From 0b5c9dacf030dd39e8ee130ecde6a780205d74cd Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Thu, 14 Jan 2021 11:21:26 -0800 Subject: [PATCH 41/50] fix query command syntax ?, ?3, ?d(elete), ?a(ll) --- aprsd/plugins/query.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index 26420ac..ec1238f 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -17,14 +17,14 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.info("Query COMMAND") tracker = messaging.MsgTrack() - reply = "Pending Messages ({})".format(len(tracker)) + reply = "Pending messages ({})".format(len(tracker)) searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands if re.search(searchstring, fromcall): - # resend last N most recent - r = re.search(r"^\?[rR]([0-9]).*", message) + # resend last N most recent: "?3" + r = re.search(r"^\?([0-9]).*", message) if r is not None: if len(tracker) > 0: last_n = r.group(1) @@ -32,25 +32,26 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.debug(reply) tracker.restart_delayed(count=int(last_n)) else: - reply = "No delayed msgs to resend" + reply = "No pending msgs to resend" LOG.debug(reply) return reply - # resend all - r = re.search(r"^\?[rR].*", message) + # resend all: "?a" + r = re.search(r"^\?[aA].*", message) if r is not None: if len(tracker) > 0: reply = messaging.NULL_MESSAGE LOG.debug(reply) tracker.restart_delayed() else: - reply = "No delayed msgs" + reply = "No pending msgs" LOG.debug(reply) return reply + # delete all: "?d" r = re.search(r"^\?[dD].*", message) if r is not None: - reply = "Deleted ALL delayed msgs." + reply = "Deleted ALL pending msgs." LOG.debug(reply) tracker.flush() return reply From e7dc5379009ee0982138881eb82a5de268ef2e02 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Thu, 14 Jan 2021 11:28:59 -0800 Subject: [PATCH 42/50] fix plugin tests to expect new strings --- tests/test_plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 3be42f0..cbe532c 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -44,7 +44,7 @@ class TestPlugin(unittest.TestCase): message = "?delete" query = query_plugin.QueryPlugin(self.config) - expected = "Deleted ALL delayed msgs." + expected = "Deleted ALL pending msgs." actual = query.run(self.fromcall, message, self.ack) mock_flush.assert_called_once() self.assertEqual(expected, actual) @@ -53,10 +53,10 @@ class TestPlugin(unittest.TestCase): def test_query_restart_delayed(self, mock_restart): track = messaging.MsgTrack() track.track = {} - message = "?r4" + message = "?4" query = query_plugin.QueryPlugin(self.config) - expected = "No delayed msgs to resend" + expected = "Pending messages (0)" actual = query.run(self.fromcall, message, self.ack) mock_restart.assert_not_called() self.assertEqual(expected, actual) From 0aa905ebba802e2f8cecc2b9c98caa72edc15a41 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 14:32:30 -0500 Subject: [PATCH 43/50] Changed default log level to INFO Also adjusted some of the logging for main, messaging and threads to be more sane --- aprsd/main.py | 31 +++++++++++++++++++++++++------ aprsd/messaging.py | 3 ++- aprsd/threads.py | 10 +++------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index 33ab376..025206a 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -32,7 +32,7 @@ import time # local imports here import aprsd -from aprsd import client, email, messaging, plugin, threads, utils +from aprsd import client, email, flask, messaging, plugin, threads, utils import aprslib from aprslib.exceptions import LoginError import click @@ -150,7 +150,7 @@ def install(append, case_insensitive, shell, path): click.echo("{} completion installed in {}".format(shell, path)) -def signal_handler(signal, frame): +def signal_handler(sig, frame): global server_vent LOG.info( @@ -158,6 +158,8 @@ def signal_handler(signal, frame): ) threads.APRSDThreadList().stop_all() server_event.set() + time.sleep(1) + signal.signal(signal.SIGTERM, sys.exit(0)) # end signal_handler @@ -350,7 +352,7 @@ def send_message( @main.command() @click.option( "--loglevel", - default="DEBUG", + default="INFO", show_default=True, type=click.Choice( ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"], @@ -383,7 +385,20 @@ def send_message( default=False, help="Flush out all old aged messages on disk.", ) -def server(loglevel, quiet, disable_validation, config_file, flush): +@click.option( + "--stats-server", + is_flag=True, + default=False, + help="Run a stats web server on port 5001?", +) +def server( + loglevel, + quiet, + disable_validation, + config_file, + flush, + stats_server, +): """Start the aprsd server process.""" global event @@ -441,12 +456,16 @@ def server(loglevel, quiet, disable_validation, config_file, flush): messaging.MsgTrack().restart() + if stats_server: + app = flask.init_flask(config) + app.run(host="0.0.0.0", port=5001) + cntr = 0 while not server_event.is_set(): # to keep the log noise down - if cntr % 6 == 0: + if cntr % 12 == 0: tracker = messaging.MsgTrack() - # LOG.debug("KeepAlive Tracker({}): {}".format(len(tracker), str(tracker))) + LOG.debug("KeepAlive Tracker({}): {}".format(len(tracker), str(tracker))) cntr += 1 time.sleep(10) diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 34044c9..a14b7ba 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -39,6 +39,7 @@ class MsgTrack: """ _instance = None + _start_time = None lock = None track = {} @@ -48,6 +49,7 @@ class MsgTrack: if cls._instance is None: cls._instance = super().__new__(cls) cls._instance.track = {} + cls._start_time = datetime.datetime.now() cls._instance.lock = threading.Lock() return cls._instance @@ -235,7 +237,6 @@ class RawMessage(Message): def send(self): tracker = MsgTrack() tracker.add(self) - LOG.debug("Length of MsgTrack is {}".format(len(tracker))) thread = SendMessageThread(message=self) thread.start() diff --git a/aprsd/threads.py b/aprsd/threads.py index 4c61779..dab5b13 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -54,13 +54,13 @@ class APRSDThread(threading.Thread, metaclass=abc.ABCMeta): self.thread_stop = True def run(self): - LOG.info("Starting") + LOG.debug("Starting") while not self.thread_stop: can_loop = self.loop() if not can_loop: self.stop() APRSDThreadList().remove(self) - LOG.info("Exiting") + LOG.debug("Exiting") class APRSDRXThread(APRSDThread): @@ -118,7 +118,6 @@ class APRSDRXThread(APRSDThread): ) tracker = messaging.MsgTrack() tracker.remove(ack_num) - LOG.debug("Length of MsgTrack is {}".format(len(tracker))) return def process_mic_e_packet(self, packet): @@ -127,7 +126,6 @@ class APRSDRXThread(APRSDThread): return def process_message_packet(self, packet): - LOG.info("Got a message packet") fromcall = packet["from"] message = packet.get("message_text", None) @@ -194,9 +192,8 @@ class APRSDRXThread(APRSDThread): def process_packet(self, packet): """Process a packet recieved from aprs-is server.""" - LOG.debug("Process packet! {}".format(self.msg_queues)) try: - LOG.debug("Got message: {}".format(packet)) + LOG.info("Got message: {}".format(packet)) msg = packet.get("message_text", None) msg_format = packet.get("format", None) @@ -228,7 +225,6 @@ class APRSDTXThread(APRSDThread): def loop(self): try: msg = self.msg_queues["tx"].get(timeout=0.1) - LOG.info("TXQ: got message '{}'".format(msg)) msg.send() except queue.Empty: pass From 72fa550250dcaef2c4badfe9aa755464aafcd659 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 14:36:36 -0500 Subject: [PATCH 44/50] Removed flask code --- aprsd/main.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index 025206a..60dd93b 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -32,7 +32,7 @@ import time # local imports here import aprsd -from aprsd import client, email, flask, messaging, plugin, threads, utils +from aprsd import client, email, messaging, plugin, threads, utils import aprslib from aprslib.exceptions import LoginError import click @@ -456,10 +456,6 @@ def server( messaging.MsgTrack().restart() - if stats_server: - app = flask.init_flask(config) - app.run(host="0.0.0.0", port=5001) - cntr = 0 while not server_event.is_set(): # to keep the log noise down From 74be4f853ed4b4e9705445a22ae281614a5d485c Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 14:40:45 -0500 Subject: [PATCH 45/50] Fixed the queryPlugin unit test --- tests/test_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index cbe532c..a6c0c56 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -56,7 +56,7 @@ class TestPlugin(unittest.TestCase): message = "?4" query = query_plugin.QueryPlugin(self.config) - expected = "Pending messages (0)" + expected = "No pending msgs to resend" actual = query.run(self.fromcall, message, self.ack) mock_restart.assert_not_called() self.assertEqual(expected, actual) From 3be373d7fc7f47d3b97f51fd6b95c410bbdf91e1 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Thu, 14 Jan 2021 12:06:57 -0800 Subject: [PATCH 46/50] test plugin expect responses update to match query output --- tests/test_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index cbe532c..a6c0c56 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -56,7 +56,7 @@ class TestPlugin(unittest.TestCase): message = "?4" query = query_plugin.QueryPlugin(self.config) - expected = "Pending messages (0)" + expected = "No pending msgs to resend" actual = query.run(self.fromcall, message, self.ack) mock_restart.assert_not_called() self.assertEqual(expected, actual) From 7486770bdc2e9670bb803ee064d08708ddcc55b7 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Jan 2021 15:44:07 -0500 Subject: [PATCH 47/50] Fixed main server client initialization This fixes the usage of the singleton client class which houses/creates the aprslib client. We were getting multiple logins, now we get one. --- aprsd/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprsd/main.py b/aprsd/main.py index 60dd93b..0f19016 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -430,7 +430,7 @@ def server( plugin_manager.setup_plugins() try: cl = client.Client(config) - cl.setup_connection() + cl.client except LoginError: sys.exit(-1) From d81bfd6fd5b238157eee13809ba7fafae61b7d4d Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 15 Jan 2021 11:12:43 -0500 Subject: [PATCH 48/50] Enabled some emailthread messages and added timestamp This patch re-enables some log.debug messages for email, to ensure we can see emailthread is running correctly. Also adds a timestamp to the query pending messages, so radios don't think it's a duplicate message. --- aprsd/email.py | 7 ++++--- aprsd/plugins/query.py | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/aprsd/email.py b/aprsd/email.py index 594be63..800674a 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -343,6 +343,8 @@ class APRSDEmailThread(threads.APRSDThread): def run(self): global check_email_delay + LOG.debug("Starting") + check_email_delay = 60 past = datetime.datetime.now() while not self.thread_stop: @@ -358,7 +360,7 @@ class APRSDEmailThread(threads.APRSDThread): # any send/receive/resend activity will reset this to 60 seconds if check_email_delay < 300: check_email_delay += 1 - # LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds") + LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds") shortcuts = CONFIG["shortcuts"] # swap key/value @@ -380,7 +382,7 @@ class APRSDEmailThread(threads.APRSDThread): continue messages = server.search(["SINCE", today]) - # LOG.debug("{} messages received today".format(len(messages))) + LOG.debug("{} messages received today".format(len(messages))) for msgid, data in server.fetch(messages, ["ENVELOPE"]).items(): envelope = data[b"ENVELOPE"] @@ -413,7 +415,6 @@ class APRSDEmailThread(threads.APRSDThread): from_addr = shortcuts_inverted[from_addr] reply = "-" + from_addr + " " + body.decode(errors="ignore") - # messaging.send_message(CONFIG["ham"]["callsign"], reply) msg = messaging.TextMessage( self.config["aprs"]["login"], self.config["ham"]["callsign"], diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index ec1238f..70475c8 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -1,3 +1,4 @@ +import datetime import logging import re @@ -17,7 +18,11 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.info("Query COMMAND") tracker = messaging.MsgTrack() - reply = "Pending messages ({})".format(len(tracker)) + now = datetime.datetime.now() + reply = "Pending messages ({}) {}".format( + len(tracker), + now.strftime("%H:%M:%S"), + ) searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands From f538fb26aed62871c31bc47024b3041e2a15bb4a Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Fri, 15 Jan 2021 08:51:12 -0800 Subject: [PATCH 49/50] fix usage statement --- aprsd/threads.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aprsd/threads.py b/aprsd/threads.py index dab5b13..d0081c1 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -166,7 +166,9 @@ class APRSDRXThread(APRSDThread): names = [x.command_name for x in plugins] names.sort() - reply = "Usage: {}".format(", ".join(names)) + # reply = "Usage: {}".format(", ".join(names)) + reply = "Usage: weather, locate [call], time, fortune, ping" + msg = messaging.TextMessage( self.config["aprs"]["login"], fromcall, From 0e9cfdd847aeb87a29e30e2b443cab9d8911442f Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 15 Jan 2021 12:06:09 -0500 Subject: [PATCH 50/50] Fix tox tests. --- aprsd/threads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aprsd/threads.py b/aprsd/threads.py index d0081c1..d962aa0 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -168,7 +168,7 @@ class APRSDRXThread(APRSDThread): # reply = "Usage: {}".format(", ".join(names)) reply = "Usage: weather, locate [call], time, fortune, ping" - + msg = messaging.TextMessage( self.config["aprs"]["login"], fromcall,