20171008 时长12h
Re: console
打开,windows提示需要安装.net 4.0,安装后打开
打开是空白,随意输入,提示wrong
peid打开,
peid提示编程语言为c#
.Net逆向,使用reflector反编译,找出加密方法
基本流程为字符串加密后与输入的值比较
内do..while循环里 num2递增,即A_1 递增,也就是与数组A_1 [1~14]轮流异或
外do.while循环从字符串数组string A_0里取ch,进行内循环的异或,最后与把ch连接成字符串A_2
最后回传参数A_2,即string str2
再经过replace方法把"-"替换为"",md5计算后加上flag{}与输入比较
解密脚本:
结果import hashlib
str1 = [0x2, 0x3, 0x5, 0x7, 0xb, 0xd, 0x11,0x13, 0x17, 0x1d, 0x1f, 0x25, 0x29, 0x2b, 0x2f, 0x35,0x3b, 0x3d, 0x43, 0x47,0x49, 0x4f, 0x53, 0x59, 0x61, 0x65, 0x67, 0x6b, 0x6d, 0x71]
str2 = "CreateByTenshine"
str3 = ""
for i in xrange(len(str2)):
t= ord(str2[i])
for j in range(1,15):
t = str1[j] ^ t
str3 += chr(t)
for k in xrange(len(str3)):
if (str3[k] == '-'):
str3[k] = ''
print str3
m = hashlib.md5()
m.update(str3)
result = m.hexdigest()
print 'flag{' + result + '}'
Re: 简单算法
elf文件,linux x64打开
程序运行ida64打开,载入后查看string,F5查看伪c代码,找到整个逻辑
ida F5 判断v1v1的在内存中的地址开始位置在rbp-b0h,输入的值根据汇编lea (目标地址传送指令) 判断v1存放输入字符串
v7要作为v5循环提取字符串转存为数组,v7判断位数为22,即v7的值为0~21递增
v5输入的值,与计算过的值v9逐字节异或,再与程序的数组v6逐字节比较
所以,v6为正确异或后的值
只需把v6与计算过的v9异或,即得应该正确输入的值
程序逻辑是: 输入值与计算的值异或,再与程序内的字符数组(byte_6b4270)逐位判断是否相等
查看程序内的字符数组(byte_6b4270)均为8位,但计算后异或的值显然远远大于字符的值,所以要取低八位计算异或的值
v10=10,也就是说该题目有很多flag,只能准确确定10位
其他位数需要脑洞了
解题:1.计算出要异或的值
#include<stdio.h>
#include<windows.h>
#include<tchar.h>
#include<stdlib.h>
int main()
{
int v8 = 0;
int v4 ;
int v9 =0;
int v7 = 0;
for (v7=0;v7<=21;v7++)
{
int v4 = v7+1;
v9 = 0;
v8 = 0;
while ( v8 < v4 )
{
++v8;
v9 = 1828812941 * v9 + 12345;
}
printf("0x%x,",(unsigned __int8)v9); //打印低八位
}
}
2.解密flag
解出flag 验证正确a = [ord(i) for i in "5FF25E8B4E0EA3AAC793813D5F74A309912B49289367".decode("hex")]
xor =[0x39,0x9e,0x3f,0xec,0x35,0x6a,0x9b,0x98,0xf1,0xf6,0xb7,0x4,0x6d,0x42,0x93,0x30,0xa9,0x4e,0x2f,0x1c,0xa5,0x1a]
f = [0 for i in range(22)]
r = ""
for i in range(22):
f[i] = chr(a[i]^xor[i])
for i in range(len(f)):
r += f[i]
print r
Re: 动态暴力破解
ida载入,查找字符串
发现疑似flag字符串 FYM-OI}olte_zi_wdqedd_djrzuj_shgmEDFqo{
想到凯撒加密,直接列举解密,找不到正确的答案
内存中找到了硬编码的字符串:'dfhlnrtxdflprvbhjptvbhjptvbfltxzdfjxbhj'
标准凯撒移位
解密脚本:
s1 = 'FYM-OI}olte_zi_wdqedd_djrzuj_shgmEDFqo{'
s2 = 'dfhlnrtxdflprvbhjptvbhjptvbfltxzdfjxbhj'
s1 = list(s1)
for i in range(len(s1)):
pos = ord(s2[i])-ord('a')
if s1[i]=='{':
s1[i]='}'
elif s1[i]=='}':
s1[i]='{'
elif s1[i]=='_':
pass
else:
if s1[i].islower():
s1[i] = chr(ord(s1[i])-pos%26)
if ord(s1[i])<ord('a'):
s1[i] = chr(ord(s1[i])+26)
elif s1[i].isupper():
s1[i] = chr(ord(s1[i])-pos%26)
if ord(s1[i])<ord('A'):
s1[i] = chr(ord(s1[i])+26)
else:
pass
f = ""
for i in range(len(s1)):
f+=s1[i]
printf
网友评论