最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

利用python實(shí)現(xiàn)對(duì)web服務(wù)器的目錄探測(cè)的方法

 更新時(shí)間:2019年02月26日 14:23:12   作者:你好壞  
這篇文章主要介紹了利用python實(shí)現(xiàn)對(duì)web服務(wù)器的目錄探測(cè)的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

一、python

Python是一種解釋型、面向?qū)ο?、?dòng)態(tài)數(shù)據(jù)類型的高級(jí)程序設(shè)計(jì)語(yǔ)言。

python 是一門簡(jiǎn)單易學(xué)的語(yǔ)言,并且功能強(qiáng)大也很靈活,在滲透測(cè)試中的應(yīng)用廣泛,讓我們一起打造屬于自己的滲透測(cè)試工具

二、web服務(wù)器的目錄探測(cè)腳本打造

1、在滲透時(shí)如果能發(fā)現(xiàn)web服務(wù)器中的webshell,滲透是不是就可以變的簡(jiǎn)單一點(diǎn)尼

通常情況下御劍深受大家的喜愛(ài),但是今天在測(cè)試的時(shí)候webshell不知道為什么御劍掃描不到

仔細(xì)查看是webshell有防爬功能,是檢測(cè)User-Agent頭,如果沒(méi)有就回返回一個(gè)自己定義的404頁(yè)面 

 

1、先來(lái)看看工具效果 

2、利用python讀取掃描的目錄字典

def get_url(path):
    with open(path, "r", encoding='ISO-8859-1') as f:
        for url in f.readlines():
            url_list.append(url.strip())
        return url_list

3、利用 python 的 requests 庫(kù)對(duì)web目標(biāo)服務(wù)器進(jìn)行目錄探測(cè)

def Go_scan(url):
  while not queue.empty():
    url_path = queue.get(timeout=1)
    new_url = url + url_path
    res = requests.get(new_url, headers=headers, timeout=5)
    #print(res.status_code)
    status_code = "[" + str(res.status_code) + "]"
    if str(res.status_code) != "404":
      print(get_time(), status_code, new_url)

4、利用 python 的 threading 庫(kù)對(duì)探測(cè)進(jìn)行線程的設(shè)置

def thread(Number,url):
  threadlist = []
  for pwd in url_list:
    queue.put(pwd)
 
  for x in range(Number):
    t = threading.Thread(target=Go_scan, args=(url,))
    threadlist.append(t)
 
  for t in threadlist:
    t.start()

5、利用 python 的 argparse 庫(kù)進(jìn)行對(duì)自己的工具進(jìn)行封裝

def main():
  if len(sys.argv) == 1:
    print_banner()
    exit(1)
 
  parser = argparse.ArgumentParser(
    formatter_class=argparse.RawTextHelpFormatter,
    epilog='''\
use examples:
 python dir_scan.py -u [url]http://www.test.com[/url] -d /root/dir.txt
 python dir_scan.py -u [url]http://www.test.com[/url] -t 30 -d /root/dir.txt
 ''')
  parser.add_argument("-u","--url", help="scan target address", dest='url')
  parser.add_argument("-t","--thread", help="Number of threads", default="20", type=int, dest='thread')
  parser.add_argument("-d","--Dictionaries", help="Dictionary of Blasting Loading", 
    dest="Dictionaries")

總結(jié)

各位大哥有意見(jiàn)或者建議盡管提,文章哪里不對(duì)的話會(huì)改的,小弟定會(huì)虛心學(xué)習(xí)最后附上全部源碼供大佬指教

#!/usr/bin/python
# -*- coding: utf-8 -*-
 
import requests
import threading
import argparse,sys
import time,os
from queue import Queue
 
url_list = []
queue = Queue()
 
headers = {
  'Connection':'keep-alive',
  'Accept':'*/*',
  'Accept-Language': 'zh-CN',
  'User-Agent':'Mozilla/5.0 (Windows NT 6.2; rv:16.0) Gecko/20100101 Firefox/16.0'
}
 
def print_banner():
  banner = r"""
  .___.__      __________________   _____  _______  
 __| _/|__|_______  /  _____/\_  ___ \  / _ \  \   \ 
 / __ | | |\_ __ \ \_____ \ /  \ \/ / /_\ \ /  |  \ 
/ /_/ | | | | | \/ /    \\   \____/  |  \/  |  \
\____ | |__| |__|  /_______ / \______ /\____|__ /\____|__ /
   \/           \/     \/     \/     \/ 
 
[*] Very fast directory scanning tool.
[*] try to use -h or --help show help message
  """
  print(banner)
 
def get_time():
  return '[' + time.strftime("%H:%M:%S", time.localtime()) + '] '
 
def get_url(path):
  with open(path, "r", encoding='ISO-8859-1') as f:
    for url in f.readlines():
      url_list.append(url.strip())
    return url_list
 
 
def Go_scan(url):
  while not queue.empty():
    url_path = queue.get(timeout=1)
    new_url = url + url_path
    res = requests.get(new_url, headers=headers, timeout=5)
    #print(res.status_code)
    status_code = "[" + str(res.status_code) + "]"
    if str(res.status_code) != "404":
      print(get_time(), status_code, new_url)
 
def thread(Number,url):
  threadlist = []
  for pwd in url_list:
    queue.put(pwd)
 
  for x in range(Number):
    t = threading.Thread(target=Go_scan, args=(url,))
    threadlist.append(t)
 
  for t in threadlist:
    t.start()
 
 
