Fourtune_ML_CTF_Challenge

发布时间:2026/10/12 10:18:55
Fourtune_ML_CTF_Challenge 搭建慢就用我的DockerfileFROM 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.pyimport 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 systemss browser) print(Press CtrlC 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(fGET {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( fpself.rfile, headersself.headers, environ{REQUEST_METHOD:POST, CONTENT_TYPE:self.headers[Content-Type], }) filename str(form[file].filename) forwardedfor str(self.headers[X-Forwarded-For]) print(fPOST {forwardedfor} File: {filename} - , end .) data form[file].file.read() print(Checking image, end . ) #print(data) filetype imghdr.what(file, hdata) print(filetype) if filetype not in [png,jpeg,gif]: print(fUnsupported 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()攻击流程样本对抗就好

关于本文作者

来自尧图内容编辑团队

尧图内容编辑团队 内容团队

尧图内容编辑团队

本文由尧图网络内容编辑团队执笔。团队由资深项目经理、前端工程师与设计师组成,所有内容均来自亲手交付的真实项目,先讲清问题、再给出可落地的解法。尧图深耕北京网站建设十年,服务过京华建材集团、智造科技等各行业客户,把一线经验沉淀为可复用的行业观察。

  • 十年建站经验,覆盖建材、制造、服务、文创等
  • 项目经理把关选题与事实准确性
  • 工程师与设计师联合撰写专业细节
  • 统一编辑规范,保证文风与排版一致
  • 每月复盘转化数据,迭代选题方向

延伸阅读

相关资讯与近期热门内容

深度阅读推荐

建站决策前值得细读的三篇

网站改版的5个关键决策
2024-08-12

网站改版的5个关键决策

什么时候该改版、改到什么程度、如何避免流量掉光,京华建材集团改版复盘给出答案。

获取专属建站方案

看完文章,把您的行业与预算告诉我们,免费获取一份量身定制的官网建设方案与报价。

立即免费咨询