-
-
看雪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直播授课
赞赏
他的文章
- KCTF2022春季赛 第三题 石像病毒 8856
- KCTF2022春季赛 第二题 末日邀请 16176
- KCTF2021秋季赛 第二题 迷失丛林 18804
- KCTF2020秋季赛 第十题 终焉之战 8862
- KCTF2020秋季赛 第九题 命悬一线 6462
看原图
赞赏
雪币:
留言: