关注.net 有一周了,即使有了tankaiha大师的入门贴后,还是不得要领。
按照reflector+ildasm+ilasm 这个步骤。我将.exe用ILdsam打开后代码如下:
.method private hidebysig static void Main(string[] args) cil managed
{
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor()
.entrypoint
.maxstack 4
.locals init (
[0] class [mscorlib]System.AppDomain domain,
[1] object[] objArray,
[2] class [mscorlib]System.IO.MemoryStream stream,
[3] class [mscorlib]System.IO.Stream stream2,
[4] uint8[] buffer,
[5] class Sixxpack.Compressor compressor,
[6] uint8[] buffer2,
[7] class [mscorlib]System.Reflection.Assembly 'assembly')
L_0000: call class [mscorlib]System.AppDomain [mscorlib]System.AppDomain::get_CurrentDomain()
L_0005: stloc.0
L_0006: ldloc.0
L_0007: ldnull
L_0008: ldftn class [mscorlib]System.Reflection.Assembly Sixxpack.stub::myResolveEventHandler(object, class [mscorlib]System.ResolveEventArgs)
L_000e: newobj instance void [mscorlib]System.ResolveEventHandler::.ctor(object, native int)
L_0013: callvirt instance void [mscorlib]System.AppDomain::add_AssemblyResolve(class [mscorlib]System.ResolveEventHandler)
L_0018: leave.s L_001d
L_001a: pop
L_001b: leave.s L_001d
L_001d: ldc.i4.1
L_001e: newarr object
L_0023: stloc.1
L_0024: ldloc.1
L_0025: ldc.i4.0
L_0026: ldarg.0
L_0027: stelem.ref
L_0028: newobj instance void [mscorlib]System.IO.MemoryStream::.ctor()
L_002d: stloc.2
L_002e: call string [System.Windows.Forms]System.Windows.Forms.Application::get_ExecutablePath()
L_0033: call string [System.Windows.Forms]System.Windows.Forms.Application::get_ExecutablePath()
L_0038: ldc.i4.s 0x5c
L_003a: callvirt instance int32 [mscorlib]System.String::LastIndexOf(char)
L_003f: ldc.i4.1
L_0040: add
L_0041: callvirt instance string [mscorlib]System.String::Substring(int32)
L_0046: ldc.i4.3
L_0047: ldc.i4.1
L_0048: newobj instance void [mscorlib]System.IO.FileStream::.ctor(string, valuetype [mscorlib]System.IO.FileMode, valuetype [mscorlib]System.IO.FileAccess)
L_004d: stloc.3
L_004e: ldloc.3
L_004f: ldsfld int32 Sixxpack.stub::orig
L_0054: conv.i8
L_0055: callvirt instance void [mscorlib]System.IO.Stream::set_Position(int64)
L_005a: ldloc.3
L_005b: callvirt instance int64 [mscorlib]System.IO.Stream::get_Length()
L_0060: ldsfld int32 Sixxpack.stub::orig
L_0065: conv.i8
L_0066: sub
L_0067: conv.ovf.i
L_0068: newarr uint8
L_006d: stloc.s buffer
L_006f: ldloc.3
L_0070: ldloc.s buffer
L_0072: ldc.i4.0
L_0073: ldloc.s buffer
L_0075: ldlen
L_0076: conv.i4
L_0077: call int32 [mscorlib]System.Convert::ToInt32(int32)
L_007c: callvirt instance int32 [mscorlib]System.IO.Stream::Read(uint8[], int32, int32)
L_0081: pop
L_0082: ldloc.2
L_0083: ldloc.s buffer
L_0085: ldc.i4.0
L_0086: ldloc.s buffer
L_0088: ldlen
L_0089: conv.i4
L_008a: callvirt instance void [mscorlib]System.IO.Stream::Write(uint8[], int32, int32)
L_008f: ldloc.2
L_0090: ldc.i4.0
L_0091: conv.i8
L_0092: ldc.i4.0
L_0093: callvirt instance int64 [mscorlib]System.IO.Stream::Seek(int64, valuetype [mscorlib]System.IO.SeekOrigin)
L_0098: pop
L_0099: newobj instance void Sixxpack.Compressor::.ctor()
L_009e: stloc.s compressor
L_00a0: ldloc.s compressor
L_00a2: ldloc.2
L_00a3: callvirt instance uint8[] Sixxpack.Compressor::Decompress(class [mscorlib]System.IO.Stream)
L_00a8: stloc.s buffer2
L_00aa: ldloc.s buffer2
L_00ac: call class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::Load(uint8[])
L_00b1: stloc.s 'assembly'
L_00b3: ldloc.s 'assembly'
L_00b5: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.Assembly::get_EntryPoint()
L_00ba: ldnull
L_00bb: ldloc.1
L_00bc: callvirt instance object [mscorlib]System.Reflection.MethodBase::Invoke(object, object[])
L_00c1: pop
L_00c2: leave.s L_00d6
L_00c4: pop
L_00c5: ldloc.s 'assembly'
L_00c7: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.Assembly::get_EntryPoint()
L_00cc: ldnull
L_00cd: ldnull
L_00ce: callvirt instance object [mscorlib]System.Reflection.MethodBase::Invoke(object, object[])
L_00d3: pop
L_00d4: leave.s L_00d6
L_00d6: ret
.try L_0000 to L_001a catch [mscorlib]System.Exception handler L_001a to L_001d
.try L_00b3 to L_00c4 catch object handler L_00c4 to L_00d6
}
由上可见,该程序还算比较简单,未采取任何混淆,也没有加壳。这是我调试的第一个.net程序,从il代码上看是没有加壳。
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)