0

I want to create a XMPP server on my network and then send message to it with python so that this server can restart the target computer on the network , now how can i set up this server and how can i do the rest of the process? tnx

1 Answers1

0

I am not sure in what context you are trying to do this, but XMPP has been used in context outside of usual chat and instant messengers (e.g. load balancers, rpc, ...).

There can be several ways of doing this. One way I can think right now is by using Jabber RPC xep-0009 which says:

This specification defines an XMPP protocol extension for 
transporting XML-RPC encoded requests and responses between two XMPP entities. 
The protocol supports all syntax and semantics of XML-RPC except that 
it uses XMPP instead of HTTP as the underlying transport.

Workflow wise here is how you can make this work:

  1. You will need a jabber server which is up and running say on host-A
  2. You will need to configure a startup service on other hosts in the network (say on host-B, host-C, host-D). This startup service is nothing but a xmpp client daemon which will start in the background whenever host is started.
  3. This xmpp client configured as startup service are special in the sense that they will accept incoming rpc calls (support for XEP-0009) and execute received commands on the host.
  4. Received RPC commands can be synonymous to shutdown, kill -9 xxxx depending upon your specific needs.
  5. Finally, xmpp client on host-C can send one or more commands wrapped inside an stanza to xmpp client running on host-B.

You can use one of the existing python xmpp client library and simply extend their working examples for your use case. You will also need to check details on how to configure startup service depending upon your Operating System (e.g. update-rc.d for ubuntu or sc.exe for windows)

Community
  • 1
  • 1
Abhinav Singh
  • 2,643
  • 1
  • 19
  • 29