NSSCTF Round#23 Misc個人專項賽

嘻哈磕碜發表於2024-05-16

畫師

flag為有意義單詞
flag

<mxfile host="app.diagrams.net" modified="2024-04-22T09:08:59.622Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0" etag="MTy_pS9izUer-qoD0v4x" version="24.2.5" type="device">
  <diagram name="第 1 頁" id="zEMwM2VCor-ZNyr7IRSY">
    <mxGraphModel dx="1321" dy="760" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
      <root>
        <mxCell id="0" />
        <mxCell id="1" parent="0" />
        <mxCell id="KFWuwmgogRQ2IQqMv47f-1" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;labelPosition=left;verticalLabelPosition=middle;align=right;verticalAlign=middle;textOpacity=0;strokeColor=#FFFFFF;direction=east;flipV=1;opacity=0;" parent="1" vertex="1">
          <mxGeometry x="540" y="30" width="20" height="180" as="geometry" />
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-2" value="" style="endArrow=none;dashed=1;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="40" y="121" as="sourcePoint" />
            <mxPoint x="120" y="121" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-3" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERone;endFill=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="100" height="100" relative="1" as="geometry">
            <mxPoint x="30" y="50" as="sourcePoint" />
            <mxPoint x="140" y="170" as="targetPoint" />
            <Array as="points">
              <mxPoint x="120" y="170" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-4" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="170" y="160" as="sourcePoint" />
            <mxPoint x="210" y="50" as="targetPoint" />
            <Array as="points">
              <mxPoint x="180" y="50" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-5" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="250" y="100" as="sourcePoint" />
            <mxPoint x="310" y="100" as="targetPoint" />
            <Array as="points">
              <mxPoint x="280" y="160" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-7" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="250" y="161" as="sourcePoint" />
            <mxPoint x="360" y="161" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-8" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="414" y="100" as="sourcePoint" />
            <mxPoint x="464" y="150" as="targetPoint" />
            <Array as="points">
              <mxPoint x="414" y="130" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-9" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="410" y="100" as="sourcePoint" />
            <mxPoint x="460" y="200" as="targetPoint" />
            <Array as="points">
              <mxPoint x="470" y="100" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-10" value="" style="endArrow=none;dashed=1;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="414" y="151" as="sourcePoint" />
            <mxPoint x="460" y="151" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-11" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="630" y="330" as="sourcePoint" />
            <mxPoint x="690" y="330" as="targetPoint" />
            <Array as="points">
              <mxPoint x="660" y="390" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-12" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="640" y="391" as="sourcePoint" />
            <mxPoint x="740" y="391" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-19" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="610" y="140" as="sourcePoint" />
            <mxPoint x="660" y="110" as="targetPoint" />
            <Array as="points">
              <mxPoint x="660" y="120" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-20" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="670" y="140" as="sourcePoint" />
            <mxPoint x="610" y="170" as="targetPoint" />
            <Array as="points">
              <mxPoint x="610" y="140" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-21" value="" style="edgeStyle=segmentEdgeStyle;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="610" y="140" as="sourcePoint" />
            <mxPoint x="670" y="110" as="targetPoint" />
            <Array as="points">
              <mxPoint x="610" y="110" />
              <mxPoint x="610" y="110" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-22" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="210" y="500" as="sourcePoint" />
            <mxPoint x="270" y="565" as="targetPoint" />
            <Array as="points">
              <mxPoint x="230" y="610" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-28" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="470" y="380" as="sourcePoint" />
            <mxPoint x="410" y="330" as="targetPoint" />
            <Array as="points">
              <mxPoint x="440" y="270" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-29" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="470" y="331" as="sourcePoint" />
            <mxPoint x="400" y="331" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-35" value="" style="endArrow=none;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="250" y="371" as="sourcePoint" />
            <mxPoint x="320" y="371" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-36" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="710" y="110" as="sourcePoint" />
            <mxPoint x="770" y="110" as="targetPoint" />
            <Array as="points">
              <mxPoint x="740" y="170" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-37" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="720" y="171" as="sourcePoint" />
            <mxPoint x="820" y="171" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-38" value="" style="curved=1;endArrow=classic;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="50" y="290" as="sourcePoint" />
            <mxPoint x="100" y="340" as="targetPoint" />
            <Array as="points">
              <mxPoint x="100" y="290" />
              <mxPoint x="50" y="340" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-40" value="" style="endArrow=none;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="140" y="330" as="sourcePoint" />
            <mxPoint x="170" y="300" as="targetPoint" />
            <Array as="points" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-41" value="" style="endArrow=classic;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="200" y="380" as="sourcePoint" />
            <mxPoint x="140" y="300" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-50" value="" style="endArrow=none;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="549.5" y="330" as="sourcePoint" />
            <mxPoint x="549.5" y="390" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-55" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="84" y="500" as="sourcePoint" />
            <mxPoint x="134" y="550" as="targetPoint" />
            <Array as="points">
              <mxPoint x="84" y="530" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-56" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="80" y="500" as="sourcePoint" />
            <mxPoint x="130" y="600" as="targetPoint" />
            <Array as="points">
              <mxPoint x="140" y="500" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-57" value="" style="endArrow=none;dashed=1;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="84" y="551" as="sourcePoint" />
            <mxPoint x="130" y="551" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-58" value="" style="edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="350" y="509" as="sourcePoint" />
            <mxPoint x="410" y="509" as="targetPoint" />
            <Array as="points">
              <mxPoint x="380" y="569" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-59" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="360" y="570" as="sourcePoint" />
            <mxPoint x="460" y="570" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-60" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="520" y="579.5" as="sourcePoint" />
            <mxPoint x="550" y="509.5" as="targetPoint" />
            <Array as="points">
              <mxPoint x="550" y="499.5" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-61" value="" style="edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;curved=0;rounded=0;endSize=8;startSize=8;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="550" y="579.5" as="sourcePoint" />
            <mxPoint x="580" y="509.5" as="targetPoint" />
            <Array as="points">
              <mxPoint x="580" y="499.5" />
            </Array>
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-63" value="" style="shape=waypoint;sketch=0;fillStyle=solid;size=6;pointerEvents=1;points=[];fillColor=none;resizable=0;rotatable=0;perimeter=centerPerimeter;snapToPoint=1;textOpacity=0;strokeColor=#FFFFFF;flipV=1;opacity=0;" parent="1" vertex="1">
          <mxGeometry x="540" y="300" width="20" height="20" as="geometry" />
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-64" value="" style="endArrow=classic;html=1;rounded=0;textOpacity=0;strokeColor=#FFFFFF;opacity=0;" parent="1" edge="1">
          <mxGeometry width="50" height="50" relative="1" as="geometry">
            <mxPoint x="520" y="579.5" as="sourcePoint" />
            <mxPoint x="520" y="509.5" as="targetPoint" />
          </mxGeometry>
        </mxCell>
        <mxCell id="KFWuwmgogRQ2IQqMv47f-65" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;flipH=1;labelPosition=right;verticalLabelPosition=middle;align=left;verticalAlign=middle;textOpacity=0;strokeColor=#FFFFFF;direction=east;flipV=1;opacity=0;" parent="1" vertex="1">
          <mxGeometry x="670" y="440" width="20" height="220" as="geometry" />
        </mxCell>
        <mxCell id="wNboY0RjY8ZMtIGdafHw-1" value="" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
          <mxGeometry x="280" y="240" width="120" height="60" as="geometry" />
        </mxCell>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