def main():
  if len(sys.argv) == 1:
    print_banner()
    exit(1)
 
  parser = argparse.ArgumentParser(
    formatter_class=argparse.RawTextHelpFormatter,
    epilog='''\
use examples:
 python dir_scan.py -u [url]http://www.test.com[/url] -d /root/dir.txt
 python dir_scan.py -u [url]http://www.test.com[/url] -t 30 -d /root/dir.txt
 ''')
  parser.add_argument("-u","--url", help="scan target address", dest='url')
  parser.add_argument("-t","--thread", help="Number of threads", default="20", type=int, dest='thread')
  parser.add_argument("-d","--Dictionaries", help="Dictionary of Blasting Loading", 
    dest="Dictionaries")
  args = parser.parse_args()
  Number =args.thread
  url = args.url
  url_path = args.Dictionaries
  print_banner()
  get_url(url_path)
  print(get_time(), "[INFO] Start scanning----\n")
  time.sleep(2)
  thread(Number,url)
 
if __name__ == '__main__':
  main()

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 利用Python如何將數(shù)據(jù)寫(xiě)到CSV文件中

    利用Python如何將數(shù)據(jù)寫(xiě)到CSV文件中

    在數(shù)據(jù)分析中經(jīng)常需要從csv格式的文件中存取數(shù)據(jù)以及將數(shù)據(jù)寫(xiě)書(shū)到csv文件中。下面這篇文章主要給大家介紹了關(guān)于利用Python如何將數(shù)據(jù)寫(xiě)到CSV文件中的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2018-06-06
  • Linux-ubuntu16.04 Python3.5配置OpenCV3.2的方法

    Linux-ubuntu16.04 Python3.5配置OpenCV3.2的方法

    下面小編就為大家分享一篇Linux-ubuntu16.04 Python3.5配置OpenCV3.2的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-04-04
  • Python實(shí)現(xiàn)笑臉檢測(cè)+人臉口罩檢測(cè)功能

    Python實(shí)現(xiàn)笑臉檢測(cè)+人臉口罩檢測(cè)功能

    這篇文章主要介紹了Python實(shí)現(xiàn)笑臉檢測(cè)+人臉口罩檢測(cè),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-08-08
  • python 將對(duì)象設(shè)置為可迭代的兩種實(shí)現(xiàn)方法

    python 將對(duì)象設(shè)置為可迭代的兩種實(shí)現(xiàn)方法

    今天小編就為大家分享一篇python 將對(duì)象設(shè)置為可迭代的兩種實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-01-01
  • Python深入淺出分析enum枚舉類

    Python深入淺出分析enum枚舉類

    在python中枚舉是一種類(Enum,IntEnum),存放在enum模塊中。枚舉類型可以給一組標(biāo)簽賦予一組特定的值,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-07-07
  • PyQt6中自定義浮點(diǎn)型滑塊類的實(shí)現(xiàn)

    PyQt6中自定義浮點(diǎn)型滑塊類的實(shí)現(xiàn)

    在PyQt6中,滑塊是常用的用戶界面元素之一,用于選擇數(shù)值范圍,本文主要介紹了PyQt6中自定義浮點(diǎn)型滑塊類的實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-03-03
  • pycharm中jupyter的使用圖文教程

    pycharm中jupyter的使用圖文教程

    這篇文章主要介紹了pycharm中jupyter的使用圖文教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-05-05
  • python中format()函數(shù)的簡(jiǎn)單使用教程

    python中format()函數(shù)的簡(jiǎn)單使用教程

    python中format函數(shù)用于字符串的格式化,接下來(lái)通過(guò)本文給大家介紹python中format()函數(shù)的簡(jiǎn)單使用教程,一起看看吧
    2018-03-03
  • python實(shí)現(xiàn)調(diào)用攝像頭并拍照發(fā)郵箱

    python實(shí)現(xiàn)調(diào)用攝像頭并拍照發(fā)郵箱

    這篇文章主要介紹了python實(shí)現(xiàn)調(diào)用攝像頭并拍照發(fā)郵箱的程序,幫助大家更好的理解和學(xué)習(xí)使用python,感興趣的朋友可以了解下
    2021-04-04
  • Python中模塊pymysql查詢結(jié)果后如何獲取字段列表

    Python中模塊pymysql查詢結(jié)果后如何獲取字段列表

    pymsql是Python中操作MySQL的模塊,其使用方法和MySQLdb幾乎相同。下面這篇文章主要給大家介紹了關(guān)于Python中模塊pymysql查詢結(jié)果后如何獲取字段列表的相關(guān)資料,文中介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面來(lái)看看詳細(xì)的介紹。
    2017-06-06

最新評(píng)論

玛多县| 清新县| 湖州市| 贞丰县| 安平县| 荣成市| 雅安市| 都安| 乐都县| 寿宁县| 盐亭县| 平原县| 尚志市| 永平县| 山阴县| 宁乡县| 平泉县| 张家界市| 葵青区| 开封县| 太仆寺旗| 乐业县| 怀来县| 咸阳市| 蓬安县| 东平县| 嘉峪关市| 南阳市| 伽师县| 永丰县| 南郑县| 卓资县| 常宁市| 靖远县| 宁津县| 息烽县| 东丰县| 西充县| 革吉县| 新乡县| 田东县|