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

王朝学院·作者佚名  2016-05-21
窄屏简体版  字體: 小  |  中  |  大  |  超大  

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编译成程序集 →反编译Dog.dll程序集,查看IL代码

// 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

PRe style="font-size: 11px; font-family:

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航