image-20240428134947291

將透明度改為100%

image-20240502105906861

以為是但是和flag{有點區別

垂直翻轉一下

image-20240502110051668

flag{easy_diagram}

easy_signin1

絕對的misc 由此而生的簽到
教會ctfer們flag的是......

hint: image to 01 然後找一下2.png相對於1.png不同的地方

取黑白為二進位制,對比差異

from PIL import Image

img1 = Image.open("1.png")
img2 = Image.open("2.png")

img1s = ''
img2s = ''

for i in img1.getdata():
    if i == (255,255,255,255):
        img1s += '0'
    else:
        img1s += '1'
for i in img2.getdata():
    if i == (255,255,255,255):
        img2s += '0'
    else:
        img2s += '1'
code = ''
for i in range(len(img1s)):
    if img1s[i] != img2s[i]:
        code += img2s[i]
with open('enc.c','w') as fw:
    for i in range(0,len(code),8):
        fw.write(chr(int(code[i:i+8],2)))

或者

提示說:image to 01 然後找一下2.png相對於1.png不同的地方,一開始以為是異或,結果就是傳統的找出2.png的二進位制和1.png不一樣的地方然後列印

from PIL import Image
import math
import sys

def is_black(pixel):
    # 判斷畫素是否是黑色
    # 如果紅、綠、藍通道的值都很低,則認為是黑色
    return all(value < 10 for value in pixel[:3])


def is_white(pixel):
    # 判斷畫素是否是白色
    # 如果紅、綠、藍通道的值都很高,則認為是白色
    return all(value > 245 for value in pixel[:3])

flag1=""
flag2=""
def scan_image(image_path):
    global flag1
    # 開啟影像檔案
    image = Image.open(image_path)
    # 獲取影像的畫素資料
    pixels = image.load()
    width, height = image.size

    for y in range(height):
        for x in range(width):
            # 獲取畫素的RGB值
            pixel = pixels[x, y]
            # 判斷畫素是黑色還是白色
            if is_black(pixel):
                flag1=flag1+"1"
            elif is_white(pixel):
                flag1=flag1+"0"
            else:
                print("err")
def scan_image2(image_path):
    global flag2
    # 開啟影像檔案
    image = Image.open(image_path)
    # 獲取影像的畫素資料
    pixels = image.load()
    width, height = image.size

    for y in range(height):
        for x in range(width):
            # 獲取畫素的RGB值
            pixel = pixels[x, y]
            # 判斷畫素是黑色還是白色
            if is_black(pixel):
                flag2=flag2+"1"
            elif is_white(pixel):
                flag2=flag2+"0"
            else:
                print("err")
# 呼叫函式掃描影像
scan_image("1.png")

scan_image2("2.png")
for i in range(len(flag1)):
    if flag1[i] != flag2[i]:
        print(flag2[i],end="")

得到

0010001101101001011011100110001101101100011101010110010001100101001111000110001001101001011101000111001100101111011100110111010001100100011000110010101100101011001011100110100000111110000010100111010101110011011010010110111001100111001000000110111001100001011011010110010101110011011100000110000101100011011001010010000001110011011101000110010000111011000010100111001101110100011100100110100101101110011001110010000001101011011001010111100100100000001111010010000000100010001000100011101100100000000010100000101001101001011011100111010000100000011011010110000101101001011011100010100000101001011110110000101000001001011100110111010001110010011010010110111001100111001000000110001101110010011110010111000001110100011011110101111101110100011110000111010000111011000010100000100101100011011010010110111000111110001111100110001101110010011110010111000001110100011011110101111101110100011110000111010000111011001000000000101000001010000010010110011001101111011100100010000000101000011010010110111001110100001000000110100100100000001111010010000000110000001110110010000001101001001000000011110000100000011000110111001001111001011100000111010001101111010111110111010001111000011101000010111001101100011001010110111001100111011101000110100000101000001010010011101100100000001010110010101101101001001010010111101100001010001000000010000000100000001000000010000000100000001000000010000001100011011010000110000101110010001000000110010101101110011000110111001001111001011100000111010001100101011001000101111101110100011110000111010000100000001111010010000001100011011010000110000101110010001010000110001101110010011110010111000001110100011011110101111101110100011110000111010001011011011010010101110100100000010111100010000001101011011001010111100101011011011010010010000000100101001000000110101101100101011110010010111001101100011001010110111001100111011101000110100000101000001010010101110100100000010111100010000001100011011100100111100101110000011101000110111101011111011101000111100001110100010110110010100001101001001000000010101100100000001100010010100100100000001001010010000001100011011100100111100101110000011101000110111101011111011101000111100001110100001011100110110001100101011011100110011101110100011010000010100000101001010111010010100100111011000010100010000000100000001000000010000000100000001000000010000000100000011000110110111101110101011101000010000000111100001111000010000001101001011011100111010000101000011001010110111001100011011100100111100101110000011101000110010101100100010111110111010001111000011101000010100100100000001111000011110000100000001000100010000000100010001110110000101000100000001000000010000000100000011111010010000000100000001000000000101000100000001000000010000000100000011100100110010101110100011101010111001001101110001000000011000000111011000010100111110100001010000010100010111100101111001000000110010101101110011000110111001001111001011100000111010001100101011001000101111101110100011110000111010000110001001000000011110100100000001100010011001000110010001011000011000100110010001101110010110000110001001100010011000100101100001100010011000100110001001011000011100100110110001011000011000100110001001101000010110000110001001100010011010100101100001100010011001000110111001011000011011100110111001011000011100100110000001011000011000100110001001110010010110000111001001100100010110000111000001110010010110000110001001100010011011100101100001100010011001000110110001011000011100000110101001011000011100000110111001011000011000100110001001101110010110000110001001100010011000100101100001100010011000100110001001011000011100000110110001011000011100000110100001011000011000100110010001100100010110000110001001100100011011100101100001100010011000100110001001011000011011100110101001011000011100000110001001011000011100100110111001011000011000100110010001100000010110000111001001101000010110000111001001100110010110000110001001100010011000000101100001110010011100000101100001101100011010100101100001110000011010000101100001100010011001000110111001011000011000100110000001101010010110000110110001110010010110000111000001101110010110000110001001100100011010100101100001110010011100000101100001100010011000000110111001011000011100000110111001011000011011100110000001011000011000100110000001110000010110000110001001100100011011100101100001110000011001100101100001110000011100000101100001100010011000000110101001011000011000100110000001101010010110000111001001110000010110000111001001101010010110000111000001110000010110000110001001100000011001000101100001110010011011000101100001100010011000100111000001011000011000100110000001101000010110000110001001100010011010000001010001011110010111100100000011001000110111001100011011100100111100101110000011101000110010101100100010111110111010001111000011101000010000000111101001000000110011001101100011000010110011101111011011101000110100001101001011100110101111101101001011100110101111101110100011010000110010101011111011001100110000101101011011001010101111101100110011011000110000101100111010111110110000101101110011001000101111101100011011000010110111001011111011110010110111101110101010111110110011001101001011011100110010001011111011101000110100001100101010111110111010001110010011101010110010101011111011001100110110001100001011001110111110100001010001011110010111100100000011001010110111001100011011100100111100101110000011101000110010101100100010111110111010001111000011101000011001000100000001111010010000000110111001101100010110000110001001100100011011100101100001100110011001100101100001101100011001100101100001100010011000000111000001011000011000100110010001101110010110000110001001100010011000000101100001100010011000000110010001011000011000100110010001100000010110000110001001100000011100100101100001100010011001000110100001011000011010100110110001011000011010000110111001011000011000100110001001110000010110000110001001100000011011100101100001100010011001000110101001011000011000100110010001100010010110000110001001100000011010000101100001110010011100000101100001100010011001000110011001011000011000100110000001101100010110000110001001100100011001100101100001101010011011100101100001101000011001000101100001100010011000100110111001011000011000100110010001101100010110000110011001110010010110000110100001110010010110000110001001100000011000100101100001100010011000100110101001011000011000100110000001100110010110000110001001100010011011100101100001100010011000100110111001011000011000100110000001110010010110000110001001100010011011100101100001110010011011000101100001101010011011100101100001101000011011000101100001100010011000000111001001011000011000100110001001101010010110000110001001100010011000000101100001100010011000000110100001011000011000100110000001101010010110000110001001100000011011000101100001100010011001000110011001011000011000100110000001100000010110000110001001100000011010100101100001101000011010000101100001101010011010100101100001100010011000100110100001011000011000100110010001101110010110000110100001101010010110000110110001100000010110000110001001100100011000100101100001100010011001000110010001011000011000100110001001100110010110000110001001100010011000000101100001100010011000000110100001011000011010000111000001011000011010100110011001011000011000100110001001100110010110000110001001100010011011100101100001100110011100100101100001101010011011000101100001100010011001000110101001011000011000100110000001101010010110000110001001100010011010000101100001100010011001000110001001011000011000100110000001100000010110000110001001100000011000100101100001101000011100100101100001101010011100000101100001100010011000000110000001011000011000100110010001101110010110000110101001101110010110000110101001100110010110000110001001100010011100000101100001101010011000000101100001101010011000100101100001100010011000000110110001011000011000100110000001101100010110000110001001100100011010000101100001100110011100000101100001101010011010000101100001100010011001000110111001011000011011000110000001011000011000100110000001110000010110000110001001100000011100100101100001100010011000100110010001011000011000100110001001101000010110000110001001100000011010100101100001100010011100100101100001100010011000100110100001011000011000100110001001100000010110000111001001110000010110000110001001100010011010000101100001100010011000100110101001011000011100000110001001011000011000100110001001101010010110000111000001101010010110000110110001101010010110000111001001110010010110000111000001101010010110000110110001101110010110000110100001101000010110000110011001101100010110000110001001100000011100000101100001100010011000000110010001011000011000100110000001101110010110000111001001100100010110000110011001100010010110000110100001101000010110000111000001110000010110000111000001110000010110000110001001100010011010100101100001101010011010100101100001101000011100000101100001101110011001100101100001110000011011000101100001101100011100000101100001110010011001100101100001100010011000100110010001011000011000100110010001100110010110000110111001110010010110000110001001100100011011100101100001100010011010100101100001101010011000100101100001100010011001000110000001011000011100100110110001011000011000100110010001100010010110000110111001101000010110000110001001100010011010000101100001110010011010000101100001100010011001000110000001011000011100000110010001011000011100100110001001011000011010000110001001011000011010000110100001011000011000100110000001101010010110000111000001100100010110000110111001100010010110000110011001101110010110000110001001100010011000000101100001100100011100000101100001101100011100100101100001110010011011000101100001100010011000000110000001011000011010000110010001011000011001000101100001101110011010100101100001100010011000100111000001011000011000100110010001100100010110000110011001101010010110000110100001110010010110000111000001110010000101000001010

解密會得到一個cpp原始碼

#include<bits/stdc++.h>
using namespace std;
string key = ""; 

int main(){
    string crypto_txt;
    cin>>crypto_txt; 

    for (int i = 0; i < crypto_txt.length(); ++i){
        char encrypted_txt = char(crypto_txt[i] ^ key[i % key.length()] ^ crypto_txt[(i + 1) % crypto_txt.length()]);
        cout << int(encrypted_txt) << " ";
    }   
    return 0;
}

// encrypted_txt1 = 122,127,111,111,96,114,115,127,77,90,119,92,89,117,126,85,87,117,111,111,86,84,122,127,111,75,81,97,120,94,93,110,98,65,84,127,105,69,87,125,98,107,87,70,108,127,83,88,105,105,98,95,88,102,96,118,104,114
// dncrypted_txt = flag{this_is_the_fake_flag_and_can_you_find_the_true_flag}
// encrypted_txt2 = 76,127,33,63,108,127,110,102,120,109,124,56,47,118,107,125,121,104,98,123,106,123,57,42,117,126,39,49,101,115,103,117,117,109,117,96,57,46,109,115,110,104,105,106,123,100,105,44,55,114,127,45,60,121,122,113,110,104,48,53,113,117,39,56,125,105,114,121,100,101,49,58,100,127,57,53,118,50,51,106,106,124,38,54,127,60,108,109,112,114,105,19,114,110,98,114,115,81,115,85,65,99,85,67,44,36,108,102,107,92,31,44,88,88,115,55,48,73,86,68,93,112,123,79,127,15,51,120,96,121,74,114,94,120,82,91,41,44,105,82,71,37,110,28,69,96,100,42,2,75,118,122,35,49,89

給了一個fakeflag的明文和密文,很明顯是要算金鑰

c = [122,127,111,111,96,114,115,127,77,90,119,92,89,117,126,85,87,117,111,111,86,84,122,127,111,75,81,97,120,94,93,110,98,65,84,127,105,69,87,125,98,107,87,70,108,127,83,88,105,105,98,95,88,102,96,118,104,114]
m = 'flag{this_is_the_fake_flag_and_can_you_find_the_true_flag}'
for i in range(len(m)):
    print(chr(ord(m[i])^ord(m[(i+1)%len(m)])^c[i]),end='')
# prisonrealmprisonrealmprisonrealmprisonrealmprisonrealmpri
# key = prisonrealm

拿到金鑰解密即可,推測最後一個字元是},依次還原

