Updated Writing a module (markdown)

n1nj4sec 2016-01-24 17:42:47 +01:00
parent 651c495816
commit cbddc65172
1 changed files with 6 additions and 6 deletions

@ -12,23 +12,23 @@ def MessageBox(text, title):
``` ```
then, simply create a module to load our package and call the function remotely then, simply create a module to load our package and call the function remotely
```python ```python
from pupylib.PupyModule import *
__class_name__="MsgBoxPopup"
@compatibility("windows")
class MsgBoxPopup(PupyModule): class MsgBoxPopup(PupyModule):
""" Pop up a custom message box """ """ Pop up a custom message box """
dependencies=["pupwinutils.msgbox"]
def init_argparse(self): def init_argparse(self):
self.arg_parser = PupyArgumentParser(prog="msgbox", description=self.__doc__) self.arg_parser = PupyArgumentParser(prog="msgbox", description=self.__doc__)
self.arg_parser.add_argument('--title', help='msgbox title') self.arg_parser.add_argument('--title', help='msgbox title')
self.arg_parser.add_argument('text', help='text to print in the msgbox :)') self.arg_parser.add_argument('text', help='text to print in the msgbox :)')
@windows_only
def is_compatible(self):
pass
def run(self, args): def run(self, args):
self.client.load_package("pupwinutils.msgbox")
self.client.conn.modules['pupwinutils.msgbox'].MessageBox(args.text, args.title) self.client.conn.modules['pupwinutils.msgbox'].MessageBox(args.text, args.title)
self.log("message box popped !") self.log("message box popped !")
``` ```
and that's it, we have a fully functional module :) and that's it, we have a fully functional module :)