首页
社区
课程
招聘
1
[原创]初入好望角WriteUp
发表于: 2019-3-22 22:11 2971

[原创]初入好望角WriteUp

2019-3-22 22:11
2971
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.IO;
using System;
using System.Security.Cryptography;
using System.Text;
 
class Program
{
    static void Main()
    {
        PasswordDeriveBytes pdb = new PasswordDeriveBytes("Kanxue2019", null);
        Byte[] Key = pdb.GetBytes(0x20);
         
        Encoding unicode = Encoding.UTF8;
        Byte[] IV = unicode.GetBytes("Kanxue2019CTF-Q1");
        
        string plaintext = null;
        byte[] cipherText = Convert.FromBase64String("4RTlF9Ca2+oqExJwx68FiA==");
        using (RijndaelManaged rijAlg = new RijndaelManaged())
        {
            rijAlg.Key = Key;
            rijAlg.IV = IV;
 
            ICryptoTransform decryptor = rijAlg.CreateDecryptor(rijAlg.Key, rijAlg.IV);
 
            using (MemoryStream msDecrypt = new MemoryStream(cipherText))
            {
                using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                {
                    using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                    {
                            plaintext = srDecrypt.ReadToEnd();
                    }
                }
            }
 
        }
        Console.WriteLine(plaintext);
    }
}
结果为:Kanxue2019Q1CTF

[注意]看雪招聘,专注安全领域的专业人才平台!

收藏
免费 1
支持
分享
赞赏记录
参与人
雪币
留言
时间
PLEBFE
为你点赞~
2023-1-28 01:51
最新回复 (0)
游客
登录 | 注册 方可回帖
返回

账号登录
验证码登录

忘记密码?
没有账号?立即免费注册