key = 'prisonrealm'
enc = [76,127,33,63,108,127,110,102,120,109,124,56,47,118,107,125,121,104,98,123,106,123,57,42,117,126,39,49,101,115,103,117,117,109,117,96,57,46,109,115,110,104,105,106,123,100,105,44,55,114,127,45,60,121,122,113,110,104,48,53,113,117,39,56,125,105,114,121,100,101,49,58,100,127,57,53,118,50,51,106,106,124,38,54,127,60,108,109,112,114,105,19,114,110,98,114,115,81,115,85,65,99,85,67,44,36,108,102,107,92,31,44,88,88,115,55,48,73,86,68,93,112,123,79,127,15,51,120,96,121,74,114,94,120,82,91,41,44,105,82,71,37,110,28,69,96,100,42,2,75,118,122,35,49,89]
# flag[-1] = '}' 即flag[-1] = 125
flag = []
for i in range(len(enc)):
    flag.append(enc[i]^ord(key[i%len(key)]))
t = [0]*len(flag)
t[0] = 125 ^ flag[-1]
t[1:len(flag)] = flag[:-1]
print()
for i in range(len(flag)-1):
    print(chr(t[i]),end='')
    t[i+1] = flag[i]^t[i]
print('}')
# The-absolute-powerhouse,the-resulting-loneliness,the-person-who-teaches-you-to-love-is......NSSCTF{e@sy_s1gnin_0n_th1s_h@ppy_S3nday_@nd_w1sh_y03_hav3_fun!}

