基于python的密码管理工具

面对众多账户和密码管理的困扰,作者利用Python开发了一个简单的密码管理工具。该工具支持在Linux上运行,通过初始化、添加、删除、修改和查询操作来管理密码,采用pickle模块存储并使用base64加密确保数据安全。
摘要由CSDN通过智能技术生成

如何记住各种各样的账户名和密码?

这是一个头疼的问题。
现在各种社区,商业网站,客户端app,全都使用 用户名+密码 或 邮箱+密码的登陆方式。当你使用了越来越多的服务,就意味着你要管理越来越多的账户和密码,怎么能把他们都记住呢?因为你也并不是每个网站都经常上,有时候需要了才发现用户名什么的根本就忘记了,这个时候难道还要再重新注册一个账户吗?把用户名和密码全部记下来?万一被别人看到了怎么办?放到手机里随身携带?每次用的时候还要掏出手机来查询,有新的账户再记录上去,你能保证做得到吗?
上周开始学python,发现用它来做一些小工具的开发再好不过了。对性能没有很高的要求,功能逻辑也很清晰简单,所以花了一天时间写了这么一个简单的密码管理工具。
本人是经常在Linux上工作的,比如现在写的博客就是再Ubuntu14.04上写的。用ln命令为这个文件创建一个软连接,放到/usr/bin/下,就相当与一个系统命令了。sudo ln -s /home/xieyuan/Document/python/manage_passwd.py /usr/bin/manpwd
使用方法写到代码中了,如果命令敲错了,会打印出所有的提示。使用起来也很方便。
1. 初始化,使用manpwd new创建一个record文件
2. 添加记录,manpwd add [name],比如你要存qq的账户,[name]就写qq。后面会提示你依次输入username, email, password,如果没有username或email,把其中一个空着就行,如果没有password(怎么 会没有,否则你用这个工具干嘛……)。输入完之后,会使用python的pickle模块将字典record的内容和类型信息都存到文件里,然后用base64模块将文件加密,这样即使被别人看到,也不知道里面是什么内容(加密方式可以换自己的,我这里抛砖引玉)
3. manpwd del [name] 删除一个记录
4. manpwd mod [name] 修改一个记录,如果有空内容会提示确认
5. manpwd qry [name] 查询一个记录
6. manpwd qry 列出所有记录的名字,有可能你忘了你存了哪些账户,使用这条命令可以让你看到你存的,比如qq,linkedin,淘宝等。utf-8编码,所以是支持中文的。
大家来用用看,看看效果怎么样把。欢迎提出更好的办法。
另外win平台上的我还在调试,稍后合并上去。

#!/usr/bin/env python
#-*- coding:utf-8 -*-
#Filename: manage_passwd.py

'''this file can help you manage all of your acounts and passwds 
that are hard to remember. with this tool, you just need to memorize
the name of your website or app account.

Introducton:

1.manpwd is a softlink to this file which has beed made a system command
  in /usr/bin/manpwd

2.the file which contains your password contents are encrypted, so if it
  somehow obtained by anyone, it's hard for them to decrypt it. And before
  that, you can change them.

3.in the following text, [] stands for the content you need to input

Usage:
1.manpwd new --- newly create a record file.

2.manpwd add [name] --- add a record. [name] is the website's or app's name.
  if the record files are not created, add action is failed.
  name can't be same with recorded ones, or action os failed.
  "manpwd del" and "manpwd mod" are both suitable

3.manpwd del [name] --- del a record. if [name] is not in record, action failed.

4.manpwd mod [name] --- modify a record.

5.manpwd qry [name] --- query a specified name's information

Record Structure
itemname: ...
username: ...
email:    ...
password: ...
'''

import sys
import pickle
import os
import platform
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值