提醒

您正在访问搜索引擎投递页面,强烈建议您:回到主站 查看原文 - DLL源码查看、反编译及重新编译

memo 编辑 最后修改时间 2022/05/29 22:42

DLL源码查看反编译及重新编译

查看DLL源码、反编译DLL、.il重新编译为DLL

查看DLL源码及DLL转C#保存

下载安装 ILSpy
启动 ILSpy > CTRL + O选择需要打开的DLL文件
img_22.png

分析需要源码,确认自己需要修改的位置
img_23.png

# 将 WebApi.cs 编译为 web.dll
csc  /target:library /out:web.dll ./WebApi.cs

使用ildasm反编译DLL

ildasm 一般已预装,位置:C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\ildasm.exe
.NET Framework 开发工具 将自动随 Visual Studio 一起安装
img_24.png

启动 ildasm > CTRL + O选择需要反编译的DLL文件
img_25.png

DLL保存为web.il文件
img_26.png img_27.png

编辑 web.il文件,加入需要修改的代码
img_28.png

使用ilasm将.il文件重新编译DLL

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

D:\GH0422-B\WebApi\dll>ilasm.exe /dll/resource=web.res web.il
Microsoft (R) .NET Framework IL Assembler.  Version 4.8.4161.0
Copyright (c) Microsoft Corporation.  All rights reserved.
Assembling 'web.il'  to DLL --> 'web.dll'
Source file is UTF-8

Assembled method WebApi.WebApi::Get
Assembled method WebApi.WebApi::Post
Assembled method WebApi.WebApi::.ctor
Assembled method WebApi.WebApiBase::Get
Assembled method WebApi.WebApiBase::.ctor
Assembled method WebApi.Domain.Result`1::get_Code
Assembled method WebApi.Domain.Result`1::set_Code
Assembled method WebApi.Domain.Result`1::get_Msg
Assembled method WebApi.Domain.Result`1::set_Msg
Assembled method WebApi.Domain.Result`1::get_Token
Assembled method WebApi.Domain.Result`1::set_Token
Assembled method WebApi.Domain.Result`1::get_Data
Assembled method WebApi.Domain.Result`1::set_Data
Creating PE file

Emitting classes:
Class 1:        WebApi.WebApi
Class 2:        WebApi.Domain.Result`1
Class 3:        WebApi.WebApiBase

Emitting fields and methods:
Global
Class 1 Methods: 3;
Class 2 Fields: 4;      Methods: 8;
Class 3 Methods: 2;
Resolving local member refs: 8 -> 8 defs, 0 refs, 0 unresolved

Emitting events and properties:
Global
Class 1
Class 2 Props: 4;
Class 3
Resolving local member refs: 0 -> 0 defs, 0 refs, 0 unresolved
Writing PE file
Operation completed successfully

常见问题

protected module -- cabbot disassemble
Reverse Engineering of an Obfuscated .NET Assembly

2 条评论
未登录用户
支持 Markdown 语法
@jiangshengxin
jiangshengxin发表于大约 1 年前

six six six

@acane77
acane77发表于5 个月前

打卡