ASP.NET Web Forms框架识别

发布于:2025-06-01 ⋅ 阅读:(28) ⋅ 点赞:(0)

ASP.NET 支持三种不同的开发模式:
Web Pages(Web 页面)、MVC(Model View Controller 模型-视图-控制器)、Web Forms(Web 窗体):

Web Pages
单页面模式
MVC
模型-视图-控制器
Web Forms
事件驱动模式

最简单的 ASP.NET 模式。

与 PHP 和经典 ASP 相似。

内置了数据库、视频、图形、社交媒体等模板和帮助器。

MVC 将 Web 应用程序分成 3 个不同的组成部分:

模型负责数据
视图负责显示
控制器负责输入

传统的 ASP.NET 事件驱动开发模式:

带有服务器控件、服务器事件和服务器代码的网页。

ASP.NET 文件扩展名

Web Pages 框架的文件后缀是 .cshtml 、.vbhtml

Web Forms 框架的文件后缀是 .asp、.aspx、.ashx

MVC 框架是直接访问路由接口例如 /Login/index

ihoneyBin.py脚本输出的结果有其他架构的,我们可以通过 Web Forms 框架的文件后缀是 .asp、.aspx、.ashx来筛选 Web Forms 架构的

bandefind.py代码

import requests
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from requests.packages import urllib3
import time

urllib3.disable_warnings()

banner = """
           _
          ( )
           H
           H
          _H_ 
       .-'-.-'-.
      /         \\
     |           |
     |   .-------'._
     |  / /  '.' '. \\
     |  \ \ @   @ / / 
     |   '---------'        
     |    _______|  
     |  .'-+-+-+|  
     |  '.-+-+-+|         kill all IIS
     |    ""\""\"" |
     '-.__   __.-'
          \"""
"""
print(banner)
def extract_base_urls(input_file='result.txt', output_file='bd.txt'):
    with open(input_file, 'r', encoding='utf-8') as file:
        lines = file.readlines()

    base_urls = []
    for line in lines:
        if line.strip():  
            url = line.split()[0] 
            if '/bin.zip' in url:
                base_url = url.split('/bin.zip')[0]
            elif '/bin.rar' in url:
                base_url = url.split('/bin.rar')[0]
            else:
                base_url = url
            base_urls.append(base_url)

    with open(output_file, 'w', encoding='utf-8') as f:
        for url in base_urls:
            f.write(url + '\n')
    
    return base_urls

def is_webforms(url, timeout=10):
    headers = {"User-Agent": "Mozilla/5.0"}
    try:
        response = requests.get(url, headers=headers, timeout=timeout, verify=False)
        response.encoding = response.apparent_encoding
        
        # 检查URL路径中的扩展名
        if any(ext in urlparse(url).path.lower() for ext in ['.aspx', '.ascx', '.ashx']):
            return True
            
        soup = BeautifulSoup(response.text, 'html.parser')
        if (soup.find('input', {'id': '__VIEWSTATE'}) or 
            any(soup.find('input', {'id': el}) for el in ['__EVENTTARGET', '__EVENTARGUMENT', '__EVENTVALIDATION'])):
            return True
            
        for form in soup.find_all('form'):
            if form.get('action', '').lower().endswith('.aspx'):
                return True
                
        return False
    except Exception as e:
        return False

def scan_webforms(urls, delay=0.5):
    for url in urls:
        if not url.startswith(('http://', 'https://')):
            url = 'http://' + url
            
        if is_webforms(url):
            print(url)
        
        time.sleep(delay)

if __name__ == "__main__":
    base_urls = extract_base_urls()
    
    scan_webforms(base_urls)

脚本会自动去处理 ihoneyBin.py 工具输出的 result.txt 文件里的url地址,然后去识别是 Web Forms 框架的

bandefind.bat

@echo off
python bandefind.py
pause


网站公告

今日签到

点亮在社区的每一天
去签到