easy_signin2

做做misc簽到題來放鬆吧!
相信你一定可以愉快的簽到
flag以NSSCTF{}格式提交

hint: 二進位制異或 pngchunk
hint2: 抽象畫

附件看到兩張圖,先去看一下here_is_your_flag.png,用010打卡發現根本不是png圖片資料,題目給了提示是要異或pngchunk,但是不知道異或什麼,因為我們知道png的是89開始的,所以用現在的第一個位元組去異或89,就可以得到應該要異或的位元組了

image-20240516093546408

>>> print(hex(0xcd^0x89))
0x44

可以看到我們要異或的應該是0x44,所以我們把這個檔案的每一位元組提取出來然後去異或0x44並寫入檔案

image-20240516095435045

image-20240516095509457

image-20240516104523600

得到

here_is_your_flag

透過提示可以看到檢視pngchunk

image-20240516110245852

image-20240516110306386

從這裡開始往下複製,然後新增檔案頭89 50 4e 47 0d 0a 1a 0a即可得到

1

hint2提示抽象畫,可以想到用npiet

去這裡下載:http://www.bertnase.de/npiet/

然後看另一個png,10xbig_to_more_clear.png

用指令碼放大十倍

from PIL import Image

def process_image(input_image_path, output_image_path):
    # 開啟影像
    image = Image.open(input_image_path).convert('L')
    # 獲取影像的畫素資料
    pixels = image.load()
    width, height = image.size

    # 遍歷影像的每個畫素
    for y in range(height):
        for x in range(width):
            # 獲取當前畫素的灰度值
            pixel_value = pixels[x, y]

            # 如果畫素值在10到200之間,將其設定為255
            if 0 < pixel_value < 250:
                pixels[x, y] = 0

    # 儲存修改後的影像
    image.save(output_image_path)

# 輸入和輸出影像的檔案路徑
input_image_path = "10xbig_to_more_clear.png"
output_image_path = "out.png"

# 處理影像
process_image(input_image_path, output_image_path)

out

得到字串di`f{cfd7d1fd1ba254dcfa7f4155cfdadadc}

\npiet-1.3a-win32>npiet.exe -v 1.png
info: verbose set to 1
info: using file 1.png
info: got 495 x 495 pixel with 256 cols
info: codelsize guessed is 15 pixel
? di`f{cfd7d1fd1ba254dcfa7f4155cfdadadc}
f? l? a? g? {? d? g? e? 8? f? 3? h? f? 3? d? a? 4? 5? ? ? cd4? ? ? ? ? ? 14f7af? ? ? ? fc5? d? b5? ? ? dad? d? }? ?

flag{dge8f3hf3da45cd414f7affc5db5dadd}

NSSCTF{dge8f3hf3da45cd414f7affc5db5dadd}

相關文章