御劍後台掃描詳解

一、掃描器概述

御劍後台掃描器是一款專門針對網站後台漏洞掃描的工具,旨在通過掃描目標網站的後台管理頁面,檢測出其中存在的漏洞隱患,幫助站長及時發現並修復漏洞,保障網站的安全。

御劍後台掃描器支持多種掃描方式,包括目錄掃描、文件掃描、參數掃描等方式,其內置的漏洞庫及Payload庫能夠檢測出目前主流的後台漏洞,同時也支持自定義Payload進行掃描。

在使用御劍後台掃描器時,我們需要配置待掃描的目標URL,根據需要選擇合適的掃描方式和Payload庫,然後點擊掃描按鈕即可啟動掃描過程。

二、目錄掃描

目錄掃描是御劍後台掃描器的一種常用掃描方式,該方式通過遞歸訪問目標URL下的所有頁面及子目錄,尋找隱藏的後台管理入口。目錄掃描的優點是能夠快速檢測出所有的後台管理入口,缺點是通常需要耗費較多的時間和資源。

使用御劍後台掃描器進行目錄掃描的示例代碼如下:

import urllib.request
import urllib.parse
import re

class WebScan:
    def __init__(self):
        self.baseurl = ''
        self.directory = []
        self.passfile = ''
        self.opener = ''

    def getbaseurl(self):
        url = input('Please Input The Target URL(Example:http://www.target.com/):')
        self.baseurl = url

    def getdirectory(self):
        with open('directory.txt') as f:
            for line in f:
                self.directory.append(line.strip())

    def getpassfile(self):
        passfile = input('Please Input The Passfile(Example:pass.txt):')
        self.passfile = passfile

    def getopener(self):
        user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36'
        headers = {'User-Agent':user_agent}
        self.opener = urllib.request.build_opener()
        self.opener.addheaders = headers.items()

    def checklogin(self, url):
        data = {'username':'admin', 'password':'admin'}
        data = urllib.parse.urlencode(data).encode('utf-8')
        response = self.opener.open(url, data)
        content = response.read().decode()
        pattern = re.compile(r'Login Failed')
        result = pattern.search(content)
        if result is None:
            return True
        else:
            return False

    def rscan(self):
        for dir in self.directory:
            url = self.baseurl + dir
            try:
                response = self.opener.open(url)
                content = response.read().decode()
                pattern = re.compile(r'Login Page')
                result = pattern.search(content)
                if result is None:
                    print('Directory Not Exists:{0}'.format(url))
                else:
                    print('Trying Login:{0}'.format(url))
                    if self.checklogin(url):
                        print('Login Success:{0}'.format(url))
                        break
                    else:
                        print('Login Failed:{0}'.format(url))
            except Exception as e:
                print(e)
                continue

三、文件掃描

文件掃描是御劍後台掃描器的另一種掃描方式,該方式通過對目標網站整個文件目錄進行掃描,尋找包含特定後台文件名的文件或目錄。文件掃描的優點是能夠快速檢測出已知的後台文件名,缺點是無法檢測出使用自定義後台文件名的情況。

使用御劍後台掃描器進行文件掃描的示例代碼如下:

import requests

class WebScan:
    def __init__(self):
        self.headers = {
            'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36'
        }
        self.baseurl = ''
        self.filelist = ['admin.php', 'admin.asp', 'admin.aspx', 'admin.jhtml']

    def getbaseurl(self):
        url = input('Please Input The Target URL(Example:http://www.target.com/):')
        self.baseurl = url

    def scanfile(self):
        for filename in self.filelist:
            url = self.baseurl + '/' + filename
            response = requests.get(url, headers=self.headers)
            if response.status_code == 200:
                print('Admin Page Found:{0}'.format(url))
            else:
                print('Not Found:{0}'.format(url))

四、參數掃描

參數掃描是御劍後台掃描器的另一種掃描方式,該方式通過對目標網站的所有參數進行掃描,尋找存在注入漏洞的參數。參數掃描的優點是能夠快速檢測出所有的參數注入漏洞,缺點是可能會對目標網站造成較大的負擔。

使用御劍後台掃描器進行參數掃描的示例代碼如下:

import urllib.request
import urllib.parse

