Desktop app technologies 示例代码链接

本文档提供了关于Windows桌面应用程序技术的全面指南,涵盖了从基本概念到高级主题的广泛内容,帮助开发者深入了解并掌握Windows平台上的应用开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

import requests import hashlib import json import re class WebFingerprinter: def __init__(self, fingerprint_db): self.fingerprint_db = fingerprint_db def get_response(self, url): try: response = requests.get(url, timeout=10, headers={'User-Agent': 'Mozilla/5.0'}) return response except requests.exceptions.RequestException as e: print(f"Request error: {e}") return None def match_fingerprints(self, response): results = [] for fp in self.fingerprint_db: if fp['match_type'] == 'header': header_value = response.headers.get(fp['match_location'], '') if fp['match_rule'] in header_value: results.append(fp['name']) elif fp['match_type'] == 'body': if re.search(fp['match_rule'], response.text): results.append(fp['name']) elif fp['match_type'] == 'file': file_url = response.url.rstrip('/') + fp['match_location'] file_content = requests.get(file_url, timeout=10).content file_md5 = hashlib.md5(file_content).hexdigest() if file_md5 == fp['match_rule']: results.append(fp['name']) return results def fingerprint(self, url): response = self.get_response(url) if response is None: return [] return self.match_fingerprints(response) if __name__ == "__main__": # 指纹数据库 fingerprint_db = [ { "name": "用友-NC-Cloud", "category": "nc", "match_type": "header", "match_location": "Server", "match_rule": "NC-Cloud" }, { "name": "GitLab", "category": "devops", "match_type": "body", "match_location": "<title>", "match_rule": "GitLab" }, { "name": "爱快流控路由", "category": "network", "match_type": "file", "match_location": "/favicon.ico", "match_rule": "md5:123456789abcdef" } ] # 资产列表 assets = [ "http://nc-cloud.com", "http://gitlab.com", "http://ai-quick.com" ] # 指纹识别 fingerprinter = WebFingerprinter(fingerprint_db) for asset in assets: results = fingerprinter.fingerprint(asset) print(f"{asset} - Detected technologies: {results}") 这段代码报错了,报错如下,该如何修改C:\Users\Tong\AppData\Local\Programs\Python\Python312\python.exe C:\Users\Tong\Desktop\python项目\web指纹.py Request error: HTTPConnectionPool(host='nc-cloud.com', port=80): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x000001DC6E2D2B10>, 'Connection to nc-cloud.com timed out. (connect timeout=10)')) http://nc-cloud.com - Detected technologies: [] Request error: HTTPConnectionPool(host='gitlab.com', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001DC6E2D32C0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) http://gitlab.com - Detected technologies: [] Request error: HTTPSConnectionPool(host='www.starbrocoin.com', port=443): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001DC6E300380>, 'Connection to www.starbrocoin.com timed out. (connect timeout=10)')) http://ai-quick.com - Detected technologies: [] 进程已结束,退出代码为 0
07-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值