指令碼如下
#這是執行的結果-*- coding: utf-8 -*
from lxml import
etree
import
requests
import
time
import
reimport
urllib.request
domain = "
"a = input('
請輸入url:')
b = int(input('
請輸入爬取的頁數:'))
c = int((b-1)*10+1)
for i in range(0,c,10):
d =str(i)
url = str((domain)+ (a)+'
&pn=
'+(d))
headers =
resp = requests.get(url, headers=headers)
text =resp.text
html =etree.html(text)
urllinks = html.xpath("
//div[@class='f13 se_st_footer']//a/@href")
for yuanshu in
urllinks:
if yuanshu.startswith('
'):r =requests.get(yuanshu)
fliter1 = '?'
fliter2 = '
404'
fliter3 = '
shtml
'fliter4 = '
html
'answear1 = fliter1 in
(r.url)
answear2 = fliter2 not
in(r.url)
answear3 = fliter3 not
in(r.url)
answear4 = fliter4 not
in(r.url)
time.sleep(0.1)
if bool(answear1) ==true:
if bool(answear2) ==true:
if bool(answear3) ==true:
if bool(answear4) ==true:
(r.url)
f1 = open("
url.txt
", "
a+", encoding='
utf-8')
f1.write((r.url)+'\n'
) f1.close()
然後我們就可以批量放入sqlmap裡頭了
這是sqlmap的效果,雖然乙個都沒有跑出來,但是只是為了測試,大家也可以加點其他引數
python 獲取 url 網域名稱
獲取 url 網域名稱方法不外乎三種 1.切割 url 字串,把網域名稱單獨拿出來 2.正則匹配 3.借用別人寫好的包 個人推薦第三種哈,要不然冷落了別人不好,畢竟大家都是同行 舉例py2.7環境,py3 可能用法有變 import urlparse host urlparse.urlparse p...
Python 基於Python實現批量建立目錄
基於python實現批量建立目錄 by 授客qq 1033553122 測試環境 python 版本 python 2.7 實踐 usr bin env python coding utf 8 author shouke import os class publictools def init se...
Python獲取apk檔案URL位址
工作中經常需要提取apk檔案的特定url位址,如是想到用python指令碼進行自動處理。需要用到的python基礎知識如下 os.walk 函式宣告 os.walk top,topdown true,nerr r none 1 引數top表示需要遍歷的頂級目錄的路徑。2 引數topdown的預設值是...