class WebScan:
    def __init__(self):
        self.baseurl = ''
        self.payloadlist = []
        self.opener = ''

    def getbaseurl(self):
        url = input('Please Input The Target URL(Example:http://www.target.com/):')
        self.baseurl = url

    def getpayloadlist(self):
        with open('payload.txt') as f:
            for line in f:
                self.payloadlist.append(line.strip())

    def getopener(self):
        user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36'
        headers = {'User-Agent':user_agent}
        self.opener = urllib.request.build_opener()
        self.opener.addheaders = headers.items()

    def checkinject(self, url, param):
        for payload in self.payloadlist:
            data = {param:payload}
            data = urllib.parse.urlencode(data).encode('utf-8')
            newurl = url + '?' + data.decode()
            response = self.opener.open(newurl)
            content = response.read().decode()
            if payload in content:
                print('Inject Success:{0}'.format(newurl))

    def pscan(self):
        response = self.opener.open(self.baseurl)
        content = response.read().decode()
        pattern = re.compile(r'')
        results = pattern.finditer(content)
        for result in results:
            line = result.group()
            pattern = re.compile(r'name="(.*?)"')
            result = pattern.search(line)
            if result is not None:
                param = result.group(1)
                print('Trying Inject:{0}'.format(param))
                self.checkinject(self.baseurl, param)

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/233690.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-11 17:11
下一篇 2024-12-11 17:11

相關推薦

  • Spring調用超時,後台還在運行的解決方法

    本篇文章將從以下幾個方面詳細介紹Spring調用超時,後台還在運行的解決方法: 一、設置超時時間 通過設置超時時間可以確保Spring調用在一定時間內返回結果並結束,避免出現後台還…

    編程 2025-04-27
  • Linux sync詳解

    一、sync概述 sync是Linux中一個非常重要的命令,它可以將文件系統緩存中的內容,強制寫入磁盤中。在執行sync之前,所有的文件系統更新將不會立即寫入磁盤,而是先緩存在內存…

    編程 2025-04-25
  • 神經網絡代碼詳解

    神經網絡作為一種人工智能技術,被廣泛應用於語音識別、圖像識別、自然語言處理等領域。而神經網絡的模型編寫,離不開代碼。本文將從多個方面詳細闡述神經網絡模型編寫的代碼技術。 一、神經網…

    編程 2025-04-25
  • 詳解eclipse設置

    一、安裝與基礎設置 1、下載eclipse並進行安裝。 2、打開eclipse,選擇對應的工作空間路徑。 File -> Switch Workspace -> [選擇…

    編程 2025-04-25
  • Python輸入輸出詳解

    一、文件讀寫 Python中文件的讀寫操作是必不可少的基本技能之一。讀寫文件分別使用open()函數中的’r’和’w’參數,讀取文件…

    編程 2025-04-25
  • MPU6050工作原理詳解

    一、什麼是MPU6050 MPU6050是一種六軸慣性傳感器,能夠同時測量加速度和角速度。它由三個傳感器組成:一個三軸加速度計和一個三軸陀螺儀。這個組合提供了非常精細的姿態解算,其…

    編程 2025-04-25
  • C語言貪吃蛇詳解

    一、數據結構和算法 C語言貪吃蛇主要運用了以下數據結構和算法: 1. 鏈表 typedef struct body { int x; int y; struct body *nex…

    編程 2025-04-25
  • Java BigDecimal 精度詳解

    一、基礎概念 Java BigDecimal 是一個用於高精度計算的類。普通的 double 或 float 類型只能精確表示有限的數字,而對於需要高精度計算的場景,BigDeci…

    編程 2025-04-25
  • Python安裝OS庫詳解

    一、OS簡介 OS庫是Python標準庫的一部分,它提供了跨平台的操作系統功能,使得Python可以進行文件操作、進程管理、環境變量讀取等系統級操作。 OS庫中包含了大量的文件和目…

    編程 2025-04-25
  • Linux修改文件名命令詳解

    在Linux系統中,修改文件名是一個很常見的操作。Linux提供了多種方式來修改文件名,這篇文章將介紹Linux修改文件名的詳細操作。 一、mv命令 mv命令是Linux下的常用命…

    編程 2025-04-25

發表回復

登錄後才能評論