题目给了源码

/** main.c* Copyright (C) 2019 hzshang <hzshang15@gmail.com>** Distributed under terms of the MIT license.*/#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const unsigned char* box1 = "\x17\x22\x2b\xcc\x0a\x02\x59\x1c\x10\x13\xe4\xaa\xfc\x3b\xfb\xbd\x3f\x76\x05\xc9\xc2\x25\x2d\xa6\x6e\x08\x75\xad\xf9\x5f\x5a\x46\x9c\xfd\xd1\x7f\x58\xbb\x0b\x4b\xdb\x31\x15\x7a\xd7\x90\x4f\x29\xe0\x69\x33\x36\x62\x54\x07\x38\x5d\x68\xda\xeb\x83\x24\x2e\xc6\x93\x5c\xc3\x9e\xd9\xd0\x74\x91\x06\xf3\xb4\x43\xc7\xb7\x0c\xa9\x63\x3a\xe6\xe8\xa0\x27\x6c\xab\x9b\xf6\x18\xba\x2c\x8b\x82\x1b\x00\xac\x52\x3e\x57\x35\x7b\x49\xb8\xf8\x97\x0d\xbc\x6b\xcb\xd6\xb1\x80\x30\x09\x21\x64\x99\x5b\x37\x40\xbe\xb0\x1e\xf4\x8f\xf5\x79\xa2\x95\x32\x66\x23\x6f\x7e\xe1\xbf\x96\xc4\x7c\xd3\x85\x67\xd8\xa7\x8e\xce\xef\x56\x92\xc8\xe5\xca\x4e\xee\x48\xa3\x44\x01\x42\x4a\x7d\x4d\x60\x1a\xa4\x71\xea\x53\x88\x8a\xa1\x98\xc1\x39\xe7\xe3\xcf\x89\x70\xdc\x11\xb5\x47\x87\x61\xec\x73\xc5\xed\x1d\xa8\x55\xe9\x9f\x03\xd2\x86\xf0\xd5\x28\x65\xf1\x94\x2a\x72\x45\xfa\x20\xdd\x78\x9d\xe2\xae\x19\xc0\xd4\xb2\xb3\xdf\x51\x3d\xb6\xf7\xfe\xde\x14\x84\x12\x6a\x50\x8c\xf2\x4c\xa5\x34\x16\x04\x8d\x26\x0f\x0e\x77\x41\x81\xcd\x1f\x3c\x9a\xff\x2f\x6d\xaf\x5e\xb9";
const unsigned char* box2 = "\x8c\xa1\x9d\xab\x31\xdc\x89\xb5\x6e\x4e\xbe\x54\x75\xdf\xc9\x6b\x70\xe8\x27\x6d\x04\x64\xcb\x67\x46\x1a\xff\x25\x2d\x32\x1d\xe1\x94\x0e\x45\xb3\x69\xb4\xc2\xf8\xc3\x59\x34\x5c\xdd\xa3\x9e\x93\x00\x30\xac\x81\x11\xc1\x57\xb2\x97\x76\xe7\x2e\x02\x55\x96\xcc\x05\x09\xb7\x4b\x56\x4c\xd3\x8a\xf3\x51\xc6\xce\x26\x0b\x7c\x9c\xfa\xfc\x7e\xd6\x8b\xae\x48\xe0\xaa\xa5\x4a\x03\x86\x1c\x44\xf5\xd0\x7f\x15\xd2\xd4\xde\x18\x9f\x68\xee\x37\xaf\x8d\x65\xd7\x95\x66\x61\x2c\x39\xbd\x10\x29\x91\xf9\x28\xbb\x4f\x77\x35\xa4\xfe\x6f\xa7\x5b\xa6\xa2\x43\x72\xed\x24\xfd\xe9\x1b\x2a\x47\x08\x2f\xd8\x2b\xf0\x23\x3b\xd1\x22\xec\xeb\x1e\x33\xa0\xf2\x36\xad\x0f\x7a\x8e\x7b\xa9\xe3\xb8\x14\x19\xb6\x79\x82\x9a\x0a\x53\xda\x0c\xef\x80\x3c\x5f\x3f\xe4\xf6\x17\xc8\x06\x74\x4d\x98\x58\xc4\xea\xba\x5a\x84\x49\x62\x5d\x73\x3d\x60\x07\x90\xdb\x3e\xa8\x6c\x41\xc0\x88\x87\x38\xbf\x78\x1f\xf4\x12\x50\x0d\x01\xe6\xcd\x3a\xd9\x63\xb9\xe2\xbc\x20\x6a\xf1\x9b\x7d\x8f\xb0\xcf\x85\xc7\x52\xc5\x99\x13\x42\x5e\xe5\x40\x21\xf7\x71\xd5\xca\xb1\x92\x16\x83\xfb";
const unsigned char* answer = "64960e4fef03c198961fafc1250e1f25960e4f250371db0ec100960aaf8016e5";
int check(char *key){int length = strlen(key);if(length != strlen(answer)/2)return 0;unsigned char *sbox = malloc(length+1);const unsigned char *boxs[] = {box1,box2};strcpy(sbox,key);for(int j=0;j<sizeof(boxs)/sizeof(char*);j++){for(int i=0;i<length;i++){sbox[i] = boxs[j][sbox[i]];}}char *hex = malloc(2*length+1);for(int i =0;i<length;i++){sprintf(&hex[2*i],"%02x",sbox[i]&0xff);}hex[2*length] = '\x00';printf("%s\n",hex);if(!strcmp(answer,hex))return 1;elsereturn 0;
}
int main(int argc, char *argv[]){char buf[0x30];printf("input your flag:");scanf("%47s",buf);if(check(buf)){printf("Correct!\n");}else{printf("Try again!\n");}return 0;
}

分析了一下,就是用box1,box2将输入替换了两次,求flag就是拿answer反过来求flag

import binascii
box1="\x17\x22\x2b\xcc\x0a\x02\x59\x1c\x10\x13\xe4\xaa\xfc\x3b\xfb\xbd\x3f\x76\x05\xc9\xc2\x25\x2d\xa6\x6e\x08\x75\xad\xf9\x5f\x5a\x46\x9c\xfd\xd1\x7f\x58\xbb\x0b\x4b\xdb\x31\x15\x7a\xd7\x90\x4f\x29\xe0\x69\x33\x36\x62\x54\x07\x38\x5d\x68\xda\xeb\x83\x24\x2e\xc6\x93\x5c\xc3\x9e\xd9\xd0\x74\x91\x06\xf3\xb4\x43\xc7\xb7\x0c\xa9\x63\x3a\xe6\xe8\xa0\x27\x6c\xab\x9b\xf6\x18\xba\x2c\x8b\x82\x1b\x00\xac\x52\x3e\x57\x35\x7b\x49\xb8\xf8\x97\x0d\xbc\x6b\xcb\xd6\xb1\x80\x30\x09\x21\x64\x99\x5b\x37\x40\xbe\xb0\x1e\xf4\x8f\xf5\x79\xa2\x95\x32\x66\x23\x6f\x7e\xe1\xbf\x96\xc4\x7c\xd3\x85\x67\xd8\xa7\x8e\xce\xef\x56\x92\xc8\xe5\xca\x4e\xee\x48\xa3\x44\x01\x42\x4a\x7d\x4d\x60\x1a\xa4\x71\xea\x53\x88\x8a\xa1\x98\xc1\x39\xe7\xe3\xcf\x89\x70\xdc\x11\xb5\x47\x87\x61\xec\x73\xc5\xed\x1d\xa8\x55\xe9\x9f\x03\xd2\x86\xf0\xd5\x28\x65\xf1\x94\x2a\x72\x45\xfa\x20\xdd\x78\x9d\xe2\xae\x19\xc0\xd4\xb2\xb3\xdf\x51\x3d\xb6\xf7\xfe\xde\x14\x84\x12\x6a\x50\x8c\xf2\x4c\xa5\x34\x16\x04\x8d\x26\x0f\x0e\x77\x41\x81\xcd\x1f\x3c\x9a\xff\x2f\x6d\xaf\x5e\xb9"
box2="\x8c\xa1\x9d\xab\x31\xdc\x89\xb5\x6e\x4e\xbe\x54\x75\xdf\xc9\x6b\x70\xe8\x27\x6d\x04\x64\xcb\x67\x46\x1a\xff\x25\x2d\x32\x1d\xe1\x94\x0e\x45\xb3\x69\xb4\xc2\xf8\xc3\x59\x34\x5c\xdd\xa3\x9e\x93\x00\x30\xac\x81\x11\xc1\x57\xb2\x97\x76\xe7\x2e\x02\x55\x96\xcc\x05\x09\xb7\x4b\x56\x4c\xd3\x8a\xf3\x51\xc6\xce\x26\x0b\x7c\x9c\xfa\xfc\x7e\xd6\x8b\xae\x48\xe0\xaa\xa5\x4a\x03\x86\x1c\x44\xf5\xd0\x7f\x15\xd2\xd4\xde\x18\x9f\x68\xee\x37\xaf\x8d\x65\xd7\x95\x66\x61\x2c\x39\xbd\x10\x29\x91\xf9\x28\xbb\x4f\x77\x35\xa4\xfe\x6f\xa7\x5b\xa6\xa2\x43\x72\xed\x24\xfd\xe9\x1b\x2a\x47\x08\x2f\xd8\x2b\xf0\x23\x3b\xd1\x22\xec\xeb\x1e\x33\xa0\xf2\x36\xad\x0f\x7a\x8e\x7b\xa9\xe3\xb8\x14\x19\xb6\x79\x82\x9a\x0a\x53\xda\x0c\xef\x80\x3c\x5f\x3f\xe4\xf6\x17\xc8\x06\x74\x4d\x98\x58\xc4\xea\xba\x5a\x84\x49\x62\x5d\x73\x3d\x60\x07\x90\xdb\x3e\xa8\x6c\x41\xc0\x88\x87\x38\xbf\x78\x1f\xf4\x12\x50\x0d\x01\xe6\xcd\x3a\xd9\x63\xb9\xe2\xbc\x20\x6a\xf1\x9b\x7d\x8f\xb0\xcf\x85\xc7\x52\xc5\x99\x13\x42\x5e\xe5\x40\x21\xf7\x71\xd5\xca\xb1\x92\x16\x83\xfb"
asnwer="64960e4fef03c198961fafc1250e1f25960e4f250371db0ec100960aaf8016e5"
asnwer=binascii.a2b_hex(asnwer)
res=''
print type(box1)
for i in asnwer:res+=chr(box1.index(chr(box2.index(i))))
print res

