·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> C#程序集系列07,篡改程序集

C#程序集系列07,篡改程序集

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

C#程序集系列07,篡改程序集

以下几个方面用来区分不同的程序集:○ 程序集名称:Name○ 程序集版本:Version○ 程序集公匙: Public Token○ 程序集文化:Culture

如果没有很严格地按照上面的几个方面来创建程序集,程序集是很容易被篡改的。本篇体验篡改程序集。

→清空F盘as文件夹下的所有文件→在as文件夹下创建Dog.cs类,用记事本打开,编写如下,保存

using System;
public class Dog
{
    public static void MakeSound()
    {
        Console.WriteLine("汪汪汪");
    }
}
→把Dog.cs编译成程序集38

→反编译Dog.dll程序集,查看IL代码39

// Metadata version: v4.0.30319
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly Dog
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
  .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                             63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.
  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module Dog.dll
// MVID: {A8BAEEAB-2DF4-425C-B851-87260378D735}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x00400000
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit Dog
						
  • 上一篇文章:
  • 下一篇文章: