美文网首页码农的世界
这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

作者: b4a0155c6514 | 来源:发表于2019-01-14 10:38 被阅读1次
这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

导语

啊,这次我们来个新清脱俗一些的爬虫项目,利用Python查询你的邮箱账号密码是否被泄露。

让我们愉快地开始吧~

开发工具

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">学习Python中有不明白推荐加入交流群
号:960410445
群里有志同道合的小伙伴,互帮互助,
群里有不错的视频学习教程和PDF!
</pre>

Python版本:3.6.4

相关模块:

cfscrape模块;

argparse模块;

lxml模块;

requests模块;

以及一些Python自带的模块。

环境搭建

安装Python并添加到环境变量,pip安装需要的相关模块即可。

先睹为快

py文件运行方式(cmd窗口):

python emailSecurity.py -e email

python emailSecurity.py -f emailsfile

exe文件运行方式(cmd窗口):

emailSecurity.exe -e email

emailSecurity.exe -f emailsfile原理简介

利用两个可以查询邮箱安全性的网站制作的这个小工具,分别是:

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">https://monitor.firefox.com/
</pre>

截图:

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">https://haveibeenpwned.com/
</pre>

截图:

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

火狐那个就是很简单的抓包:

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

email用sha1加密之后post到:

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">https://monitor.firefox.com/scan
</pre>

然后提取返回的结果就可以啦,代码如下:

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

haveibeenpwned那个我直接搜索到了一个接口:

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">https://haveibeenpwned.com/api/breachedaccount/emailaddr
</pre>

原理很简单,get请求这个接口就可以实现邮箱的安全性验证了(emailaddr需要用具体的邮箱地址来代替)。具体实现代码如下:

这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

All Done!

相关文章

网友评论

    本文标题:这个操作几乎无人见过,Python查询邮箱账号密码是否被泄露!

    本文链接:https://www.haomeiwen.com/subject/fpkddqtx.html