吾爱汇编

 找回密码
 立即注册

QQ登录

绑定QQ避免忘记帐号

查看: 2252|回复: 13

[原创逆向图文] Delphi代码转换到CS软件分析(Delphi2CS)

  [复制链接]
zyyujq 发表于 2022-6-6 16:15 | 显示全部楼层 |阅读模式

本帖最后由 yujunqiang 于 2022-6-8 14:52 编辑

运行环境:WIN7、10、11
涉及工具dnSpy、ExeinfoPe
教程类型:逆向限制,算法分析等
是否讲解思路和原理:

以下为图文内容:

转换 Delphi 5,6,7 和 Delphi.NET 到 C#

fakename.png

官方下载地址(Delphi2CS  4.1):
http://www.netcoole.com/delphi2cs.html
http://www.netcoole.com/download/delphi2cs.zip

类似还有 VB6TOCS 地址(转换VB6到C#  4.0)
http://www.netcoole.com/download/vb6tocs.zip


下载安装为试用版本,转换代码不能超过500行,使用ExeinfoPe测试软件为 .NET,用dnSpy打开软件delphi2cs.exe调试:
1、以数字/字符串搜索500:

fakename.png


BB 类 中有
            If Global.QB.B <> 100 Then
               
Me.ED("Delphi2CS has expired.")
               
stringBuilder3.Append("// Delphi2CS has expired, please purchase the final version. " & vbCrLf)
               
flag = True
            
ElseIf Me.GB.A > 500 Then
               
Me.ED("Delphi2CS trial converts the .pas file that is less than 500 lines.")
               
stringBuilder3.Append(" // Delphi2CS trial converts the .PAS file that is less than 500 lines. " & vbCrLf)
               
Dim fileName As String = Path.GetFileName(Me.O)
               
stringBuilder3.Append(String.Concat(New Object() { " // ", fileName, " is ", Me.GB.A, " lines. " & vbCrLf }))
               
stringBuilder3.Append(" // Please purchse the final version to avoid the limitation." & vbCrLf)
               
flag = True
            
End If


分析代码 QB.B <> 100 表示软件过期,GB.A > 500 表示代码行超过 500 行,在此鼠标右键,使用编辑IL指令,
500改为50000,或者条件语句内指令为空,IL指令如下:
133        0181        ldarg.0
134        0182        ldfld        class DB BB::GB
135        0187        ldfld        int32 DB::A
136        018C        ldc.i4        0x1F4  ------->0x1F4改为50000
137        0191        ble        186 (0216) ldloc.1

或者条件语句内容改为空:
            If Global.QB.B <> 100 Then
            ElseIf Me.GB.A > 500 Then
            
End If
鼠标在每行指令下,编辑IL指令,默认多行,按DEL,选择删除。


再继续搜索 100 找到 类 QB.B ,分析为软件过期代码如下:


    Public Shared Function B(A As KD) As Boolean
        
Try
            
QB.B = 100
            
Dim fileInfo As FileInfo = New FileInfo(QB.A)
            
fileInfo.Attributes = CType(0, FileAttributes)
            
If File.Exists(QB.A) Then
               
Dim length As Long = fileInfo.Length
               
If length = 0L Then
                    
QB.B = 1000 ----------->改为100
               
Else
                    
Dim binaryReader As BinaryReader = New BinaryReader(fileInfo.OpenRead())
                    
binaryReader.ReadInt32()
                    
Dim num As Integer = binaryReader.ReadInt32()
                    
Dim num2 As Integer = CInt(DateTime.Today.ToOADate())
                    
Dim num3 As Integer = num2 - num
                    
binaryReader.ReadInt32()
                    
binaryReader.ReadInt32()
                    
Dim num4 As Integer = binaryReader.ReadInt32()
                    
Dim num5 As Integer = binaryReader.ReadInt32()
                    
Dim num6 As Integer = binaryReader.ReadInt32()
                    
Dim num7 As Integer = binaryReader.ReadInt32()
                    
If num2 < num7 Then
                        
QB.B = 1000 ----------->改为100
                    
ElseIf num3 > 30 OrElse num3 < 0 Then
                        
QB.B = 1000 ----------->改为100
                    
Else
                        
If num3 = 0 Then
                           
num3 = 1
                        
End If
                        
A.G.Text = " Used: " + num3.ToString() + " days"
                    
End If
                    
A.H.Text = String.Concat(New String() { " ", num4.ToString(), "-", num5.ToString(), "-", num6.ToString() })
                    
binaryReader.Close()
                    
If num2 > num7 Then
                        
fileInfo = New FileInfo(QB.A)
                        
Dim binaryWriter As BinaryWriter = New BinaryWriter(fileInfo.Open(FileMode.Open, FileAccess.Write, FileShare.Write))
                        
Dim offset As Integer = CInt(length) - 4
                        
binaryWriter.Seek(offset, SeekOrigin.Begin)
                        
binaryWriter.Write(num2)
                        
binaryWriter.Flush()
                        
binaryWriter.Close()
                    
End If
               
End If
            
Else
               
QB.B = 1000 ----------->改为100
            
End If
        
Catch ex As Exception
            
Console.WriteLine(ex.Message)
            
QB.B = 1000 ----------->改为100
        
End Try
        
If QB.B <> 100 Then
            
A.C.Text = " Expired"
        
End If
        
Return QB.B = 100
   
End Function


保存模块,程序命名为delphi2csPJ.exe
经过测试,程序逆向成功。但显示为 Eval 继续搜索 Eval
        Me.C.AutoSize = StatusBarPanelAutoSize.Spring
        
Me.C.MinWidth = 100
        
Me.C.Text = " Eval"   ---------->改为" Licensed"
        Me.C.Width = 169



程序完美逆向。


逆向的主程序 V4.0:
delphi2cs.rar (179.69 KB, 下载次数: 9)
逆向的主程序 V4.1:
delphi2csPJ_V4.1.rar (192.07 KB, 下载次数: 20)


fakename.png

Delphi2CS V4.1 中文汉化和英文版:

Delphi2CS_V4.1.rar (1.24 MB, 下载次数: 14)




评分

参与人数 20HB +19 THX +8 收起 理由
消逝的过去 + 2
花盗睡鼠 + 2 + 1 [吾爱汇编论坛52HB.COM]-学破解防破解,知进攻懂防守!
虚心学习 + 1 [吾爱汇编论坛52HB.COM]-感谢楼主热心分享,小小评分不成敬意!
ACZR + 2
Jawon + 1
一路走来不容易 + 1
459121520 + 1
爱汇编爱汇编 + 1 [吾爱汇编论坛52HB.COM]-软件反汇编逆向分析,软件安全必不可少!
boot + 1
风里去 + 1 [吾爱汇编论坛52HB.COM]-软件反汇编逆向分析,软件安全必不可少!
飞刀梦想 + 1
Cerolluo + 1 [吾爱汇编论坛52HB.COM]-软件反汇编逆向分析,软件安全必不可少!
yexing + 1
l278785481 + 1
xgbnapsua + 2
temp + 1 + 1
既白丶 + 1
zxjzzh + 2 [吾爱汇编论坛52HB.COM]-学破解防破解,知进攻懂防守!
fengyuan0128 + 1
davidhee + 1 [吾爱汇编论坛52HB.COM]-学破解防破解,知进攻懂防守!

查看全部评分

吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
陈沦 发表于 2022-6-6 19:04 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
l278785481 发表于 2022-6-6 21:57 | 显示全部楼层


这个必须得顶
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
头像被屏蔽
别管我了行 发表于 2022-6-7 01:57 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
凌夏随缘 发表于 2022-6-14 11:46 | 显示全部楼层

谢谢楼主分享
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
男同在身边 发表于 2022-6-28 12:23 | 显示全部楼层
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
素衣少年 发表于 2022-8-11 16:55 | 显示全部楼层

厉害  受教了
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
曾经沧海 发表于 2022-9-18 14:57 | 显示全部楼层

这才是实实在在滴为r着想的真大佬1
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
风里去 发表于 2022-9-22 19:22 | 显示全部楼层

感谢楼主分享
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
爱汇编爱汇编 发表于 2022-10-6 23:39 | 显示全部楼层

感谢分享,学习下
吾爱汇编论坛-学破解,防破解!知进攻,懂防守!逆向分析,软件安全!52HB.COM
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

警告:本站严惩灌水回复,尊重自己从尊重他人开始!

1层
2层
3层
4层
5层
6层
7层
8层
9层
10层

免责声明

吾爱汇编(www.52hb.com)所讨论的技术及相关工具仅限用于研究学习,皆在提高软件产品的安全性,严禁用于不良动机。任何个人、团体、组织不得将其用于非法目的,否则,一切后果自行承担。吾爱汇编不承担任何因为技术滥用所产生的连带责任。吾爱汇编内容源于网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除。如有侵权请邮件或微信与我们联系处理。

站长邮箱:SharkHeng@sina.com
站长QQ:1140549900


QQ|RSS|手机版|小黑屋|帮助|吾爱汇编 ( 京公网安备11011502005403号 , 京ICP备20003498号-6 )|网站地图

Powered by Discuz!

吾爱汇编 www.52hb.com

快速回复 返回顶部 返回列表