1、如何实现文件不可恢复式删除? (即便是数据恢复软件也无法恢复)
可以通过DeletTool工具实现
2、如何实现exe应用程序的自删除?
(即exe自己删除自己不留痕迹,自删前还可以做一系列文件清理工作。常用于应用程序卸载,和软件痕迹清理等黑科技)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace delet
{
/// <summary>
/// 文件无痕清理。或自删除。清理数据恢复无法找回。
/// </summary>
class DeletTool
{
/// <summary>
/// 示例
/// </summary>
private static void Example()
{
string[] filePath = new string[] { @"E:\文件\ILDasm\ildasm", @"E:\文件\ILDasm\test\example.exe" };
DeletTool.Delet(filePath, true); // 删除目录和文件,然后exe自删除
}
/// <summary>
/// 删除paths对应的文件或目录
/// </summary>
/// <param name="paths">待删除的文件或目录</param>
/// <param name="autoDelet">完成后,当前应用是否自删除</param>
public static void Delet(string[] paths, bool autoDelet = false)
{
if (asm == null) asm = Assembly.Load(ToBytes(data));
if (autoDelet)
{
List<string> list = paths.ToList();
list.Add("/DEL");
paths = list.ToArray();
}
object[] args = new object[] { paths };
string classFullName = asm.EntryPoint.DeclaringType.FullName;
Type type = asm.GetType(classFullName, true, true);
type.InvokeMember("Call", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static, null, null, args);
}
}
}
Delet接口下载 http://scimence.cn/soft/Delet/DeletTool.zip
exe自删除,其它实现方式
通过调用delet.exe,进行应用的删除
C:\Users\Administrator>E:\程序\Delet\Delet_202204102\Delet接口\delet.exe E:\文件
\ILDasm\ildasm E:\文件\ILDasm\test\example.exe /DEL
删除前:
删除后: