Jarvis OJ - class10 -Writeup

Jarvis OJ - class10 -Writeup

转载请注明出处:http://www.cnblogs.com/WangAoBo/p/7552266.html

题目:

Jarivs OJ的一道misc,记录这道题的Writeup主要是想记录解题的脚本

分析:

文件下载后是纯数据,binwalk发现为两段zlib压缩后的数据,其中第2段为default compression,这是信息1;strings查看字符串,发现IHDR, RGB, IDAT等和图像相关的字符,这是信息2

步骤:

  • 分理出class10中的压缩数据

    binwalk -e class10

  • 查看分离后的数据

    由信息1,F4289.zlib为default compression的zlib数据,对其进行解压缩(当然binwalk厉害得很,binwalk -e分离后的F4289已经是解压缩过得数据了)

  • 如上,解压后为29 × 29位的01字符串,再结合信息2,设想生成一张29*29的方形图片,像素点与字符串对应,始0和1对应的像素点分别为不同黑白两种颜色,代码如下

     1 #!/usr/bin/env python
     2 # -*- coding: utf-8 -*-
     3 __Auther__ = 'M4x'
     4 
     5 from PIL import Image
     6 
     7 SIZE = 29
     8 img = Image.new("RGB", (SIZE, SIZE))
     9 with open("./F4289") as f:
    10     str = f.read()
    11     #  print str
    12 
    13 i = 0
    14 for y in xrange(SIZE):
    15     for x in xrange(SIZE):
    16         if str[i] == '0':
    17             img.putpixel([x, y], (0, 0, 0))
    18         else:
    19             img.putpixel([x, y], (255, 255, 255))
    20         i = i + 1
    21 #  img.show()
    22 img.save("img.png")

     

  • 生成了一个二维码,扫码即可拿到flag

     

     

     

posted @ 2017-09-19 15:53  M4x  阅读(1017)  评论(0编辑  收藏  举报