当前位置: 首页 > news >正文

Fourtune_ML_CTF_Challenge

搭建

慢就用我的

Dockerfile

FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir --trusted-host mirrors.aliyun.com \ -i http://mirrors.aliyun.com/pypi/simple/ \ scikit-image requests COPY model.h5 server.py templates/ ./ EXPOSE 8080 CMD ["python", "server.py"]

Server.py

import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' from http.server import HTTPServer, BaseHTTPRequestHandler import ssl import sys import cgi import base64 import numpy as np # from skimage import io from io import BytesIO import requests import keras from PIL import Image import imghdr model = keras.models.load_model('./model.h5') print("Welcome to .....\n") print("""\ █▀▀ █▀█ █░█ █▀█ ▀█▀ █░█ █▄░█ █▀▀ █▀▄▀█ █░░ █▀▀ ▀█▀ █▀▀ █▀▀ █░█ ▄▀█ █░░ █░░ █▀▀ █▄░█ █▀▀ █▀▀ █▀░ █▄█ █▄█ █▀▄ ░█░ █▄█ █░▀█ ██▄ █░▀░█ █▄▄ █▄▄ ░█░ █▀░ █▄▄ █▀█ █▀█ █▄▄ █▄▄ ██▄ █░▀█ █▄█ ██▄ """) print("Created by: Alex Neelankavil Devassy") print("Access http://127.0.0.1 in host systems's browser") print("Press Ctrl+C to quit") with open("templates/AICorp.html","rb") as file: STATIC_HTML_PAGE = file.read() #simple web server class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): forwardedfor = str(self.headers['X-Forwarded-For']) print(f"GET {forwardedfor}") self.send_response(200) self.end_headers() self.wfile.write(STATIC_HTML_PAGE) def do_POST(self): content_length = int(self.headers["Content-Length"]) if int(content_length) > 10000000: print("File too big") self.send_response(500, "File too big") return form = cgi.FieldStorage( fp=self.rfile, headers=self.headers, environ={"REQUEST_METHOD":"POST", "CONTENT_TYPE":self.headers["Content-Type"], }) filename = str(form['file'].filename) forwardedfor = str(self.headers['X-Forwarded-For']) print(f"POST {forwardedfor} File: {filename} - ", end = ".") data = form["file"].file.read() print("Checking image", end = ". ") #print(data) filetype = imghdr.what(file="", h=data) print(filetype) if filetype not in ["png","jpeg","gif"]: print(f"Unsupported media type: {filetype}", end = ". ") self.send_response(415, "Only png, jpg and gif are supported.") return image = np.array(Image.open(BytesIO(data)).convert("L")) processedImage = np.zeros([1, 28, 28, 1]) for yy in range(28): for xx in range(28): processedImage[0][xx][yy][0] = float(image[xx][yy]) / 255 shownDigit = np.argmax(model.predict(processedImage)) self.send_response(200) self.send_header("Content-Type", "application/json") self.end_headers() if shownDigit == 4: response = '{ "text": " Welcome Mr. ' + str(shownDigit) +'tune {++BackPropogation Magic++}"}' else: response = '{ "text": "Access Denied"}' sys.stdout.flush() self.wfile.write(bytes(response,"utf-8")) httpd = HTTPServer(("", 8080), SimpleHTTPRequestHandler) httpd.serve_forever()

攻击流程

样本对抗就好

http://www.cnnetsun.cn/news/2991171.html

相关文章:

  • 【置顶干货】博主介绍,各类系统源码领取途径
  • 凸松弛紧密度分析:割多面体、度量多面体与椭球体的体积比较
  • React Navigation 核心原理与工程实践指南
  • 移动设备远程控制风险剖析与防御实战:从漏洞利用到企业安全管控
  • JavaScript错误处理三界:哪些能catch,哪些必须绕过
  • 听书APP哪个好用?帆书、喜马拉雅、微信读书、番茄畅听适合不同需求
  • Redux在2024:状态契约、RTK Query与现代React分层实践
  • 如何三步快速下载B站高清视频:BilibiliDown完全指南
  • 医疗AI跨平台泛化实战:任务熵与后验集中性提升眼底影像分析鲁棒性
  • 如何让老旧安卓电视流畅播放高清直播?MyTV-Android轻量级解决方案详解
  • WorkBuddy+GLM:开发者私有AI工作流的轻量级操作系统
  • Maven命令三大断点解析:生命周期、参数作用域与执行上下文
  • LinkedIn人才流动分析实战:从数据获取到仪表盘构建
  • NLP技术如何量化评估本地新闻与移民社区需求的匹配度
  • Navicat重置试用期终极指南:macOS用户必备的14天试用期破解方案
  • 【Springboot毕设全套源码+文档】基于vue+springboot高校教师绩效管理系统的设计与实现(丰富项目+远程调试+讲解+定制)
  • Exchange自签名证书深度解析:从核心原理到实战管理
  • Triton GPU编程:用Python编写高性能AI算子的原理与实践
  • 用LoRA微调Qwen2-1.5B实现法律文书摘要生成
  • VLM视觉语言模型实战:从原理到电商图文搜索落地
  • 自动驾驶静态障碍物感知:多传感器融合的工业级实现
  • 多面体苹果皮式展开算法:从阿基米德立体到连续切割路径
  • Claude Opus 4.8实测:为什么‘不偷懒’是技术AI的新基准
  • SAM G51 ADC精度提升:增强分辨率与数字平均模式实战解析
  • 嵌入式开发中SIM模块与智能卡通信:从ATR解析到T=0/T=1协议实战
  • Vanilla JavaScript原生拖拽实现与避坑指南
  • Codex不是网页版ChatGPT:三种开发者级集成方式详解
  • OpenClaw+Kimi K2.5+Moltbook:AI Agent本地调试到云上部署闭环实战
  • 硬件加密锁逆向工程:从MicroDog原理到软件模拟实现
  • Mistral Medium 3.5:从代码补全到自主开发Agent的范式跃迁