百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术资源 > 正文

数据库中了勒索病毒怎么办?(数据库恢复的终极大招DUL)

moboyou 2025-03-06 13:07 44 浏览

接上文,如果数据库中了勒索病毒,并且备份也同样被攻陷,那该怎么办?以最为常见的Lockbit3.0为例,LockBit采用先进的加密算法,通常是对称密钥加密和非对称密钥加密的组合。这使得被感染的系统中的文件无法被正常访问,想破解几乎是不可能的。只能支付赎金来获取解密工具来解密!如果你的数据库被勒索病毒加密,又不想缴纳昂贵的赎金?如何最大限度的恢复数据呢?这里就会使用到oracle数据恢复的最终大招了DUL(Data Unloader)!

1.DUL介绍

DUL是Data Unloader的缩写,Oracle内部恢复工具,为Oracle公司工程师Bernard van Duijnen 开发(带van 估计德国裔),以标准C写成,在不同平台上会使用不同的binary文件,可以直接从Oracle的数据文件中读取数据,转换为DMP或文本格式输出,在特殊情况下可以用来进行数据恢复,而且即使数据文件有坏块或者加密块,DUL也不会中断导出,只是会记录下来,并继续下个block的数据导出。由于bernard van duijnen 开发DUL的时候使用了一些Oracle数据库的内核头文件(主要是一些.h)文件,所以在Oracle来说DUL是需要被严格控制的,因为DUL直接用了Oracle数据库的源代码,属于Oracle知识产权的一部分。 起初这个工具仅在Oracle内部流通,但是逐渐的,DUL也开始流入民间,被一些资深Oracle工程师所使用。随着数据库版本的变化,DUL工具也在逐渐升级之中,对应Oracle8 / Oracle8i / Oracle9i / Oracle10g都有其相应版本;在oracle内网有专门的网站,but现在该网站已经不可访问。

早期DUL是不加锁的,后来变成加日期锁,就是说 好比bernard.van.duijnen 在10月1日发布了一个版本,日期锁是30天,那么这个版本到11月1日基本就失效了, DUL不是简单的读OS时间,所以改OS时间是没用的。 因为Oracle的datafile里也记录了一个当前时间,所以DUL读的是datafile里的时间。 一般用户不可能为了用DUL去改那个时间。

如果超过了时间dul则无法运行,有如下报错

Ps :看了这位老哥的LinkedIn 目前是Oracle的Senior Principal Software Engineer,已经在O记工作了30多年了!


2.DUL抽数范例

具体操作步骤如下:

2.1 下载并解压dul脚本

--创建一个目录存放脚本及执行过程中生成的文件

[testdb]$mkdir dul
[testdb]$mv dul4x86_64-linux.ol4.tar ./dul/
[testdb]$cd dul
[testdb]$tar -xvf dul4x86_64-linux.ol4.tar
dul
dul.sql
[testdb]$ls
dul  dul4x86_64-linux.ol4.tar  dul.sql
[testdb]$

2.2 试运行dul

--需要手动创建一个parameter file(名字为init.dul,与dul执行文件同目录)

[testdb]$./dul




Data UnLoader: 12.0.0.0.5 - Internal Only - on Tue Jun 30 14:28:10 2020
with 64-bit io functions and the decompression option




Copyright (c) 1994 2019 Bernard van Duijnen All rights reserved.




 Strictly Oracle Internal Use Only




DUL: Warning: Could not open parameter file 
DUL: Warning: Compatible is set to 11 Values can be 6|7|8|9|10|11|12|17|18
DUL: Warning: no parameter file means no logfile
DUL: Warning: ulimit process stack size is only 20971520
DUL>


2.3 创建parameter file,名字为init.dul,与dul执行文件同目录

[testdb]$pwd
/data2/dul
[testdb]$cat init.dul
control_file=/data2/dul/control.txt         <<<<<<指定dul使用的controlfile
export_mode=true                            <<<<<<指定dul抽取的数据保存为dmp格式(exp/imp)


2.4 创建dul使用的controlfile

1)数据库启动到mount状态

2)查询所有的数据文件信息

select TS#,file#,name from v$datafile;

3)创建空的control.txt控制文件,目录与参数文件中设定的相对应

4)将上面查出的数据文件信息保存在将上面查出的数据文件信息保存在control.txt控制文件中

[testdb]$cat control.txt
         0          1 /oradata/testdb/data/SYSTEM.datafile1.dbf
         1          2 /oradata/testdb/data/SYSAUX.datafile2.dbf
         2          3 /oradata/testdb/data/UNDOTBS1.datafile3.dbf
         4          4 /oradata/testdb/data/USERS.datafile4.dbf
         5          5 /oradata/testdb/data/PERFSTAT.datafile5.dbf
         6          6 /oradata/testdb/data/TIVOLIORTS.datafile6.dbf


2.5 执行dul

---确认db_id和db_name无误,链接到了正确的库

[testdb]$./dul
Data UnLoader: 12.0.0.0.5 - Internal Only - on Tue Jun 30 14:46:42 2020
with 64-bit io functions and the decompression option


Copyright (c) 1994 2019 Bernard van Duijnen All rights reserved.


 Strictly Oracle Internal Use Only


DUL: Warning: Compatible is set to 11 Values can be 6|7|8|9|10|11|12|17|18
DUL: Warning: ulimit process stack size is only 20971520
Found db_id = 3036208025
Found db_name = testdb
DUL>

2.6 生成dul数据字典信息(执行bootstrap)

DUL> bootstrap;
Probing file = 1, block = 520
. unloading table                BOOTSTRAP$
DUL: Warning: block number is non zero but marked deferred trying to process it anyhow
      60 rows unloaded
Reading BOOTSTRAP.dat 60 entries loaded
Parsing Bootstrap$ contents
Generating dict.ddl for version 12
 OBJ$: segobjno 18, file 1 block 240
 TAB$: segobjno 2, tabno 1, file 1  block 144
 COL$: segobjno 2, tabno 5, file 1  block 144
 USER$: segobjno 10, tabno 1, file 1  block 208
Running generated file "@dict.ddl" to unload the dictionary tables
. unloading table                      OBJ$   29335 rows unloaded
. unloading table                      TAB$    4969 rows unloaded
. unloading table                      COL$  116725 rows unloaded
. unloading table                     USER$      47 rows unloaded
Reading USER.dat 47 entries loaded
Reading OBJ.dat 29335 entries loaded and sorted 29335 entries
Reading TAB.dat 4969 entries loaded
Reading COL.dat
DUL: Notice: Increased the size of DC_COLUMNS from 100000 to 132768 entries
 116725 entries loaded and sorted 116725 entries
Reading BOOTSTRAP.dat 60 entries loaded




DUL: Warning: Recreating file "dict.ddl"
Generating dict.ddl for version 12
 OBJ$: segobjno 18, file 1 block 240
 TAB$: segobjno 2, tabno 1, file 1  block 144
 COL$: segobjno 2, tabno 5, file 1  block 144
 USER$: segobjno 10, tabno 1, file 1  block 208
 TABPART$: segobjno 568, file 1 block 3872
 INDPART$: segobjno 573, file 1 block 3912
 TABCOMPART$: segobjno 590, file 1 block 4056
 INDCOMPART$: segobjno 595, file 1 block 4096
 TABSUBPART$: segobjno 580, file 1 block 3976
 INDSUBPART$: segobjno 585, file 1 block 4016
 IND$: segobjno 2, tabno 3, file 1  block 144
 ICOL$: segobjno 2, tabno 4, file 1  block 144
 LOB$: segobjno 2, tabno 6, file 1  block 144
 COLTYPE$: segobjno 2, tabno 7, file 1  block 144
 TYPE$: segobjno 495, tabno 1, file 1  block 3344
 COLLECTION$: segobjno 495, tabno 2, file 1  block 3344
 ATTRIBUTE$: segobjno 495, tabno 3, file 1  block 3344
 LOBFRAG$: segobjno 601, file 1 block 4144
 LOBCOMPPART$: segobjno 604, file 1 block 4168
 UNDO$: segobjno 15, file 1 block 224
 TS$: segobjno 6, tabno 2, file 1  block 176
 PROPS$: segobjno 98, file 1 block 800
