ToB企服应用市场:ToB评测及商务社交产业平台

标题: 0xGame 2024 [Week 2] 报告哈基米 [打印本页]

作者: 飞不高    时间: 2024-11-5 03:34
标题: 0xGame 2024 [Week 2] 报告哈基米
0xGame 2024 [Week 2] 报告哈基米

新知识:Tupper(塔珀自指公式);Arnold Cat(猫映射)
下载文件是一个png图片,010打开查看
发现是倒着的pk

转一下保存为zip文件,打开后是一个txt文件

有两个地方有提示,一个是十六进制里面的Maybe You Need To Kown Arnold Cat?另有一个是txt里面的Is This Tupper?
去搜一下Tupper是什么
代码急转弯——Tupper(塔珀自指公式)-CSDN博客
其代码运行出来的图片就是公式本身,在txt文件中第一句是倒序,所以我们也将下面的k值进行逆序,下面是在网上找的大佬的代码,应该是有三个算法在里面,我们就用Tupper一个就好了,把k值丢进去跑一下得到图片
  1. ########################################################################
  2. #
  3. #
  4. #                    Tupper’s Self-Referential Formula
  5. #                             Tupper.py
  6. #
  7. #                                MAIN
  8. #
  9. #                 Copyright (C) 2015 Ulrik Hoerlyk Hjort
  10. #
  11. #  Tupper’s Self-Referential Formula is free software;  you can  redistribute it
  12. #  and/or modify it under terms of the  GNU General Public License
  13. #  as published  by the Free Software  Foundation;  either version 2,
  14. #  or (at your option) any later version.
  15. #  Tupper’s Self-Referential Formula is distributed in the hope that it will be
  16. #  useful, but WITHOUT ANY WARRANTY;  without even the  implied warranty
  17. #  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. #  See the GNU General Public License for  more details.
  19. #  You should have  received  a copy of the GNU General
  20. #  Public License  distributed with Yolk.  If not, write  to  the  Free
  21. #  Software Foundation,  51  Franklin  Street,  Fifth  Floor, Boston,
  22. #  MA 02110 - 1301, USA.
  23. ########################################################################
  24. from PIL import Image
  25. # Tupper
  26. k1=9489414856877039590479997730148554425666925984049232945604842888420596111937489062065081199094002132087091572191187170308560128611026043144427876131133135794969867759108490917632153891963456295991713868378392769549376070709924497237322046334486274987407067993824142187115870972520417207510521083293280152434558803258138899515603807505064799735152359900010019631133734298562293682916239050320580346316026460860919542540955914826806059123630945216006606268974979135253968165822806241305783300650874506602000048154282039485531804337171305656252
  27. # Pacman
  28. # k2=144520248970897582847942537337194567481277782215150702479718813968549088735682987348888251320905766438178883231976923440016667764749242125128995265907053708020473915320841631792025549005418004768657201699730466383394901601374319715520996181145249781945019068359500510657804325640801197867556863142280259694206254096081665642417367403946384170774537427319606443899923010379398938675025786929455234476319291860957618345432248004921728033349419816206749854472038193939738513848960476759782673313437697051994580681869819330446336774047268864
  29. # Euler
  30. # k3=2352035939949658122140829649197960929306974813625028263292934781954073595495544614140648457342461564887325223455620804204796011434955111022376601635853210476633318991990462192687999109308209472315419713652238185967518731354596984676698288025582563654632501009155760415054499960
  31. # Assign k1,k2, k3 to k to get desired image
  32. k = k1
  33. width = 106
  34. height = 17
  35. scale = 5
  36. fname = "foo"
  37. image  = Image.new("RGB", (width, height),(255, 255, 255))
  38. for x in range (width):
  39.     for y in range (height):
  40.         if ((k+y)//17//2**(17*int(x)+int(y)%17))%2 > 0.5:
  41.             # Image need to be flipped vertically - therefore y = height-y-1
  42.             image.putpixel((x, height-y-1), (0,0,0))
  43. #scale up image
  44. image = image.resize((width*scale,height*scale))
  45. image.save(fname+".png")
复制代码

看大括号的位置,这应该是flag的后半段
找Arnold Cat是个什么东西
数学中,阿诺德猫映射是一种从环面到自身的混沌映射,以弗拉基米尔·阿诺德的名字定名,他于 20 世纪 60 年代使用猫的图像展示了它的效果,因此得名。该图的一个特点是图像在变换过程中看似随机化,但经过多少步骤后又规复到原始状态。猫的原始图像在变换的第一次迭代中被剪切然后重新包裹。经过几次迭代后,天生的图像看起来相称随机或无序,但经过进一步的迭代后,图像似乎有了进一步的秩序——猫的幽灵般的图像、以重复结构分列的多个较小的副本,甚至是原始图像的颠倒副本——并最终规复到原始图像。
发现最初的图片看起来非常无序,应该是经过了猫映射(https://github.com/zhanxw/cat    github代码)(https://www.jasondavies.com/catmap/ 在线网站)
不知道咋回事网站和代码运行后都得不到原图,看起来还是很无序
卡死在这了
末了看了大佬的wp,太强了,脚本一运行直接出来了,放一下脚本
  1. from PIL import Image
  2. img = Image.open('mijiha.png')
  3. if img.mode == "P":
  4.     img = img.convert("RGB")
  5. assert img.size[0] == img.size[1]
  6. dim = width, height = img.size
  7. st = 1
  8. a = 35
  9. b = 7
  10. for _ in range(st):
  11.     with Image.new(img.mode, dim) as canvas:
  12.         for nx in range(img.size[0]):
  13.             for ny in range(img.size[0]):
  14.                 y = (ny - nx * a) % width
  15.                 x = (nx - y * b) % height
  16.                 canvas.putpixel((y, x), img.getpixel((ny, nx)))
  17. canvas.show()
  18. canvas.save('result.png')
复制代码
得到图片

得到flag前半段,题解
总结:遇到了两个从来没有见过的算法,算是长了见识

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4