首页
社区
课程
招聘
看雪CTF2019Q1-第10题
发表于: 2019-3-18 20:57 2710

看雪CTF2019Q1-第10题

2019-3-18 20:57
2710

.net程序, 直接丢reflector


using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        public static String decrypt(String cipherText, String password)
        {
            byte[] bufIv = Encoding.UTF8.GetBytes("Kanxue2019CTF-Q1");
            byte[] bufCipher = Convert.FromBase64String(cipherText);
            byte[] bufKey = new PasswordDeriveBytes(password, null).GetBytes(0x20);
            ICryptoTransform transform = new RijndaelManaged { Mode = CipherMode.CBC }.CreateDecryptor(bufKey, bufIv);
            MemoryStream ms = new MemoryStream();
            CryptoStream cs = new CryptoStream(ms, transform, CryptoStreamMode.Write);
            cs.Write(bufCipher, 0, bufCipher.Length);
            cs.FlushFinalBlock();
            String plainText = Encoding.UTF8.GetString(ms.ToArray());
            ms.Close();
            cs.Close();
            return plainText;
        }

        static void Main(string[] args)
        {
            Console.WriteLine(decrypt("4RTlF9Ca2+oqExJwx68FiA==", "Kanxue2019"));
        }
    }
}

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        public static String decrypt(String cipherText, String password)
        {
            byte[] bufIv = Encoding.UTF8.GetBytes("Kanxue2019CTF-Q1");
            byte[] bufCipher = Convert.FromBase64String(cipherText);
            byte[] bufKey = new PasswordDeriveBytes(password, null).GetBytes(0x20);
            ICryptoTransform transform = new RijndaelManaged { Mode = CipherMode.CBC }.CreateDecryptor(bufKey, bufIv);
            MemoryStream ms = new MemoryStream();
            CryptoStream cs = new CryptoStream(ms, transform, CryptoStreamMode.Write);
            cs.Write(bufCipher, 0, bufCipher.Length);
            cs.FlushFinalBlock();
            String plainText = Encoding.UTF8.GetString(ms.ToArray());
            ms.Close();
            cs.Close();
            return plainText;
        }

        static void Main(string[] args)
        {
            Console.WriteLine(decrypt("4RTlF9Ca2+oqExJwx68FiA==", "Kanxue2019"));
        }
    }
}

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 1
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//