Running generated file "@dict.ddl" to unload the dictionary tables
. unloading table                      OBJ$
DUL: Warning: Recreating file "OBJ.ctl"
   29335 rows unloaded
. unloading table                      TAB$
DUL: Warning: Recreating file "TAB.ctl"
    4969 rows unloaded
. unloading table                      COL$
DUL: Warning: Recreating file "COL.ctl"
  116725 rows unloaded
. unloading table                     USER$
DUL: Warning: Recreating file "USER.ctl"
      47 rows unloaded
. unloading table                  TABPART$    2385 rows unloaded
. unloading table                  INDPART$    1180 rows unloaded
. unloading table               TABCOMPART$     112 rows unloaded
. unloading table               INDCOMPART$       0 rows unloaded
. unloading table               TABSUBPART$    4139 rows unloaded
. unloading table               INDSUBPART$       0 rows unloaded
. unloading table                      IND$    4040 rows unloaded
. unloading table                     ICOL$    9213 rows unloaded
. unloading table                      LOB$     310 rows unloaded
. unloading table                  COLTYPE$    1608 rows unloaded
. unloading table                     TYPE$    1407 rows unloaded
. unloading table               COLLECTION$     385 rows unloaded
. unloading table                ATTRIBUTE$    5989 rows unloaded
. unloading table                  LOBFRAG$       1 row  unloaded
. unloading table              LOBCOMPPART$       0 rows unloaded
. unloading table                     UNDO$
DUL: Error: Trailer byte missing in negative number
DUL: Error: Column conversion failed! (type# = 2,(NUMBER))
0000000000 0203                                ..
DUL: Error: Col# 11:Column Conversion driver failed
DUL: Error: while processing row 25
DUL: Error: While processing ts# 0 file# 1 block# 225
    1160 rows unloaded
. unloading table                       TS$      59 rows unloaded
. unloading table                    PROPS$      36 rows unloaded
Reading USER.dat 47 entries loaded
Reading OBJ.dat 29335 entries loaded and sorted 29335 entries
Reading TAB.dat 4969 entries loaded
Reading COL.dat 116725 entries loaded and sorted 116725 entries
Reading TABPART.dat 2385 entries loaded and sorted 2385 entries
Reading TABCOMPART.dat 112 entries loaded and sorted 112 entries
Reading TABSUBPART.dat 4139 entries loaded and sorted 4139 entries
Reading INDPART.dat 1180 entries loaded and sorted 1180 entries
Reading INDCOMPART.dat 0 entries loaded and sorted 0 entries
Reading INDSUBPART.dat 0 entries loaded and sorted 0 entries
Reading IND.dat 4040 entries loaded
Reading LOB.dat 310 entries loaded
Reading ICOL.dat 9213 entries loaded
Reading COLTYPE.dat 1608 entries loaded
Reading TYPE.dat 1407 entries loaded
Reading ATTRIBUTE.dat 5989 entries loaded
Reading COLLECTION.dat 385 entries loaded
Reading BOOTSTRAP.dat 60 entries loaded
Reading LOBFRAG.dat 1 entries loaded and sorted 1 entries
Reading LOBCOMPPART.dat 0 entries loaded and sorted 0 entries
Reading UNDO.dat
DUL: Notice: Increased the size of DC_UNDO_SEGMENTS from 256 to 1024 entries
DUL: Notice: Increased the size of DC_UNDO_SEGMENTS from 1024 to 8192 entries
 1160 entries loaded
Reading TS.dat 59 entries loaded
Reading PROPS.dat 36 entries loaded
Database character set is ZHS16GBK
Database national character set is AL16UTF16

---desc查看一下已经可以查到需要的表了

DUL> desc testdb.T_testdb_test_LOG;
Table testdb.T_testdb_test_LOG
obj#= 927171, dataobj#= 927171, ts#= 9, file#= 179, block#=1314181
      tab#= 0, segcols= 9, clucols= 0
Column information:
icol# 01 segcol# 01      QRYDATE len   10 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 02 segcol# 02      USER_ID len   10 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 03 segcol# 03     SERIALNO len   30 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 04 segcol# 04      QRYTIME len    8 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 05 segcol# 05    BRANCH_ID len   10 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 06 segcol# 06       ZONENO len   22 type  2 NUMBER(5,0)
icol# 07 segcol# 07         BRNO len   22 type  2 NUMBER(5,0)
icol# 08 segcol# 08      DSRNAME len   10 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 09 segcol# 09     MEDIUMID len  100 type  1 VARCHAR2 cs 852(ZHS16GBK)
DUL>


2.7 抽取数据,抽出的数据文件与dul可执行文件同目录

---因为参数文件中指定了export_mode=true,所以抽取出的数据为dmp格式(exp/imp),否则抽出的数据为.dat结尾(sqlload)

DUL> unload table testdb.T_testdb_test_LOG;
. unloading table      T_testdb_test_LOG  106939 rows unloaded
DUL>

---查看抽出的数据文件(本案例分别用export_mode为false和true各生成了一个文件,正常情况下选择一种就可以了)

[testdb]$pwd
/data2/dul
[testdb]$ll
-rw-r--r-- 1 oracle dba      785  6?? 30 14:57 testdb_T_testdb_test_LOG.ctl
-rw-r--r-- 1 oracle dba 12909961  6?? 30 14:57 testdb_T_testdb_test_LOG.dat     <<<export_mode=false下生成的格式
-rw-r--r-- 1 oracle dba 11804793  6?? 30 15:12 testdb_T_testdb_test_LOG.dmp     <<<export_mode=true下生成的格式


2.8将抽出的.dmp文件使用imp导入到一个其它正常开启的库

[testdb]$export ORACLE_SID=CBST
[testdb]$imp maintain_user/abcd1234 file=testdb_T_testdb_test_LOG.dmp log=imp_1.log full=y




Import: Release 11.2.0.3.0 - Production on Tue Jun 30 15:15:44 2020




Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.






Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option




Export file created by EXPORT:V07.00.07 via conventional path




Warning: the objects were exported by Bernard's DUL, not by you




. importing Bernard's DUL's objects into MAINTAIN_USER
. importing Bernard's DUL's objects into MAINTAIN_USER
. . importing table         "T_testdb_test_LOG"     106939 rows imported
Import terminated successfully without warnings.
[testdb]$


---数据恢复成功,可以查看到数据了

[testdb]$sqlplus user/password
SQL> select count(*) from T_testdb_test_LOG;




  COUNT(*)
----------
    106939




SQL>


3.类似DUL的商业恢复软件

前面已经介绍DUL作为oracle内部的数据恢复工具,使用是受到严格控制的,询问过几位oracle原厂朋友,确认现在oracle内部也无法下载到最新的DUL工具,但是在早些年DUL可以使用的时候,国内一些oracle大佬或以DUL为底座或基于DUL抽数原理,做了优化和本地化适配,开发出一些类似DUL的数据抽取工具,这里列举几个:

云和恩墨老熊(熊军)的ODU

原支付宝DBA(Anysql)楼方鑫的AUL

诗檀软件刘相兵的PRM-DUL

当然如果你的数据库需要使用这些工具来恢复了,那大概率多少都是需要花点钱了,试用版本基本都有数据量,文件个数等限制。曾经使用AUL恢复被Lockbit3.0加密的数据库,基本上可以恢复95%以上的数据(毕竟还是有部分加密block无法抽取),对于已经成死马的企业来说 也是莫大的欣慰了!

最后的叮嘱:请一定做好备份!这非常重要!希望大家都不会用到DUL类工具!

相关推荐

验证IronPython的ScriptEngine和ScriptScope的兼容性验证机制?

测试和验证IronPython兼容性机制的完整指南IronPython的ScriptEngine和ScriptScope兼容性验证机制需要通过多层次测试确保其正确性。以下是系统化的测试方法和实践...

C#+Python 热更新技术在游戏开发中的核心应用场景

一、核心玩法逻辑动态更新1.战斗系统实时调优技能逻辑热更新:通过Python动态修改技能伤害公式、特效触发条件,例如:python#实时调整法师大招伤害系数defupdate_firest...

不到100行代码制作各种证件照

文|某某白米饭来源:Python技术「ID:pythonall」生活中经常需要使用各种版本的电子版证件照,如:红底、蓝底、白底、一寸、两寸等等。在Python中替换图片背景色可以用Ima...

python从入门到脱坑 输入与输出——print()函数

大家好今天开始系统的讲解一些入门课程,遇到不会的也不用想太多,跟着写一遍,学习到新内容是你就会明白.以下是针对Python初学者的print()函数详解,从基础到实用技巧,配合清晰示例:一、最基础用法...

外婆都能学会的Python教程(七):Python中循环语句

前言Python是一个非常容易上手的编程语言,它的语法简单,而且功能强大,非常适合初学者学习,它的语法规则非常简单,只要按照规则写出代码,Python解释器就可以执行。下面是Python的入门教程循环...

解释一下Python脚本中版本号声明的作用

在Python脚本中声明版本号(如__version__变量)是一种常见的元数据管理实践,在IronPython的兼容性验证机制中具有重要作用。以下是版本号声明的核心作用及实现原理:一、版本号...

除了版本号声明,还有哪些元数据可以用于Python脚本的兼容性管理

在Python脚本的兼容性管理中,除了版本号声明外,还有多种元数据可以用于增强脚本与宿主环境的交互和验证。以下是一些关键的元数据类型及其应用场景:一、环境依赖声明1.Python版本要求pyth...

使用python实现人脸检测

一,准备dlib库下载:提取码1111dlib环境配置数据集下载python3.8opencv3.4.11二,代码老规矩,先导入包#导入包importnumpyasnpimport...

Python

fromdjango.shortcutsimportrenderfromdjango.httpimportHttpResponseRedirectfromdjango.core.ur...

如何用Python画一个简单的笑脸

写在前面Python画画,必不可少的要用到小乌龟turtle库函数。对所用到的函数进行说明一下:fromturtleimport*#包含turtle库里面所有的函数,这样写可以不用标名hid...

习惯了各种框架的文件上传,php原生上传图片你还记得吗?

序言:如今各种框架层出不穷,如thinkphp、laravel、yii等,对于功能的封装也是各显其能,以至于很多开发者离开了框架之后就不会开发了,今天我以实际的例子介绍最基本的图片上传功能,希望对一些...

php源码开发的商城系统有什么优点

1、php是一种流行的脚本语言,它编写的程序更容易被人理解。2、php的函数非常丰富,可以通过这些函数来进行开发,而不需要关注代码本身。3、php是一种面向对象的程序语言,它不像Java和...

php宝塔搭建实战Dinner订餐系统php源码

大家好啊,欢迎来到web测评。本期给大家带来一套php开发的Dinner订餐系统php源码,上次是谁要的系统项目啊,帮你找到了,还说不会搭建,让我帮忙录制一期教程,趁着今天有空,简单的录制测试了一下,...

php宝塔搭建实战美食小吃网站系统php源码

大家好啊,我是测评君,欢迎来到web测评。本期给大家带来一套pbootcms开发的美食小吃网站系统php源码,感兴趣的朋友可以自行下载学习。技术架构PHP7.0+nginx+sqlite+...

php中assert和eval的详细介绍(代码示例)

本篇文章给大家带来的内容是关于php中assert和eval的详细介绍(代码示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。assert判断一个表达式是否成立。返回trueo...