avatar

目录
De1CTF2019 Signal vm 1&2

De1CTF2019 Signal vm 1&2

进入main分析

大概就是父进程fork一个子进程,接下来调试子进程,子进程进行vm的操作,调试这部分操作可以在下图这里看出:

image.png

VM1

内存数据如下

Code
65, 108, 109, 111, 115, 116, 32, 104, 101, 97, 118, 101, 110, 32, 119, 101, 115, 116, 32, 118, 105, 114, 103, 105, 110, 105, 97, 44, 32, 98, 108, 117, 101, 32, 114, 105, 100, 103, 101, 32, 109, 111, 117, 110, 116, 97, 105, 110, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214, 77, 45, 133, 119, 151, 96, 98, 43, 136, 134, 202, 114, 151, 235, 137, 152, 243, 120, 38, 131, 41, 94, 39, 67, 251, 184, 23, 124, 206, 58, 115, 207, 251, 199, 156, 96, 175, 156, 200, 117, 205, 55, 123, 59, 155, 78, 195, 218, 216, 206, 113, 43, 48, 104, 70, 11, 255, 60, 241, 241, 69, 196, 208, 196, 255, 81, 241, 136, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

通过异常处理进入vm的handle

分析vm操作指令

image.png

image.png

最终分析出vm中实现了Hill cipher,算法如下

c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>

uint8_t reg[50] = {0};
uint8_t key[50] = {65, 108, 109, 111, 115, 116, 32, 104, 101, 97, 118, 101, 110, 32, 119, 101, 115, 116, 32, 118, 105, 114, 103, 105, 110, 105, 97, 44, 32, 98, 108, 117, 101, 32, 114, 105, 100, 103, 101, 32, 109, 111, 117, 110, 116, 97, 105, 110, 115,00};
uint8_t plain[100] = {0};
uint8_t cipher[100] = {0};
uint8_t cmp[100] = {214, 77, 45, 133, 119, 151, 96, 98, 43, 136, 134, 202, 114, 151, 235, 137, 152, 243, 120, 38, 131, 41, 94, 39, 67, 251, 184, 23, 124, 206, 58, 115, 207, 251, 199, 156, 96, 175, 156, 200, 117, 205, 55, 123, 59, 155, 78, 195, 218, 216, 206, 113, 43, 48, 104, 70, 11, 255, 60, 241, 241, 69, 196, 208, 196, 255, 81, 241, 136, 81};

//Almost heaven west virginia, blue ridge mountains

int check()
{
uint8_t i,j,k;
uint8_t tmp = 0;
i = 0;
while(plain[i]!=0)
i++;
if(i!=70)
return 0;
for(i = 0;i<10;i++)
{
for(j = 0;j<7;j++)
{
tmp = 0;
for(k = 0;k<7;k++)
{
tmp+=plain[i*7+k]*key[k*7+j];
}
cipher[i*7+j] = tmp;
}
}
for(i = 0;i<70;i++)
{
if(cipher[i]!=cmp[i])
return 0;
}
return 1;
}

int main()
{
printf("Check up:");
scanf("%s", plain);
if(check())
puts("True.");
else
puts("False.");

return 0;
}

key和密文都已知,直接解密即可

python
from numpy import *
def GetReverse(a,n):
x = 0
y = 1
q = n
p = a
z = q // p
while(1 != p and 1 != q):
t = p
p = q % p
q = t

t = y
y = x - y * z
x = t
z = q // p
y = y % n
if(y < 0):
y += n
return y
def CheckReverse(a,n):
p = 2
while(p*p<n):
if(a%p == n%p and 0 == a%p):
return False
p+=1
return True
def MatI(m,n):
rank = len(m)
mm = [[0 for i in range(0,rank)] for j in range(0,rank)]
A = [[0 for i in range(0,2*rank)] for j in range(0,rank)]
T = [0 for i in range(0,2*rank)]
for i in range(0, rank):
for j in range(0, rank*2):
if(j < rank):
A[i][j] = m[i,j]
else:
if(rank == j-i):
A[i][j] = 1
else:
A[i][j] = 0
for j in range(0, rank):
for i in range(j, rank):
if(CheckReverse(A[i][j], n)):
a_1 = GetReverse(A[i][j], n)
for k in range(0, rank*2):
A[i][k] *= a_1
A[i][k] %= n
T[k] = A[i][k]
A[i][k] = A[j][k]
A[j][k] = T[k]
break
if(rank-1 == i):
return False
for i in range(0, rank):
if(i != j):
t = A[i][j]
for k in range(0, rank*2):
A[i][k] -= t * A[j][k]
A[i][k] %= n
if(A[i][k]<0):
A[i][k] += n
for i in range(0, rank):
for j in range(0, rank):
mm[i][j] = A[i][j+rank]
return mat(mm)


key = list(b'Almost heaven west virginia, blue ridge mountains')
cipher = [ 214, 77, 45, 133, 119, 151, 96, 98, 43, 136,
134, 202, 114, 151, 235, 137, 152, 243, 120, 38,
131, 41, 94, 39, 67, 251, 184, 23, 124, 206,
58, 115, 207, 251, 199, 156, 96, 175, 156, 200,
117, 205, 55, 123, 59, 155, 78, 195, 218, 216,
206, 113, 43, 48, 104, 70, 11, 255, 60, 241,
241, 69, 196, 208, 196, 255, 81, 241, 136, 81];
mK = mat(key).reshape(7,7)
mC = mat(cipher).reshape(10,7)
mKI = MatI(mK,256)
mP = mC*mKI%256
print("".join(list(map(chr,mP.reshape(1,70).tolist()[0]))))

# de1ctf{7h3n_f4r3_u_w3ll_5w337_cr4g13_HILL_wh3r3_0f3n_71m35_1_v3_r0v3d}

VM2

参考https://projecteuler.net/problem=67 ,分析出来也不算复杂

Code
{126},
{116, 68},
{114, 67, 36},
{53, 105, 33, 61},
{37, 78, 97, 113, 108},
{88, 122, 93, 110, 52, 95},
{117, 108, 107, 65, 103, 94, 100},
{57, 55, 78, 103, 108, 45, 102, 71},
{111, 41, 122, 114, 89, 101, 44, 105, 85},
{48, 73, 98, 85, 29, 126, 89, 66, 58, 36},
{83, 61, 62, 80, 105, 58, 105, 45, 117, 120, 42},
{105, 80, 31, 48, 111, 120, 115, 40, 124, 38, 64, 78},
{72, 30, 108, 106, 32, 45, 105, 126, 40, 55, 90, 25, 122},
{66, 114, 123, 55, 30, 65, 69, 44, 97, 114, 85, 34, 49, 84},
{33, 44, 78, 44, 34, 120, 36, 34, 102, 126, 122, 105, 114, 35, 80},
{94, 93, 86, 87, 16, 97, 121, 92, 82, 104, 112, 61, 54, 80, 105, 55},
{103, 67, 68, 31, 114, 43, 36, 69, 102, 96, 50, 111, 57, 87, 37, 106, 114},
{39, 37, 71, 53, 48, 63, 59, 111, 125, 87, 40, 39, 108, 43, 90, 58, 118, 62},
{97, 66, 33, 32, 82, 54, 65, 75, 55, 49, 61, 62, 121, 89, 42, 41, 121, 116, 113},
{93, 83, 95, 111, 123, 48, 61, 61, 61, 108, 89, 67, 103, 81, 89, 32, 125, 30, 29, 87},
{65, 116, 73, 64, 24, 81, 61, 80, 63, 41, 97, 53, 29, 111, 72, 40, 58, 88, 110, 100, 74},
{63, 37, 90, 123, 87, 76, 68, 32, 64, 69, 41, 85, 111, 110, 34, 44, 36, 70, 32, 70, 33, 86},
{93, 84, 114, 84, 88, 55, 64, 78, 111, 100, 106, 42, 66, 126, 47, 114, 70, 66, 38, 113, 104, 101, 45},
{81, 69, 32, 106, 57, 76, 45, 100, 73, 64, 77, 29, 72, 36, 100, 79, 54, 122, 54, 92, 46, 72, 53, 72},
{98, 66, 44, 105, 103, 56, 79, 117, 45, 75, 105, 46, 62, 89, 101, 45, 50, 92, 120, 112, 76, 60, 102, 36, 29},
{60, 51, 74, 88, 87, 82, 59, 95, 84, 82, 118, 81, 73, 84, 34, 49, 36, 79, 107, 36, 51, 52, 73, 105, 106, 32},
{119, 36, 40, 82, 37, 94, 53, 105, 103, 109, 90, 76, 78, 58, 51, 99, 32, 84, 34, 81, 96, 48, 94, 70, 44, 90, 39},
{51, 86, 33, 35, 125, 101, 93, 53, 88, 87, 40, 33, 36, 36, 51, 57, 116, 35, 34, 97, 99, 97, 56, 117, 38, 109, 68, 61},
{93, 109, 94, 31, 63, 87, 119, 104, 118, 112, 89, 76, 86, 88, 57, 110, 57, 102, 53, 68, 116, 31, 80, 49, 110, 68, 36, 101, 117},
{75, 55, 53, 64, 55, 79, 104, 53, 78, 59, 45, 125, 106, 63, 89, 40, 44, 123, 46, 81, 116, 56, 100, 95, 69, 41, 35, 43, 97, 64},
{64, 87, 96, 97, 99, 98, 36, 86, 40, 87, 65, 40, 84, 63, 36, 57, 70, 110, 57, 66, 42, 29, 71, 100, 32, 100, 53, 90, 83, 113, 39},
{82, 82, 112, 77, 89, 33, 111, 104, 55, 112, 30, 48, 54, 49, 46, 53, 109, 44, 111, 31, 40, 34, 112, 41, 28, 42, 97, 86, 116, 122, 37, 46},
{31, 36, 58, 119, 118, 65, 119, 113, 125, 102, 48, 32, 91, 69, 89, 111, 63, 47, 100, 126, 48, 50, 49, 72, 53, 106, 52, 72, 112, 80, 30, 70, 49},
{102, 90, 29, 76, 41, 39, 166, 41, 87, 105, 119, 43, 71, 109, 65, 57, 99, 38, 73, 79, 110, 54, 35, 92, 105, 30, 112, 68, 84, 106, 66, 79, 60, 75},
{105, 54, 83, 83, 66, 40, 46, 70, 113, 99, 85, 122, 66, 34, 31, 61, 48, 125, 66, 42, 34, 51, 116, 96, 111, 73, 64, 84, 86, 62, 86, 77, 53, 42, 120},
{69, 116, 63, 54, 105, 118, 51, 38, 44, 68, 32, 121, 34, 96, 78, 123, 30, 123, 74, 117, 48, 72, 51, 47, 77, 83, 37, 59, 63, 76, 31, 80, 112, 119, 52, 92},
{79, 36, 88, 57, 88, 124, 93, 48, 123, 119, 125, 117, 33, 61, 123, 87, 59, 96, 95, 60, 102, 111, 45, 100, 98, 77, 111, 90, 30, 30, 46, 38, 55, 69, 102, 72, 72},
{88, 58, 88, 95, 123, 61, 76, 66, 32, 98, 103, 86, 89, 94, 33, 74, 123, 48, 61, 48, 59, 74, 79, 34, 126, 87, 69, 99, 121, 83, 66, 75, 111, 67, 121, 114, 109, 73},
{28, 47, 87, 41, 44, 65, 53, 105, 93, 108, 72, 122, 45, 78, 125, 108, 75, 43, 80, 115, 64, 79, 96, 44, 39, 55, 49, 61, 125, 47, 81, 54, 100, 88, 83, 90, 87, 61, 90},
{120, 69, 121, 110, 74, 88, 54, 78, 106, 106, 72, 28, 71, 100, 58, 97, 110, 69, 115, 52, 80, 78, 57, 42, 32, 48, 107, 71, 88, 111, 39, 104, 29, 89, 29, 92, 121, 69, 41, 121},
{59, 100, 36, 94, 95, 56, 101, 125, 37, 46, 112, 75, 65, 58, 112, 94, 80, 120, 120, 104, 74, 94, 66, 99, 121, 126, 45, 70, 104, 67, 105, 59, 56, 86, 51, 33, 29, 110, 77, 87, 93},
{59, 28, 71, 57, 43, 78, 42, 108, 125, 42, 37, 89, 113, 106, 77, 89, 72, 87, 97, 65, 58, 112, 92, 88, 91, 33, 99, 36, 41, 49, 83, 70, 36, 75, 93, 96, 110, 118, 87, 67, 63, 88},
{119, 75, 49, 98, 42, 122, 91, 70, 28, 43, 121, 29, 74, 46, 44, 96, 38, 85, 124, 83, 116, 58, 104, 72, 94, 123, 39, 52, 35, 47, 63, 74, 108, 71, 77, 91, 95, 112, 67, 108, 112, 79, 36},
{118, 62, 119, 72, 59, 111, 89, 42, 46, 91, 48, 93, 33, 28, 79, 107, 89, 86, 39, 52, 115, 55, 118, 77, 67, 43, 49, 65, 108, 106, 114, 78, 48, 104, 101, 104, 34, 69, 65, 69, 101, 110, 29, 32},
{73, 46, 104, 93, 51, 45, 32, 59, 29, 111, 58, 126, 119, 85, 123, 99, 118, 63, 89, 58, 82, 56, 80, 69, 39, 64, 53, 85, 99, 74, 93, 46, 109, 102, 39, 75, 51, 114, 118, 112, 29, 34, 30, 103, 113},
{126, 125, 111, 120, 34, 44, 60, 88, 119, 47, 93, 87, 51, 93, 67, 57, 94, 32, 64, 56, 51, 123, 30, 54, 97, 89, 40, 31, 72, 117, 86, 115, 70, 47, 93, 42, 73, 119, 57, 31, 98, 93, 105, 97, 80, 126},
{94, 87, 65, 33, 115, 31, 44, 99, 37, 126, 98, 34, 69, 52, 81, 32, 53, 91, 118, 77, 72, 98, 33, 57, 94, 75, 96, 109, 35, 83, 108, 94, 45, 73, 93, 90, 28, 47, 35, 107, 74, 34, 118, 43, 30, 106, 114},
{45, 81, 105, 76, 107, 75, 104, 67, 95, 50, 87, 115, 85, 107, 60, 84, 38, 96, 82, 80, 91, 29, 121, 76, 87, 119, 43, 62, 108, 48, 36, 52, 39, 51, 123, 45, 29, 32, 76, 30, 77, 104, 33, 59, 111, 54, 45, 65},
{95, 28, 77, 31, 79, 48, 69, 121, 80, 51, 116, 32, 119, 53, 79, 63, 95, 38, 112, 28, 31, 69, 29, 72, 42, 33, 77, 31, 80, 41, 52, 23, 55, 115, 32, 48, 94, 111, 106, 124, 37, 47, 122, 31, 67, 73, 29, 85, 114},
{121, 37, 29, 105, 115, 79, 48, 30, 115, 87, 33, 80, 76, 98, 47, 118, 39, 92, 34, 76, 48, 49, 38, 68, 85, 33, 63, 43, 36, 75, 44, 32, 51, 63, 50, 42, 99, 43, 111, 83, 29, 32, 70, 103, 108, 98, 56, 66, 76, 44},
{91, 66, 86, 111, 113, 43, 44, 93, 30, 36, 70, 33, 91, 45, 90, 56, 95, 33, 50, 34, 114, 41, 53, 62, 44, 39, 125, 68, 80, 91, 105, 45, 126, 54, 55, 111, 107, 94, 102, 89, 37, 38, 103, 117, 81, 34, 32, 81, 68, 66, 93},
{70, 110, 45, 64, 59, 58, 79, 56, 122, 74, 35, 103, 62, 38, 31, 80, 62, 70, 61, 36, 79, 84, 39, 63, 47, 66, 67, 82, 105, 71, 34, 58, 51, 36, 35, 42, 83, 115, 113, 28, 79, 89, 37, 51, 59, 32, 87, 92, 80, 55, 84, 126},
{30, 77, 30, 79, 34, 100, 76, 119, 93, 107, 28, 73, 35, 94, 52, 63, 100, 120, 34, 69, 52, 80, 40, 123, 103, 110, 114, 117, 81, 116, 105, 49, 105, 118, 100, 78, 96, 36, 106, 121, 110, 80, 36, 67, 96, 89, 37, 106, 76, 74, 30, 108, 57},
{98, 81, 100, 60, 78, 103, 86, 81, 106, 64, 83, 72, 111, 44, 89, 48, 125, 96, 68, 122, 92, 51, 66, 64, 89, 30, 51, 75, 81, 91, 73, 109, 98, 51, 42, 94, 36, 43, 123, 95, 79, 101, 106, 95, 59, 48, 40, 105, 123, 87, 36, 96, 47, 63},
{100, 53, 48, 71, 73, 65, 44, 110, 92, 125, 34, 50, 79, 73, 88, 124, 30, 40, 87, 58, 97, 42, 63, 104, 58, 85, 83, 120, 102, 95, 48, 63, 96, 80, 114, 34, 52, 109, 66, 77, 92, 121, 56, 57, 38, 60, 38, 40, 123, 29, 83, 74, 34, 76, 29},
{103, 73, 100, 57, 37, 47, 83, 97, 41, 83, 61, 53, 64, 66, 75, 51, 82, 103, 111, 118, 66, 113, 122, 88, 77, 41, 80, 120, 91, 94, 64, 58, 37, 111, 69, 121, 75, 47, 37, 99, 87, 88, 111, 106, 96, 92, 126, 100, 116, 52, 112, 75, 119, 83, 124, 43},
{30, 41, 107, 54, 49, 57, 71, 54, 94, 102, 106, 59, 78, 81, 108, 56, 92, 41, 46, 31, 40, 109, 31, 118, 70, 67, 39, 79, 56, 126, 34, 103, 87, 52, 28, 34, 126, 98, 64, 119, 67, 74, 126, 93, 84, 28, 70, 71, 49, 67, 80, 80, 36, 96, 50, 108, 34},
{76, 107, 83, 117, 120, 114, 74, 40, 102, 55, 114, 50, 99, 106, 59, 45, 54, 47, 55, 37, 64, 86, 48, 45, 97, 31, 106, 123, 30, 58, 72, 98, 108, 33, 41, 45, 112, 32, 58, 77, 119, 106, 50, 74, 36, 66, 74, 118, 70, 81, 96, 74, 69, 122, 89, 73, 59, 112},
{64, 45, 89, 112, 114, 55, 91, 32, 104, 78, 74, 53, 57, 92, 32, 97, 92, 102, 86, 107, 69, 79, 52, 47, 71, 37, 119, 44, 98, 122, 79, 41, 104, 40, 51, 82, 52, 92, 53, 36, 28, 57, 90, 42, 76, 75, 68, 44, 94, 74, 30, 95, 47, 117, 125, 59, 31, 67, 95},
{117, 78, 85, 87, 33, 82, 50, 95, 32, 46, 100, 121, 109, 63, 123, 70, 65, 117, 114, 55, 60, 110, 32, 44, 97, 110, 123, 120, 33, 31, 105, 74, 107, 33, 50, 39, 55, 50, 114, 99, 126, 41, 77, 125, 119, 65, 117, 91, 88, 85, 103, 121, 63, 93, 114, 107, 78, 62, 88, 65},
{84, 122, 91, 33, 80, 63, 109, 78, 67, 60, 74, 41, 34, 125, 105, 92, 66, 85, 80, 33, 77, 80, 31, 96, 67, 95, 63, 96, 102, 105, 102, 87, 30, 59, 66, 50, 104, 74, 53, 117, 40, 67, 71, 98, 117, 103, 78, 51, 63, 77, 52, 72, 97, 107, 88, 107, 88, 70, 117, 91, 38},
{45, 56, 113, 83, 95, 69, 106, 37, 69, 71, 57, 39, 123, 45, 50, 45, 79, 86, 29, 126, 94, 73, 87, 113, 70, 65, 82, 44, 71, 120, 69, 48, 82, 41, 74, 61, 125, 43, 76, 51, 50, 56, 123, 78, 82, 37, 73, 80, 54, 119, 54, 73, 90, 84, 57, 92, 70, 54, 48, 47, 51, 110},
{108, 99, 120, 46, 96, 79, 75, 28, 40, 110, 119, 96, 47, 75, 96, 86, 47, 89, 32, 69, 55, 116, 117, 126, 59, 97, 111, 44, 35, 114, 63, 30, 87, 58, 63, 63, 119, 53, 124, 63, 75, 81, 83, 83, 54, 43, 118, 35, 50, 38, 114, 126, 60, 74, 29, 41, 71, 100, 97, 126, 70, 62, 60},
{117, 83, 88, 113, 83, 39, 97, 86, 90, 59, 28, 42, 108, 74, 98, 103, 122, 59, 92, 107, 81, 97, 61, 78, 67, 72, 60, 31, 91, 82, 105, 95, 115, 74, 58, 74, 95, 105, 30, 111, 50, 71, 116, 99, 62, 35, 58, 103, 90, 53, 117, 112, 123, 94, 92, 118, 46, 41, 44, 113, 31, 98, 59, 122},
{64, 40, 31, 44, 90, 62, 64, 55, 83, 89, 113, 60, 34, 64, 37, 71, 79, 109, 79, 33, 46, 79, 84, 102, 117, 53, 118, 51, 33, 48, 41, 94, 103, 57, 73, 41, 62, 116, 116, 68, 30, 91, 83, 124, 114, 90, 49, 61, 30, 106, 44, 72, 38, 80, 52, 83, 123, 88, 50, 45, 90, 58, 64, 64, 74},
{104, 50, 53, 97, 99, 103, 104, 31, 55, 91, 98, 96, 41, 112, 123, 81, 122, 75, 33, 89, 126, 110, 113, 104, 124, 102, 98, 93, 57, 46, 84, 117, 60, 28, 87, 88, 41, 39, 117, 104, 59, 104, 83, 68, 45, 41, 114, 76, 37, 41, 117, 91, 45, 77, 48, 101, 41, 43, 115, 32, 72, 100, 109, 74, 101, 71},
{49, 124, 68, 40, 61, 58, 81, 88, 83, 121, 30, 51, 86, 54, 125, 104, 31, 36, 64, 67, 39, 53, 114, 36, 98, 97, 34, 45, 91, 84, 107, 48, 39, 98, 110, 121, 87, 66, 100, 106, 126, 44, 124, 59, 91, 56, 68, 34, 75, 111, 112, 94, 39, 101, 122, 47, 51, 79, 68, 94, 83, 88, 56, 120, 62, 99, 96},
{99, 50, 90, 93, 28, 38, 34, 57, 79, 83, 122, 43, 92, 53, 110, 117, 77, 101, 87, 45, 43, 75, 70, 104, 64, 38, 126, 125, 57, 121, 118, 53, 89, 100, 72, 39, 114, 100, 74, 54, 28, 116, 93, 126, 48, 68, 122, 107, 29, 80, 50, 59, 88, 75, 59, 69, 70, 110, 41, 93, 122, 118, 46, 108, 107, 94, 52, 115},
{35, 89, 59, 45, 166, 41, 110, 98, 64, 123, 38, 110, 66, 126, 32, 43, 50, 54, 37, 94, 29, 52, 71, 38, 82, 58, 73, 91, 68, 83, 71, 101, 53, 108, 78, 58, 72, 112, 114, 36, 108, 104, 49, 55, 103, 96, 73, 75, 91, 114, 94, 103, 54, 116, 58, 38, 101, 43, 89, 30, 87, 121, 69, 74, 36, 61, 121, 120, 99},
{83, 45, 117, 45, 69, 164, 69, 59, 41, 113, 33, 80, 60, 122, 126, 62, 56, 42, 71, 47, 76, 86, 52, 81, 61, 86, 111, 48, 50, 81, 62, 117, 105, 43, 117, 40, 64, 115, 81, 46, 113, 94, 114, 82, 93, 111, 92, 69, 125, 64, 114, 83, 60, 55, 85, 65, 55, 65, 93, 54, 79, 48, 108, 42, 35, 49, 124, 59, 112, 54},
{118, 80, 67, 55, 40, 61, 118, 52, 28, 90, 77, 64, 49, 76, 98, 85, 59, 55, 57, 45, 95, 121, 50, 110, 90, 89, 121, 103, 107, 68, 117, 49, 109, 79, 56, 39, 45, 83, 37, 35, 62, 41, 101, 84, 50, 92, 94, 67, 99, 66, 120, 66, 97, 116, 67, 61, 34, 73, 121, 49, 47, 32, 80, 91, 83, 57, 32, 83, 88, 115, 54},
{50, 122, 38, 39, 64, 96, 95, 51, 93, 37, 114, 97, 70, 77, 102, 34, 89, 68, 110, 85, 122, 120, 116, 106, 72, 66, 29, 49, 32, 49, 122, 70, 89, 38, 95, 56, 44, 67, 53, 71, 52, 98, 101, 43, 97, 112, 46, 52, 86, 121, 117, 66, 68, 107, 88, 97, 82, 87, 111, 60, 122, 103, 69, 90, 42, 36, 30, 67, 65, 39, 30, 59},
{36, 111, 83, 107, 88, 82, 112, 124, 43, 121, 109, 121, 125, 84, 111, 57, 111, 75, 120, 117, 98, 32, 122, 117, 100, 44, 57, 125, 67, 91, 92, 116, 34, 106, 36, 46, 83, 63, 69, 57, 50, 96, 126, 99, 34, 32, 54, 88, 51, 58, 70, 75, 98, 111, 48, 55, 53, 92, 92, 86, 92, 101, 104, 47, 37, 108, 88, 111, 122, 35, 79, 50, 97},
{74, 108, 55, 36, 125, 78, 94, 91, 62, 78, 86, 63, 119, 109, 104, 92, 107, 51, 99, 80, 49, 34, 54, 37, 48, 55, 57, 49, 75, 109, 107, 75, 83, 47, 41, 70, 45, 52, 77, 122, 117, 58, 101, 35, 36, 75, 71, 107, 117, 49, 120, 72, 109, 44, 40, 123, 52, 53, 35, 100, 61, 126, 33, 76, 51, 33, 110, 78, 67, 41, 42, 37, 52, 28},
{81, 52, 37, 108, 57, 91, 51, 101, 102, 107, 63, 102, 109, 87, 49, 96, 99, 118, 72, 94, 30, 89, 106, 81, 116, 101, 71, 110, 91, 123, 93, 100, 71, 57, 101, 77, 64, 32, 36, 124, 97, 28, 100, 73, 64, 118, 66, 102, 102, 45, 85, 79, 99, 105, 78, 108, 113, 79, 35, 124, 28, 73, 70, 93, 125, 89, 108, 45, 97, 120, 100, 35, 59, 73, 61},
{123, 107, 109, 34, 86, 98, 119, 80, 46, 47, 115, 93, 30, 51, 53, 37, 51, 54, 77, 109, 121, 100, 90, 35, 78, 60, 49, 72, 46, 40, 85, 60, 117, 42, 49, 77, 63, 40, 82, 33, 62, 74, 103, 79, 60, 88, 63, 54, 55, 73, 125, 41, 100, 47, 100, 59, 43, 53, 107, 80, 74, 93, 103, 65, 121, 72, 29, 28, 49, 79, 74, 123, 91, 85, 79, 66},
{115, 73, 50, 66, 101, 90, 108, 91, 47, 117, 60, 60, 103, 82, 85, 53, 37, 73, 69, 53, 100, 101, 39, 110, 59, 70, 36, 29, 100, 82, 113, 81, 112, 61, 55, 50, 56, 106, 118, 89, 74, 68, 34, 101, 126, 49, 75, 117, 47, 32, 123, 102, 122, 31, 70, 55, 108, 66, 108, 28, 55, 69, 105, 52, 66, 104, 117, 84, 85, 125, 44, 63, 100, 49, 90, 101, 78},
{56, 66, 101, 121, 122, 105, 91, 51, 65, 113, 90, 114, 120, 33, 97, 119, 49, 43, 107, 91, 56, 79, 47, 54, 50, 77, 41, 40, 114, 42, 99, 123, 108, 49, 35, 76, 99, 57, 97, 51, 106, 58, 43, 115, 86, 48, 116, 61, 123, 118, 75, 103, 70, 80, 115, 28, 84, 107, 50, 108, 117, 106, 85, 28, 107, 114, 44, 126, 113, 117, 99, 90, 59, 96, 41, 55, 115, 96},
{64, 44, 98, 122, 83, 120, 98, 62, 70, 72, 31, 125, 119, 121, 111, 123, 38, 57, 58, 54, 58, 87, 119, 30, 75, 32, 125, 118, 113, 121, 62, 117, 117, 35, 75, 46, 60, 55, 95, 64, 86, 53, 92, 126, 77, 95, 49, 34, 36, 76, 61, 58, 104, 76, 70, 33, 102, 44, 108, 114, 88, 106, 79, 53, 54, 99, 56, 77, 34, 125, 113, 28, 44, 37, 73, 91, 51, 45, 83},
{78, 57, 52, 121, 115, 112, 106, 118, 67, 60, 90, 111, 76, 94, 125, 119, 42, 53, 102, 46, 109, 32, 45, 105, 92, 120, 88, 75, 118, 70, 86, 68, 97, 78, 49, 42, 119, 108, 94, 118, 73, 125, 38, 38, 97, 58, 93, 37, 125, 92, 110, 48, 32, 83, 32, 125, 100, 94, 73, 101, 96, 61, 35, 57, 32, 79, 34, 125, 59, 122, 57, 121, 92, 77, 51, 90, 55, 108, 126, 84},
{46, 50, 88, 63, 36, 116, 98, 125, 92, 44, 57, 56, 116, 53, 106, 101, 121, 38, 71, 75, 124, 81, 108, 82, 66, 93, 96, 72, 55, 74, 40, 113, 42, 103, 101, 97, 111, 59, 63, 60, 106, 47, 105, 41, 68, 110, 116, 55, 108, 32, 126, 93, 108, 113, 65, 53, 33, 52, 40, 87, 81, 82, 50, 80, 54, 32, 116, 52, 50, 38, 40, 81, 86, 81, 83, 61, 43, 51, 80, 71, 33},
{40, 67, 84, 99, 48, 42, 87, 35, 31, 46, 38, 125, 61, 72, 36, 124, 113, 98, 30, 42, 83, 46, 42, 71, 124, 58, 117, 31, 112, 114, 103, 35, 39, 57, 51, 89, 111, 55, 39, 112, 109, 80, 126, 79, 40, 100, 33, 92, 124, 113, 36, 77, 121, 95, 96, 101, 57, 94, 114, 121, 90, 34, 105, 54, 107, 63, 96, 68, 33, 119, 59, 105, 64, 109, 57, 32, 45, 114, 126, 99, 46, 126},
{71, 47, 82, 104, 96, 118, 54, 58, 55, 108, 107, 54, 29, 34, 124, 50, 122, 125, 39, 52, 102, 56, 74, 98, 34, 74, 105, 66, 68, 86, 54, 103, 40, 42, 93, 88, 95, 62, 96, 113, 43, 80, 94, 90, 125, 126, 68, 83, 35, 55, 60, 67, 121, 103, 117, 112, 58, 97, 51, 92, 111, 92, 126, 109, 46, 52, 81, 64, 48, 73, 60, 29, 79, 126, 78, 60, 53, 31, 114, 29, 35, 45, 123},
{81, 69, 88, 72, 118, 33, 91, 106, 107, 109, 59, 43, 110, 90, 69, 76, 46, 105, 92, 124, 67, 69, 41, 88, 76, 61, 31, 45, 52, 125, 86, 57, 109, 99, 53, 115, 81, 63, 48, 102, 30, 115, 126, 80, 73, 116, 82, 105, 49, 121, 61, 67, 95, 114, 111, 52, 57, 103, 52, 35, 119, 111, 69, 88, 67, 65, 36, 126, 67, 50, 56, 66, 73, 82, 37, 117, 62, 111, 83, 97, 90, 50, 118, 66},
{79, 119, 30, 98, 116, 34, 36, 64, 95, 93, 85, 47, 71, 119, 78, 83, 40, 98, 106, 126, 53, 64, 29, 33, 43, 94, 63, 79, 85, 43, 106, 100, 83, 87, 86, 54, 71, 104, 121, 109, 46, 77, 125, 60, 36, 104, 121, 63, 67, 110, 91, 110, 85, 112, 44, 103, 80, 29, 110, 79, 49, 54, 66, 47, 75, 119, 72, 48, 36, 69, 51, 50, 39, 64, 79, 55, 77, 105, 106, 47, 113, 89, 100, 47, 86},
{81, 123, 107, 42, 118, 117, 126, 97, 37, 36, 85, 117, 120, 77, 108, 126, 81, 65, 63, 37, 57, 38, 62, 111, 43, 72, 109, 45, 38, 124, 63, 70, 123, 106, 124, 92, 67, 75, 50, 46, 44, 58, 91, 79, 92, 114, 64, 59, 92, 103, 126, 106, 61, 92, 106, 54, 82, 60, 30, 28, 60, 54, 88, 55, 93, 35, 31, 97, 76, 73, 75, 110, 28, 72, 46, 123, 40, 108, 41, 48, 58, 106, 120, 112, 77, 32},
{119, 119, 75, 111, 86, 125, 58, 80, 50, 54, 42, 49, 106, 122, 51, 103, 32, 106, 43, 120, 124, 116, 65, 116, 69, 110, 29, 115, 121, 122, 109, 48, 28, 124, 75, 66, 58, 105, 36, 92, 77, 83, 124, 88, 28, 34, 101, 54, 48, 50, 41, 42, 107, 124, 71, 105, 76, 62, 60, 72, 108, 101, 61, 32, 58, 84, 36, 65, 121, 34, 96, 81, 96, 59, 92, 95, 73, 95, 105, 117, 51, 55, 76, 78, 72, 113, 62},
{68, 90, 116, 103, 114, 58, 113, 36, 73, 41, 114, 109, 49, 56, 74, 43, 40, 37, 97, 99, 109, 122, 74, 91, 85, 70, 40, 102, 69, 96, 48, 39, 94, 40, 91, 111, 85, 50, 125, 36, 64, 103, 32, 49, 58, 39, 101, 77, 56, 126, 113, 99, 72, 52, 37, 55, 46, 33, 117, 70, 56, 58, 94, 106, 73, 52, 101, 41, 124, 62, 103, 64, 92, 73, 50, 109, 33, 49, 57, 103, 120, 93, 121, 44, 123, 40, 47, 99},
{90, 67, 105, 35, 79, 36, 117, 68, 97, 55, 63, 41, 73, 71, 112, 123, 51, 79, 85, 42, 114, 64, 32, 125, 126, 66, 40, 88, 103, 65, 71, 126, 110, 101, 117, 49, 80, 107, 83, 125, 57, 78, 90, 66, 71, 57, 126, 118, 31, 49, 54, 100, 44, 62, 80, 45, 62, 72, 81, 83, 54, 105, 75, 40, 96, 63, 71, 65, 98, 52, 57, 83, 42, 49, 100, 70, 59, 96, 86, 52, 120, 110, 72, 38, 61, 121, 71, 66, 119},
{39, 63, 83, 115, 40, 123, 43, 39, 82, 81, 38, 74, 46, 105, 44, 44, 95, 108, 104, 78, 69, 82, 126, 112, 93, 54, 108, 106, 120, 69, 92, 88, 96, 101, 41, 28, 45, 83, 39, 28, 85, 64, 118, 49, 69, 93, 118, 52, 46, 31, 123, 68, 52, 72, 45, 96, 123, 115, 63, 120, 37, 39, 125, 59, 71, 109, 110, 31, 99, 118, 31, 54, 100, 34, 61, 64, 98, 87, 86, 58, 25, 80, 81, 71, 123, 120, 110, 63, 31, 72},
{57, 45, 49, 47, 69, 123, 92, 106, 44, 68, 82, 96, 121, 108, 56, 107, 118, 58, 112, 52, 74, 53, 70, 76, 29, 126, 61, 94, 126, 103, 43, 41, 42, 120, 35, 59, 126, 71, 88, 104, 94, 77, 70, 82, 114, 82, 80, 101, 44, 73, 89, 52, 77, 126, 100, 32, 120, 75, 44, 58, 97, 107, 86, 36, 71, 86, 72, 40, 101, 93, 85, 121, 114, 100, 43, 41, 112, 65, 101, 126, 91, 50, 106, 55, 98, 69, 47, 64, 109, 58, 50},
{78, 123, 66, 92, 73, 98, 83, 40, 56, 95, 80, 113, 72, 60, 78, 76, 39, 118, 48, 48, 103, 112, 29, 44, 125, 42, 73, 39, 87, 48, 115, 57, 119, 110, 71, 86, 69, 77, 54, 115, 73, 113, 121, 100, 72, 81, 50, 114, 41, 37, 121, 48, 47, 61, 50, 78, 31, 110, 126, 102, 117, 90, 87, 43, 49, 60, 110, 97, 38, 59, 37, 77, 56, 57, 110, 73, 38, 32, 58, 44, 113, 69, 76, 28, 71, 90, 55, 87, 34, 105, 122, 67},
{71, 88, 116, 86, 31, 76, 78, 54, 96, 98, 73, 103, 71, 31, 36, 61, 83, 66, 42, 33, 121, 118, 102, 117, 92, 54, 83, 50, 101, 33, 50, 60, 63, 96, 41, 66, 32, 61, 62, 84, 60, 49, 103, 73, 83, 37, 88, 92, 116, 36, 43, 96, 31, 89, 92, 45, 126, 103, 76, 45, 99, 93, 100, 110, 109, 67, 103, 58, 116, 118, 54, 115, 44, 62, 68, 62, 59, 78, 59, 94, 79, 95, 101, 112, 107, 84, 34, 35, 88, 93, 74, 49, 94},
{92, 64, 46, 124, 53, 44, 43, 51, 51, 44, 77, 64, 91, 109, 51, 63, 59, 38, 95, 61, 96, 58, 59, 116, 106, 120, 123, 95, 76, 117, 41, 50, 31, 31, 94, 126, 108, 101, 97, 101, 63, 123, 95, 36, 91, 66, 115, 62, 81, 105, 123, 85, 93, 54, 115, 124, 59, 41, 33, 62, 105, 47, 98, 33, 112, 93, 84, 29, 85, 118, 99, 32, 56, 83, 100, 75, 113, 79, 36, 120, 49, 84, 106, 69, 39, 28, 58, 95, 44, 86, 90, 103, 34, 104},
{100, 108, 41, 40, 44, 47, 38, 36, 28, 110, 35, 112, 118, 97, 111, 90, 89, 104, 64, 34, 74, 28, 86, 122, 66, 96, 66, 48, 126, 36, 114, 29, 124, 43, 119, 63, 101, 98, 117, 93, 60, 99, 100, 102, 79, 118, 38, 39, 53, 99, 32, 53, 53, 75, 88, 77, 117, 92, 28, 114, 69, 74, 101, 62, 49, 100, 51, 53, 83, 97, 79, 32, 75, 68, 58, 45, 110, 54, 48, 66, 107, 112, 53, 35, 71, 29, 98, 34, 90, 49, 32, 79, 46, 35, 47},
{44, 52, 48, 38, 99, 120, 60, 76, 91, 50, 80, 109, 30, 40, 118, 92, 112, 29, 67, 32, 69, 58, 104, 69, 32, 63, 33, 81, 31, 85, 34, 103, 114, 110, 52, 84, 93, 39, 101, 60, 112, 64, 101, 59, 47, 96, 30, 124, 118, 95, 101, 71, 46, 41, 116, 55, 111, 112, 107, 80, 61, 114, 85, 125, 115, 105, 75, 92, 125, 67, 38, 84, 37, 94, 97, 108, 87, 106, 101, 99, 124, 86, 106, 74, 57, 47, 81, 107, 116, 118, 41, 32, 60, 63, 106, 66},
{87, 112, 86, 66, 87, 34, 84, 103, 104, 119, 33, 62, 42, 99, 50, 68, 72, 79, 122, 45, 91, 106, 113, 80, 83, 58, 96, 38, 118, 58, 111, 77, 71, 109, 49, 108, 68, 67, 57, 69, 57, 118, 75, 121, 101, 103, 91, 85, 101, 52, 123, 115, 41, 46, 30, 126, 55, 110, 42, 102, 126, 28, 116, 112, 106, 77, 30, 122, 59, 94, 71, 35, 34, 68, 89, 91, 56, 47, 41, 103, 53, 82, 75, 98, 96, 93, 46, 99, 71, 52, 41, 28, 75, 101, 39, 125, 34},
{91, 93, 111, 51, 45, 43, 54, 75, 47, 41, 74, 96, 57, 113, 75, 67, 50, 43, 88, 48, 78, 77, 53, 74, 61, 60, 118, 55, 105, 91, 70, 95, 31, 106, 78, 35, 46, 87, 79, 122, 33, 95, 73, 113, 62, 124, 54, 84, 31, 92, 57, 34, 126, 39, 39, 102, 118, 66, 77, 58, 69, 91, 97, 31, 73, 34, 125, 100, 125, 120, 64, 116, 104, 118, 91, 98, 91, 92, 93, 48, 105, 88, 108, 101, 69, 47, 110, 97, 100, 122, 105, 72, 119, 54, 61, 80, 98, 42},
{57, 38, 112, 58, 61, 98, 40, 75, 32, 41, 71, 30, 46, 94, 50, 100, 46, 84, 33, 117, 121, 99, 84, 96, 108, 89, 86, 95, 115, 84, 82, 96, 76, 40, 34, 114, 124, 107, 116, 32, 98, 32, 32, 53, 65, 67, 43, 89, 72, 126, 45, 65, 126, 51, 48, 53, 89, 101, 96, 31, 112, 84, 104, 62, 85, 94, 118, 106, 106, 84, 113, 55, 93, 61, 99, 78, 103, 105, 63, 122, 90, 117, 35, 105, 74, 90, 72, 58, 49, 97, 79, 75, 106, 121, 42, 104, 88, 94, 95},
{50, 60, 71, 108, 107, 119, 120, 102, 121, 115, 50, 88, 66, 103, 49, 30, 55, 121, 59, 33, 76, 92, 68, 61, 45, 50, 35, 74, 89, 87, 30, 90, 60, 40, 107, 79, 58, 81, 100, 70, 97, 53, 43, 96, 84, 114, 110, 58, 30, 120, 97, 108, 74, 126, 104, 71, 56, 95, 66, 78, 83, 86, 90, 34, 52, 97, 34, 104, 70, 80, 91, 30, 121, 69, 122, 66, 45, 28, 93, 48, 43, 124, 47, 77, 117, 43, 97, 37, 122, 96, 56, 33, 52, 88, 68, 53, 42, 86, 90, 62}

求这个三角形从上到下最大和的路径,路径的字符里就有flag

python
from copy import deepcopy
from random import randint
data = [] #这里就填入上面数据,不重复写了

A = deepcopy(data)
B = ['' for i in range(len(A))]
for i in range(0,len(A)-1)[::-1]:
for j in range(i+1):
assert A[i+1][j]!=A[i+1][j+1]
if A[i+1][j]>A[i+1][j+1]:
A[i][j]+=A[i+1][j]
B[i] += '0'
else:
A[i][j]+=A[i+1][j+1]
B[i] += '1'
x = 0
y = 0
C = [data[0][0]]
for x in range(0,99):
if B[x][y]=='1':
y+=1
C.append(data[x+1][y])
for i in range(len(C)):
print(chr(C[i]),end='')
文章作者: kabeor
文章链接: https://kabeor.github.io/De1CTF2019-Signal_vm/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 K's House

评论