34 lines
843 B
Python
34 lines
843 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Notificador XMPP one-shot para zzz.qu3v3d0.tech
|
|
Uso: xmpp-notify.py "mensaje"
|
|
"""
|
|
import sys
|
|
import slixmpp
|
|
import asyncio
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
class NotifyBot(slixmpp.ClientXMPP):
|
|
def __init__(self, msg):
|
|
super().__init__("zzz@librebits.info", "zzz2025")
|
|
self.msg = msg
|
|
self.add_event_handler("session_start", self.start)
|
|
|
|
async def start(self, event):
|
|
self.send_message(mto="jla@librebits.info", mbody=self.msg, mtype="chat")
|
|
await asyncio.sleep(0.5)
|
|
self.disconnect()
|
|
|
|
async def main(msg):
|
|
bot = NotifyBot(msg)
|
|
bot.connect()
|
|
await asyncio.sleep(8)
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
print("Uso: xmpp-notify.py \"mensaje\"")
|
|
sys.exit(1)
|
|
asyncio.run(main(sys.argv[1]))
|