Giter Site home page Giter Site logo

jessedavids / mqtta Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 13.34 MB

mqtt agent was created to remotely control or get information from computers through the MQTT protocol, using a plugin architecture, which will allow any user to create plugins for the system.

License: Apache License 2.0

Python 99.52% Shell 0.03% PowerShell 0.01% JavaScript 0.19% CSS 0.23% C 0.01% Xonsh 0.01%
mqtt traceroute broker hostname ping python plugin architecture

mqtta's Introduction

MQTT-AGENT

The program plugin-architecture was created to retrieve information from computers via mqtt

The program has been tested on ubuntu 20.04 and the lastest Linux Mint as of 03/17/2021 Windows version github.com/JesseDavids/mqtta-win10

The program comes with free to use plugins

  • report_plugin (reports your system information back to you)
  • hostname_plugin (allows you to change your hostname)
  • ping_plugin (lets you ping a specific IP address)
  • traceroute_plugin (Enjoy traceroute to a website or IP address, in order to use this plugin you need to install traceroute on your computer sudo apt install traceroute.
  • reboot_plugin (Remotely reboot your system)
  • shutdown_plugin (Or shut it down completely)
  • list_plugin (this plugin lists all available computers connected to the broker, when used, all computers return their hostname and ip address) - workstation/list/
With this information, coupled with good management software such as mqtt explorer the possibilities are endless
  • image

INSTRUCTIONS

  • Ensure the mqtt broker, and pip3 is installed before proceeding with these tasks

  • Create a folder in your Documents folder (or wherever) and pull the repo into that folder then cd into it
  • Install any requirements from the requirements.txt file pip3 install -r requirements.txt(My current version of pip is 20.0.2)
  • Open the config file setup.config and edit the broker IP address and file path to save the logs
  • You can run it in two ways, firstly, you can type in the terminal ./main.py and run it like that, or
  • You could run it as a service, to do this i made a .service file with basic configurations called mqtta.service.
  • Open the service file and edit it to your environment with sudo nano mqtta.service, note: User= should be your current user. i.e User=username
  • Save the service file in the /etc/systemd/system/ directory
  • Then run this command systemctl start mqtta.service
  • Refresh daemon with systemctl daemon-reload
  • If you would like the service to start on boot run this command after the above command, systemctl enable mqtta.service
  • Restart the service with, systemctl restart mqtta.service then check the status, systemctl status mqtta.service

After everything is set and configured, let's test it

  • open a terminal and type in mosquitto_sub -h 127.0.0.1 -t "#"

    • (-h) this indicates which host we are connecting to
    • (-t) this is the topic we are subscribing to, and # = hash means everything, so we will receive any message that comes through
  • 3 parameters exist, (n = notice, r = read, w = write)

  • open another terminal and type mosquitto_pub -h 127.0.0.1 -t "workstation/your-hostname/parameter/report/ -m ""

    • expected output:

      • image
    • If you want this to work the IP needs to be your own, or another IP on the same network connected to the mqtt broker

    • (-m) this indicates the message you want to send to that particular topic, some plugins do not need a message as the report_plugin

  • Here is another example mosquitto_pub -h 127.0.0.1 -t "workstation/hostname-or-ip/r/ping/ -m "1.1.1.1 10 0.2"

    • Note the -m (message). IP {space} Count {space} Interval
      • image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.