*ctf box题解相关推荐

  1. PWN random [pwnable.kr]CTF writeup题解系列6

    目录 0x01 题目 0x02 解题思路 0x03 题解 0x01 题目 0x02 解题思路 题目比较简单,直接贴出过程 root@mypwn:/ctf/work/pwnable.kr# ssh ra ...

  2. PWN input [pwnable.kr]CTF writeup题解系列7

    目录 0x01题目 0x02解题思路 0x03题解 0x01题目 0x02解题思路 先连接到服务器看下情况 root@mypwn:/ctf/work/pwnable.kr# ssh input2@pw ...

  3. PWN lotto [pwnable.kr]CTF writeup题解系列10

    目录 0x01题目 0x02解题思路 0x03题解 0x01题目 0x02解题思路 下载文件,检查一下情况 root@mypwn:/ctf/work/pwnable.kr# ssh lotto@pwn ...

  4. PWN uaf [pwnable.kr]CTF writeup题解系列13

    目录 0x01题目 0x02解题思路 0x03题解 0x01题目 0x02解题思路 题目都已经介绍了这是一道Use After Free的题目,那我们就不用多想了,先看看题目主要内容 root@myp ...

  5. 大连海事大学第一届“启航杯”DLMU CTF部分题解

    大连海事大学第一届"启航杯"CTF校园网络安全竞赛 签到题 0. dlmuctf2020 flag{welcome_to_dlmuctf2020} dlmuctf{welcome_ ...

  6. PWN passcode [pwnable.kr]CTF writeup题解系列5

    直接看题目: 连接服务器看看情况: root@mypwn:/ctf/work/pwnable.kr# ssh passcode@pwnable.kr -p2222 passcode@pwnable.k ...

  7. PWN horcruxes [pwnable.kr]CTF writeup题解系列15

    题目内容: 先连接上去看看题目文件,看起来已经说了是一道rop的题目 root@mypwn:/ctf/work/pwnable.kr# ssh horcruxes@pwnable.kr -p2222 ...

  8. buu部分ctf crypto题解

    目录 [AFCTF2018]Morse Alice与Bob MD5 old-fashion Password quoted-printable Rabbit Rsa1 RSA Rsarsa 1 Une ...

  9. UVA1587 盒子 Box 题解

    题意翻译 给定6个矩形的长和宽wi和hi(1<=wi,hi<=10000),判断它们能否构成长方体的六个面. 输入输出样例 Sample Input 1345 2584 2584 683 ...

最新文章

  1. ntohs的一个简单实现(将网络流中用两个字节16进制表示的资源数(如DNS)和长度转换为整形)...
  2. osi七层网络层_OSI层速成课程
  3. 一本可能提升思考水平 10 倍的书
  4. C++ Primer 5th笔记(chap 15 OOP)继承之类型转换
  5. 如何使用动态链接库中的资源
  6. 使用Vant完成DatetimePicker 日期的选择器
  7. Flex 与外部的数据通信(HTTPService,URLLoader和URLRequest)
  8. cie色度图matlab,带你解读 CIE1931色度图
  9. arduino并口屏_Arduino教程 12864绘图功能库的使用(并口通信,仅适用ST7920)
  10. 主题:讲解三层代码讲解--第三课(*****) DATE:2004-05-28
  11. esxcli software vib 命令为 ESXi 5.x/6.x 主机安装补丁程序 (2008939)
  12. sockaddr_in和sockaddr区别
  13. 4-八爪鱼boss直聘信息采集
  14. 每周一篇 文献阅读—pape9 (用于单图像去雾的特征融合注意网络FFA-Net)
  15. 流水账之 QQ农场 (VS) 农民伯伯的农场
  16. 读陈景润之《初等数论》
  17. go1.57安装框架iris12.1遇到的坑及解决
  18. CBGS,百度地图15年的四个字母
  19. java-php-python-ssm员工婚恋交友平台计算机毕业设计
  20. Spring官网下载方式

热门文章

  1. 成功解决model_selection\_search.py:761: DeprecationWarning: The grid_scores_ attribute was deprecated in
  2. OS_FLAG.C(3)
  3. 在Linux上如何安装Oracle数据库
  4. 借助axios的拦截器实现Vue.js中登陆状态校验的思路
  5. content type 介绍
  6. 前端开发浏览器兼容问题
  7. linux软件管理(Vim编辑器使用) ——(七)
  8. 统一的定义导航栏的背景颜色(NavigationController)
  9. 44-当日交易总结。(2014.12.31)
  10. Oracle 用户管理