Creating plugin classes

To create a class that'll show up in the menu, the class must meet one of two requirements:

  • Class name starts with PWN (e.g. PWNwifi would work, while just wifi wouldn't)

    • can also just be named Plugin

  • Uses the superclassBasePwnhyvePlugin (from core.plugin)

The functions in your plugin class must also meet one requirement:

  • Must take 1 argument

Example

from core.plugin import BasePwnhyvePlugin

class PWNExample(BasePwnhyvePlugin):
    def myExample(tpil):
        print("hello world")
        return

This is proper code, and it'll work with Pwnhyve.

Although it shows up in the menu and runs with zero errors, it shows no text on the display even though you used a print statement. This is because it's printing to the terminal, not the actual display - that's another function you must use.

What's tpil?

The argument that's passed to the function is actually the display, as a class. This is used to write to the display, clear it, draw images, draw text, shapes, take input, et cetera. It's a simplified version of pillow, but any advanced functions are still accessible.

This is the most important part of any plugin.

tpil is just an abbreviation of tinyPillow, which is the module I made to simplify usage.

These docs may use both tpil and tiny pillow interchangably.

Last updated