Plugins throw events & priority


I want to play a sound if the quickdic plugin has found a password.
before I copy the plugin and change it for me:

is there a way for quickdic to throw an event “on_cracked”, which i receive in my sound plugin?

and a “priority” config value for plugins would be nice, so you can set the order in which the plugins receive events in the config.
default priority=0, can be configured lower (negative) for execute last and higher for execute first.

would that be easy to implement?


oh that’s a neat idea! … you can already do that, at any point you can propagate a custom even by calling:

plugins.on('cracked', any, argument, you, want, here)

And that’s gonna call on_cracked with those args for any plugin that’s implementing it :+1:


tested with plugin format before plugin classes, but does not work.
no error, but my function in is not called:

def on_cracked(agent, access_point_hostname):"on_cracked() called in sound-plugin!")
    play_my_sound(sys._getframe().f_code.co_name, str(access_point["hostname"]))

def on_handshake(agent, filename, access_point, client_station):
    global plugins
    display = agent._view

    result ='/usr/bin/aircrack-ng '+ filename +' | grep "1 handshake" | awk \'{print $2}\''),shell=True, stdout=subprocess.PIPE)
    result = result.stdout.decode('utf-8').translate({ord(c) :None for c in string.whitespace})
    if not result:"[quickdic] No handshake")
        plugins.on('cracked', access_point)
    else:"[quickdic] Handshake confirmed")
        result2 ='aircrack-ng -w `echo '+OPTIONS['wordlist_folder']+'*.txt | sed \'s/\ /,/g\'` -l '+filename+'.cracked -q -b '+result+' '+filename+' | grep KEY'),shell=True,stdout=subprocess.P
        result2 = result2.stdout.decode('utf-8').strip()"[quickdic] "+result2)
        if result2 != "KEY NOT FOUND":
            key ='\[(.*)\]', result2)
            pwd = str(
            plugins.on('cracked', access_point)

what i do wrong?

idk man you’re using the old format, a lot of that code changed … can you try to update and see if it works with the latest refactor?

ok, i test after updating to MASTER

1 Like

don’t forget to

import pwnagotchi.plugins as plugins

Thats really cool!!

Yes, that was missing. i used the wrong way with “global plugins”

Works now :slight_smile:
i test today with v1.2.1 and make a pr