def import_vault( *args ): h_string = """ import existing vault, in given format ./honey_client -import <master-password> <vault_file> e.g. ./honey_client -import AwesomeS@la vault_file.csv vault file: # domain,username?,password google.com,[email protected],abc234 fb.com,rchatterjee,aadhf;123l """ if len(args)<2: return h_string mp = args[0] vault_fl = args[1] g = lambda l: (l[0],l[-1]) domain_pw_map = dict([ g(a.strip().split()) for a in open(vault_fl) if a[0] != '#']) hv = HoneyVault(VAULT_FILE, mp) hv.add_password(domain_pw_map) y = raw_input(""" Check the following sample decoded passwords and make sure your master password is correct. Otherwise you might accidentally spoile your whole vault. CAREFUL. Ignore if this is the first time you are using this. SAMPLE PASSWORDS: %s Are all of the correct to the best of your knowledge! (y/n)""" % \ ','.join(hv.get_sample_decoding()) ) if y.lower() == 'y': hv.save() print """
def add_pass( *args ): h_string = """ Add password to your vault. It will automatically initialize the vault. If you get some error, just delete the static/vault.db (if you dont have any password) Or download a copy from the server. ./honey_client -addpass <master-password> <domain> <password> e.g. ./honey_client -addpass AwesomeS@la google.com 'FckingAwesome!' """ if len(args)<3: return h_string mp = args[0] domain_pw_map = {get_exact_domain(args[1:2]) : args[2]} hv = HoneyVault(VAULT_FILE, mp) hv.add_password(domain_pw_map) y = raw_input(""" Check the following sample decoded password and make sure your master password is correct. Otherwise you might accidentally spoile your whole vault. CAREFUL. SAMPLE PASSWORDS: ---> %s Are all of the correct to the best of your knowledge! (y/n)""" % \ '\n---> '.join(hv.get_sample_decoding()) ) if y.lower() == 'y': hv.save() return """ Successfully saved your vault. Now when you are sure the update is correct upload the vault to the server. we are not doing automatically because I DONT BELEIVE MYSELF""" else: return "As you wish my lord!"