fofa批量获取致远oa【py脚本】

首先获取fofa中cookie中的_fofapro_ars_session=
然后填入下面的xxxxx中
然后运行即可

import requests,re
import time
session = "_fofapro_ars_session=xxxxx"
header = {
     
    "Accept":"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01",
    "Accept-Encoding":"gzip, deflate, br",
    "Accept-Language":"zh-CN,zh;q=0.9",
    "Connection":"keep-alive",
    "User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
    "X-CSRF-Token":"6eXMgDXtZPBzNSj3yEXLi5mtZIVyi1VWkuiajQsHGs6reh8ZOx3QHrshqeEiGQxBvLFwLj3oho1CdSZmptbcuw==",
    "X-Requested-With":"XMLHttpRequest",
    "Cookie":session,
}
def write(str):
    with open("ip_list.txt","a") as f:
        f.write(str)
def get_ip(url):
    r = requests.get(url = url,headers = header).text
    r=r.replace('\n','')
    r=r.replace('\\n','')
    r=r.replace('   ','')
    r=r.replace(' ','')
    r=r.replace('\\','')
    ip_=re.compile('')
    tmp_iplist=ip_.findall(r)
    for ip in tmp_iplist:
        if('http:' in ip):
            print(ip)
            write(ip+"\n")
for i in range(1,5):
    get_ip("https://fofa.so/result?full=true&page="+ str(i) +"&qbase64=c2VleW9u")
    time.sleep(10)

你可能感兴趣的:(算法,python,python,url,爬虫,http,https)