类似于windows原生环境下的asm和dasm,.NET环境下,微软提供了这两个“瑞士军刀”般的工具。
感觉它们2个就好比庖丁手下的尖刀一样,可以对.NET程序进行任意解剖,分析,而且解剖,分析完后又可以再重新组装,运行,呵呵,真是游刃有余啊!
ilasm usage:
Usage: ilasm [Options] <sourcefile> [Options]
Options:
/LISTING Type a formatted list file
/NOLOGO Don't type the logo
/QUIET Don't report assembly progress
/DLL Compile to .dll
/EXE Compile to .exe (default)
/DEBUG Include debug information
/CLOCK Measure and report compilation times
/RESOURCE=<res_file> Link the specified resource file (*.res)
into resulting .exe or .dll
/OUTPUT=<targetfile> Compile to file with specified name
(user must provide extension, if any)
/KEY=<keyfile> Compile with strong signature
(<keyfile> contains private key)
/KEY=@<keysource> Compile with strong signature
(<keysource> is the private key source name)
/SUBSYSTEM=<int> Set Subsystem value in the NT Optional header
/FLAGS=<int> Set CLR ImageFlags value in the CLR header
/ALIGNMENT=<int> Set FileAlignment value in the NT Optional header
/BASE=<int> Set ImageBase value in the NT Optional header
Key may be '-' or '/'
Options are recognized by first 3 characters
Default source file extension is .IL
ildasm usage:
用法: ildasm [options] <file_name> [options]
用于输出重定向的选项:
/OUT=<file name> 直接输出到文件而不是 GUI。
/TEXT 直接输出到控制台窗口而不是 GUI。
用于 GUI 或文件/控制台输出的选项(仅限于 EXE 和 DLL 文件):
/BYTES 将实际字节(十六进制)显示为指令注释。
/RAWEH 以原始形式显示异常处理子句。
/TOKENS 显示类和成员的元数据标记。
/SOURCE 将原始源行显示为注释。
/LINENUM 包括对原始源行的引用。
/VISIBILITY=<vis>[+<vis>...] 仅反汇编具有指定
可见性的项。(<vis> = PUB | PRI | FAM | ASM | FAA | FOA | PSC)
/PUBONLY 仅反汇编公共项(与 /VIS=PUB 相同)。
/QUOTEALLNAMES 将所有名称用单引号括起来。
/NOBAR 取消反汇编进度栏窗口弹出。
下列选项只对文件/控制台输出有效:
用于 EXE 和 DLL 文件的选项:
/UTF8 对输出使用 UTF-8 编码(默认为 ANSI)。
/UNICODE 对输出使用 UNICODE 编码。
/NOIL 取消 IL 汇编程序代码输出。
/HEADER 在输出中包括文件头信息。
/ITEM=<class>[::<method>[(<sig>)] 只反汇编指定的项
/ALL /HEADER、/BYTES、/TOKENS 的组合
选项的关键字为“-”或“/”,通过前三个字符识别选项
示例: ildasm /tok /byt myfile.exe /out=myfile.il
给出以前对于1个dll文件进行分析,修改后,又重新编译的命令行步骤:
1.ildasm Web.dll /all /out=Web.il
2.用文本编辑器修改Web.il中的il代码
3.ilasm Web.il /dll /out=Web.dll (还可以加上 /res=Web.res)
附:
ILDASM:https://files.cnblogs.com/analysis/ILDASM.rar
ILASM:https://files.cnblogs.com/analysis/ILASM.part2.rar
https://files.cnblogs.com/analysis/ILASM.part1.rar
浙公网安备 33010602011771号