当前位置: 首页 > 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.jsqmd.com/news/1066836/

相关文章:

  • 2026渭南金价行情解读黄金回收避坑完整攻略 - 余生黄金回收
  • 通义灵码Quest模式:AI结对编程的端到端任务闭环实践
  • Capistrano部署原理与Ruby环境避坑指南
  • 道路划线厂家避坑指南 主流服务商深度测评 - 速递信息
  • 安卓300万行老工程AI知识库:三层索引+可迭代语义图谱
  • 一文看懂fofa常用语法,告别混淆,精准打击!免责声明
  • 118、PCIE D-state与L-state关系:一次功耗优化引发的深度排查
  • 深度强化学习在无人机路径规划中的应用:多目标优化与SAR任务实践
  • Seata 核心实现剖析:AT 模式、全局锁、事务协调与 SPI 扩展
  • 【Spring Cloud 微服务】——第二章 服务注册与发现和远程调用
  • 微信网页版插件:5分钟实现跨设备免费微信聊天
  • 稠密大模型为何重获青睐:Mistral Medium 3.5架构解析
  • ChatGPT Plus 支付成功后没看到卡密怎么办?订单查询、CDK 状态和未到账排查指南
  • 签证在职证明翻译办理攻略是什么?3种方式对比,选错白花钱! - 慧办好
  • C++课后习题训练记录Day137
  • QMCDecode解密指南:3步解锁QQ音乐加密音频,Mac用户必备的格式转换神器
  • 中国汉堡加盟实操技术分享:模式、扶持与盈利逻辑拆解 - 起跑123
  • NCE外汇:把投教内容做扎实,长期观察者更容易感受到的要点
  • NaviFormer:基于Transformer与深度强化学习的端到端机器人导航规划
  • Proxelar 0.4.5 官方版下载(Windows x64,夸克网盘)
  • 2026成都黄金上门回收哪家强?教你拒绝上门压价、线上套路 - 奢品小当家
  • OpenClaw本地AI工作流部署:PowerShell+Ollama+qwen2.5:7b实战指南
  • 对话式语音虚假信息检测:从声学特征到多模态融合的实战解析
  • 深圳坪山区黄金回收六家门店当天变现到账 - 上门黄金回收
  • LLM驱动的心理健康因果图生成技术解析
  • 猫抓浏览器扩展:智能视频资源捕获工具,让网页视频下载变得简单高效
  • 2026西安黄金回收6家正规门店横向测评,卖黄金避坑完整指南 - 奢侈品回收评测
  • 濮阳卖黄金别乱找!本地靠谱回收门店全盘点,久美回收凭实在流程圈粉本地人 - 行行星
  • 预算规划指南:光学轮廓仪价格与推荐
  • 2026深圳标签印刷厂家:深圳说明书印刷工厂优选 - 栗子测评