码迷,mamicode.com
首页 > 编程语言 > 详细

Python搜索猪场某人邮箱密码

时间:2018-01-10 17:03:33      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:代码   else   长度   邮箱   while   image   water   big   input   

今天东哥想用Scorpio Pro 5查一下猪场某人邮箱的密码,发现不太好使。决定自己写个自己用。
代码如下


#!/usr/bin/python
#-*- coding:utf-8 -*-        #输入这一条就可以在Python脚本里面使用汉语注释!此脚本可以直接复制使用;

while True:            #进入死循环
        input = raw_input(‘Please input your username:‘)    #交互式输入用户信息,输入input信息;
        if input == "wendonggongzuoshi":        #如果input等于wendonggongzuoshi则进入此循环(如果用户输入wendonggongzuoshi)
                password = raw_input(‘Please input your pass:‘)    #交互式信息输入,输入password信息;
                p = ‘wendonggongzuoshi‘                  #设置变量P赋值为wendonggongzuoshi
                while password != p:         #如果输入的password 不等于p(wendonggongzuoshi), 则进此入循环
                        password = raw_input(‘Please input your pass again:‘)    #交互式信息输入,输入password信息;
                if password == p:        #如果password等于p(wendonggongzuoshi),则进入此循环
                        print ‘welcome to select system!‘              #输出提示信息;
                        while True:           #进入循环;
                                match = 0     #设置变量match等于0;
                                input = raw_input("Please input the name whom you want to search :")   #交互式信息输入,输入input信息;
                                while not input.strip():   #判断input值是否为空,如果input输出为空,则进入循环;
                                        input = raw_input("Please input the name whom you want to search :")        #交互式信息输入,输入input信息;
                                name_file = file(‘/root/Desktop/126/1.txt‘)     #设置变量name_file,file(‘search_name.txt‘)是调用名为search_name.txt的文档
                                while True:               #进入循环;
                                        line = name_file.readline()           #以行的形式,读取search_name.txt文档信息;
                                        if len(line) == 0:      #当len(name_file.readline() )为0时,表示读完了文件,len(name_file.readline() )为每一行的字符长度,空行的内容为\n也是有两个字符。len为0时进入循环;
                                                 break       #执行到这里跳出循环;
                                        if input in line:    #如果输入的input信息可以匹配到文件的某一行,进入循环;
                                                print ‘Match item: %s‘  %line     #输出匹配到的行信息;
                                                match = 1    #给变量match赋值为1
                                if match == 0 :              #如果match等于0,则进入   ;
                                        print ‘No match item found!‘         #输出提示信息;
        else: print "Sorry ,user  %s not found " %input      #如果输入的用户不是wendonggongzuoshi,则输出信息没有这个用户;

使用方法
1.输入用户名/密码,wendonggongzuoshi/wendonggongzuoshi
技术分享图片
2.测试一下
技术分享图片

3.结果出来
bigthug@126.com taylor

4.关于搜索速度,这次搜索大概占猪场泄露数据库的三分之一,四百万条数据,基本上两秒钟搜索完成。

Python搜索猪场某人邮箱密码

标签:代码   else   长度   邮箱   while   image   water   big   input   

原文地址:http://blog.51cto.com/hackerwang/2059463

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!