服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > 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%
------分隔线----------------------------