From 53b986da36ea4c77cbb75f68c7996e1c17a8d2e7 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 25 Jul 2024 11:06:39 -0700 Subject: [PATCH] RC3 --- README.md | 64 ++++++++++++++++++++------------------------- mesh_bot.py | 2 +- modules/settings.py | 1 + 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index c08662f..90f7a77 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,16 @@ # meshing-around -Random Mesh Scripts for BBS activities for use with Meshtastic nodes +Random Mesh Scripts for Network Testing and BBS Activities for Use with Meshtastic Nodes ![alt text](etc/pong-bot.jpg "Example Use") ## mesh_bot.sh -The feature rich bot, normally requires internet for full functionality. These responder bots will trap keywords like, ping and respond on a DM(direct Message) with, pong! The script will also monitor the group channels for keywords to trap on. You can also `Ping @Data to Echo` as a example for further processing. +The feature-rich bot requires the internet for full functionality. These responder bots will trap keywords like ping and respond to a DM (direct message) with pong! The script will also monitor the group channels for keywords to trap. You can also `Ping @Data to Echo` as an example for further processing. -Along with network testing these this bot has a lot of other features like simple messaging you can leave for another device, when seen it can send the message for you. +Along with network testing, this bot has a lot of other features, like simple mail messaging you can leave for another device, and when that device is seen, it can send the mail as a DM. -The bot also is capable of dual radio/nodes so you can monitor two networks at the same time and send messages to nodes using the `bbspost @nodeNumber #message` function. - -There is a small messageboard to fit in the constraints of Meshtastic for listing bulletin messages with `bbspost $subject #message` - -Store and Fowrward like message replay with `messages` and there is a repeater module for dual radio bots. +The bot is also capable of using dual radio/nodes, so you can monitor two networks at the same time and send messages to nodes using the same `bbspost @nodeNumber #message` function. There is a small messageboard to fit in the constraints of Meshtastic for posting bulletin messages with `bbspost $subject #message'. +Store and forward-like message re-play with `messages`, and there is a repeater module for dual radio bots to cross post messages. - Various solar details for radio propagation - `sun` and `moon` return info on rise and set local time @@ -37,29 +34,28 @@ Store and Fowrward like message replay with `messages` and there is a repeater m - `cmd` returns the list of commands (the help message) ## pong_bot.sh -Stripped down bot, mostly around for archive purposes. The mesh-bot enhanced modules can be disabled by config. +Stripped-down bot, mostly around for archive purposes. The mesh-bot enhanced modules can be disabled by config to disable features. ## Hardware -Project is written in linux on a pi, should work anywhere meshtastic python module will funciton, with any supported meshtastic hardware/firmware. -- Note the pico will not run meshtastic python module (July-2024) - +The project is written in Linux on a Pi and should work anywhere meshtastic Python modules will function with any supported meshtastic hardware or firmware. + - Note that Pico will not run the Meshastic Python module in July 2024. ## Install -- Clone the project with `git clone https://github.com/spudgunman/meshing-around` - - code is under a lot of development so check back often `git pull` -- Copy [`config.template`](config.template) to `config.ini` and edit for your needs +Clone the project with `git clone https://github.com/spudgunman/meshing-around` +code is under a lot of development, so check back often with `git pull` +Copy [`config.template] to `config.ini` and edit for your needs. - Optionally - - `install.sh` will automate optional venv and requirements install - - `launch.sh` will activate and launch the app in the venv if built +- `install.sh` will automate optional venv and requirements installation. +- `launch.sh` will activate and launch the app in the venv if built. - ### Configurations -copy the [`config.template`](config.template) to `config.ini` set the appropriate interface for your method (serial/ble/tcp). +### Configurations +Copy the [`config.template] to `config.ini` and set the appropriate interface for your method (serial/ble/tcp). ``` #config.ini -# type can be serial, tcp, or ble -# port is the serial port to use, commented out will try to auto-detect -# hostname is the IP address of the device to connect to for tcp type +# type can be serial, tcp, or ble. +# port is the serial port to use; commented out will try to auto-detect +# hostname is the IP address of the device to connect to for TCP type # mac is the MAC address of the device to connect to for ble type [interface] @@ -68,21 +64,20 @@ type = serial # hostname = 192.168.0.1 # mac = 00:11:22:33:44:55 -# Additional interface for dual radio support see config.template for more +# Additional interface for dual radio support See config.template for more. [interface2] enabled = False ``` +The following pair of settings determine how to respond: The default action is to not spam the default channel. Setting'respond_by_DM_only'` will force all messages to be sent to DM, which may not be wanted. Setting the value to True will allow responses in the channel for all to see. -The following pair of settings determine how to respond, default action is to not spam the default channel. Setting `respond_by_dm_only` will force all messaged to DM which may not be wanted. Setting the value to True will allow responses in the channel for all to see. - -Setting the Default channel, is the channel which wont be spammed by the bot. It's the public default channel 0 on new Meshtastic firmware. Anti-Spam is hardcoded into the responder to prevent abuse of public channel. +Setting the default channel is the channel that won't be spammed by the bot. It's the public default channel 0 on the new Meshtastic firmware. Anti-Spam is hardcoded into the responder to prevent abuse of the public channel. ``` [general] respond_by_dm_only = True defaultChannel = 0 ``` -Modules can be disabled or enabled +Modules can be disabled or enabled. ``` [bbs] enabled = False @@ -91,9 +86,9 @@ enabled = False DadJokes = False StoreForward = False ``` -The BBS has admin and block lists, see the [`config.template`](config.template) +The BBS has admin and block lists; see the ['config.template']. (config.template) -A repeater function for two different nodes and cross posting messages. The `repeater_channels` is a list of repeater channel(s) which will be consumed and rebroadcasted on the same number channel on the other device/node/interface. Each node should have matching channel numbers. The channel names and PSK do not need to be the same on the nodes. With great power comes great responsibility, danger could be lurking in use of this feature! If you have the two nodes on the same radio configurations, you could create a feedback loop!!! +A repeater function for two different nodes and cross-posting messages. The'repeater_channels` is a list of repeater channel(s) that will be consumed and rebroadcasted on the same number channel on the other device, node, or interface. Each node should have matching channel numbers. The channel names and PSK do not need to be the same on the nodes. With great power comes great responsibility; danger could lurk in the use of this feature! If you have the two nodes in the same radio configuration, you could create a feedback loop!!! ``` # repeater module @@ -121,13 +116,12 @@ pip install dadjokes ``` # Recognition -Used ideas and snippets from other responder bots want to call them out! - - https://github.com/Murturtle/MeshLink - - https://github.com/pdxlocations/Meshtastic-Python-Examples +I used ideas and snippets from other responder bots and want to call them out! +- https://github.com/Murturtle/MeshLink +- https://github.com/pdxlocations/Meshtastic-Python-Examples -GitHub user https://github.com/PiDiBi - - providing looking at test functions and other suggestions like wxc, cpu use and alerting code +GitHub user: https://github.com/PiDiBi +- providing looking at test functions and other suggestions like wxc, CPU use, and alerting code Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas! - diff --git a/mesh_bot.py b/mesh_bot.py index 3f587d8..4802b6a 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -247,7 +247,7 @@ def onReceive(packet, interface): send_message(auto_response(message_string, snr, rssi, hop, message_from_id, channel_number, rxNode), channel_number, message_from_id, rxNode) else: # or respond to channel message on the channel itself - if channel_number == publicChannel: + if channel_number == publicChannel and antiSpam: # warning user spamming default channel print(f"{log_timestamp()} System: Warning spamming default channel not allowed. sending DM to {get_name_from_number(message_from_id, 'long', rxNode)}") diff --git a/modules/settings.py b/modules/settings.py index f8482d3..8f07862 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -11,6 +11,7 @@ msg_history = [] # message history for the store and forward feature bbs_ban_list = [] # list of banned users bbs_admin_list = [] # list of admin users repeater_channels = [] # list of channels to listen on for repeater mode +antiSpam = True # anti-spam feature to prevent flooding public channel # Read the config file, if it does not exist, create basic config file config = configparser.ConfigParser()