首页 > hacking > 用mono玩dotnet

用mono玩dotnet

2007年9月17日 hufey

apt-get install mono mono-utils monodevelop
用monodevelop开一个新project hellworld
自动生成程序如下:
using System;
namespace hellworld
{
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine(”Hello World!”);
}
}
}
执行mcs hellworl.cs,产生hellworld.exe,执行之,显示Hello World!
执行monodis hellworld.exe > hell.cs
输出
.assembly extern mscorlib
{
.ver 1:0:5000:0
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly ‘hellworld’
{
.custom instance void class [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyDelaySignAttribute::.ctor(bool) = (01 00 00 00 00 ) // …..
.custom instance void class [mscorlib]System.Reflection.AssemblyKeyFileAttribute::.ctor(string) = (01 00 00 00 00 ) // …..
.hash algorithm 0×00008004
.ver 1:0:2816:41192
}
.module hellworld.exe // GUID = {4C2ECEB2-6A70-412A-B380-B7E6847638D6}
.namespace hellworld
{
.class private auto ansi beforefieldinit MainClass
extends [mscorlib]System.Object
{
// method line 1
.method public hidebysig specialname rtspecialname
instance default void .ctor () cil managed
{
// Method begins at RVA 0×20ec
// Code size 7 (0×7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void object::.ctor()
IL_0006: ret
} // end of method MainClass::.ctor
// method line 2
.method public static hidebysig
default void Main (string[] args) cil managed
{
// Method begins at RVA 0×20f4
.entrypoint
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldstr “Hello World!”
IL_0005: call void class [mscorlib]System.Console::WriteLine(string)
IL_000a: ret
} // end of method MainClass::Main
} // end of class hellworld.MainClass
}
再执行ilasm hell.cs,生成hell.exe,执行之,显示Hello World!

分类: hacking 标签:
本文的评论功能被关闭了.