攻防世界misc高手进阶篇教程(6)

halo

简单的base64解密会出现奇怪的字符

import string

from base64 import *

b=b64decode("aWdxNDs1NDFSOzFpa1I1MWliT08w")

data=list(b)


for k in range(0,200):

    key=""

    for i in range(len(data)):

        key+=chr(ord(data[i])^k)

print (key)

跑出来的结果有一个没有特殊符号

picture3

先用binwalk -e 分解出来

然后我们直接用stego.txt跑出结果即可

def get_base64_diff_value(s1, s2):
    base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
    res = 0
    for i in xrange(len(s1)):
        if s1[i] != s2[i]:
            return abs(base64chars.index(s1[i]) - base64chars.index(s2[i]))
    return res

def solve_stego():

    with open('stego.txt', 'rb') as f:
        file_lines = f.readlines()

    bin_str = ''
    for line in file_lines:
        steg_line = line.replace('\n', '')
        norm_line = line.replace('\n', '').decode('base64').encode('base64').replace('\n', '')
        diff = get_base64_diff_value(steg_line, norm_line)

        pads_num = steg_line.count('=')
        if diff:
            bin_str += bin(diff)[2:].zfill(pads_num * 2)

        else:
            bin_str += '0' * pads_num * 2

    res_str = ''

    for i in xrange(0, len(bin_str), 8):

        res_str += chr(int(bin_str[i:i+8], 2))
    print res_str

solve_stego()

regexpire
from pwn import *
import rstr
import exrex
from time import sleep
import re

# conect to server
r = remote('misc.chal.csaw.io', 8001)

# Print the question string
print r.recvline()

# Counter
i=1

while True:
	# Recieve the regex pattern
    reg = r.recvline()[:-1]
    print "%d -------\n"%i
    print reg
    print "-------\n"
    ans=rstr.xeger(reg).replace('\n','') # Remove newlines!
    # ans=exrex.getone(reg).replace('\n','')  # Another possible option
    r.sendline(ans)
    i+=1
    sleep(0.2)

flag{^regularly_express_yourself$}

Crc

通过crc32爆破

然后把三个密码依次连接起来,后面发现密码是forum_91ctf_com_66

二进制转换成文本,然后保存到html文件中,打开获得二维码,扫描即可

A-Weird-C-Program

下载源代码时,会注意到它具有所有这些奇怪的间距。

制表符本来是1,空格是0

再用python即可

打开电动车

是音频文件,直接打开

短的一段表示0,长的一段表示1

得到01110100101010100110

加上flag

sctf{01110100101010100110}

Hong

用binwalk分析发现有很多文件

foremost hong.mp3分解出来

直接就发现了flag

BCTF{cute&fat_cats_does_not_like_drinking}

神奇的压缩文件

解压后使用 AlternateStreamView 扫描发现了 flag.zip 文件

压缩包注释段隐藏信息

将空格与TAB组成的空行转换为01

得到字符串110110011000111110100110011011110 110110110110010001100110110110011 01110110111110010011001001111101

进行ASCII转换,得到flag:lctf{6d3677dd}

北京地铁

根据题目描述,应该是AES-ECB加密,目前通过低位隐写拿到了base64(ciphertext),密钥16bytes未知.hint:Color Threshold 则通过gimp2查看Color Threshold,等到hint:发现魏公村颜色不对,根据提示,可能是密钥。

from Crypto.Cipher import AES
import base64

aes_instance = AES.new(b'weigongcun'.ljust(16, b'\0'), AES.MODE_ECB)

cipher = base64.b64decode('7SsQWmZ524i/yVWoMeAIJA==')

plaintext = aes_instance.decrypt(cipher)

print(plaintext)

7-2

解压后发现大堆文件名,尝试base64

ls|tr -d ' '|base64 -d

发现<p@<uk'2Pz1KFAN߬r9HSLainidexingzhuang>$Il{arGks!gb|5 爱你的新装字样,定位到文件YWluaWRleGluZ3podWFuZw

cat后得到00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 74 94 22 42 91 23 {82 42 82 52 63 21 42 22 73 21 }00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

键盘密码 + 凯撒得到flag

wdflag{ylyoselfve}

Clemency

IDA的反汇编脚本

https://github.com/cseagle/ida_clemency
将脚本放入文件夹下,重新打开进行反汇编即可。

flag{I_love_cLEMENCy,so_I_want_to_share_it_with_you}

Keyes_secret

首先找出两个大括号之间的位置

键盘字母连起来对应另一个字母:

得到flag:FLAG{ISCC-KEYBOARD-CIPHER}

猜你喜欢

转载自blog.csdn.net/xuandao_ahfengren/article/details/106428165