De1CTF 2020 推文

好吧有点破事水……想了想还是把标题改了

ERQKGDWRP3SBHQQ3MTGBIYAZE4KJG5M3HCKRERQCIYWRP2KBHTGBGDMZE4KBH5M3GDABERQJIBWRP2IBH%D3%D3%D3YXNDBDJDATRYMHYUYC6VYDOGNDRVUSIYBDQ3YXNFMDJDAENYMC6WVDOGNDMRESIYVDM3YXNZNDJDATNQM3%D3%D3%D

大佬

5Yir6Zeu5oiRIOiHquW3seeci+WbvueJhw==

XCTF小秘

简单签到MISC,随便写了一个:

import com.google.common.io.BaseEncoding
import org.apache.commons.text.StringEscapeUtils
import java.net.URLDecoder
import java.nio.charset.StandardCharsets

fun main() {
    val str1First = "ERQKGDWRP3SBHQQ3MTGBIYAZE4KJG5M3HCKRERQCIYWRP2KBHTGBGDMZE4KBH5M3GDABERQJIBWRP2IBH%D3%D3%D3"
    val str1Second = "YXNDBDJDATRYMHYUYC6VYDOGNDRVUSIYBDQ3YXNFMDJDAENYMC6WVDOGNDMRESIYVDM3YXNZNDJDATNQM3%D3%D3%D"
    val str1 = buildString {
        str1First.zip(str1Second).forEach { (first, second) ->
            append(first).append(second)
        }
    }
    val str1UrlDecoded = URLDecoder.decode(str1, "UTF-8")
    println("Step1: $str1UrlDecoded")
    val str1Base32Decoded = String(BaseEncoding.base32().decode(str1UrlDecoded), StandardCharsets.UTF_8)
    println("Step2: $str1Base32Decoded")
    val str1UnicodeUnescaped = StringEscapeUtils.unescapeHtml4(str1Base32Decoded)
    println("Step3: $str1UnicodeUnescaped")
    val str2 = "5Yir6Zeu5oiRIOiHquW3seeci+WbvueJhw=="
    println(String(BaseEncoding.base64().decode(str2), StandardCharsets.UTF_8))
}

为了混合两个字符串,Kotlin标准库的zip还是挺有意思的。

关于Unicode编码,找到了这个:Unicode Escape Formats,所以形如�的转为字符串就直接StringEscapeUtils.unescapeHtml4()处理。

引用:
arraylist – Merge two strings in kotlin – Stack Overflow

加入对话

2条评论

留下评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

%d 博主赞过: