Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

FileDestroyer Secure file removal TOOL

Well I originally wrote this https://hackforums.net/showthread.php?tid=4920390

And well I kinda wanted to add a little bit more functionality. So I added Multiple file support, tried to optimize my code as best as I could and add multithreading to the delete file method

Video:





Q & A

Q:
(Jul 24, 2015 11:13 PM)d3agle Wrote:  Nice source, but I'm a little confused why you are encrypting the temporary file in memory, and only writing zeros to disk... Kind of defeats the purpose of the encryption, right? :P

A:
(Jul 25, 2015 10:41 AM)Immortal Wrote:  wanted to make sure that no trails of data were left behind for lets say a forensic data analysis team. That way if there were tiny bits in the ram that didnt get changed to zeros do to some kind of anomaly the data is encrypted. So I take the size of the file to a byte[] and then encrypt the one in the memory and overwrite with 0's to make sure it's gone then delete the file.
Q:
What size file will this support?
A:
Not sure the most I tested with was 15 files that were 25.6MB and a single file that was 996MB. The program did not crash it removed all the smaller files first and idled as it deleted the big one, Took about 3mins.
Links

MAKE REP GREAT AGAIN 2027
Could you release the code on Github or something? It's a legit program with a white-hat practical use. Would love to be able to pull the source directly instead of downloading a random zip!



--
Programmer for Hire
{C#/.NET/Rust/Go/Java/PHP}


(Jul 27, 2015 12:02 PM)FeatureBug Wrote:  Could you release the code on Github or something? It's a legit program with a white-hat practical use. Would love to be able to pull the source directly instead of downloading a random zip!

Done and Done, Also working on some new cool features to make this application the perfect tool. Once I'm comfortable with the feature then I'm going to optimize the cod to the best of my knowledge again..

A sneakpeak of some of what im working on.

[Image: bUFYWeX.png]
oh btw DO NOT TRY TO REMOVE 15 900MB files it will crash your pc. xD thats on my tofix list!
MAKE REP GREAT AGAIN 2027
(Jul 27, 2015 01:52 PM)Immortal Wrote:  Done and Done, Also working on some new cool features to make this application the perfect tool. Once I'm comfortable with the feature then I'm going to optimize the cod to the best of my knowledge again..

Cheers man! Few changes I'd make, but it looks shit hot. Well done ;) I'll submit a merge request once I get my .NET dev environment set up on this machine... If I even should. I'm not running Windows!



--
Programmer for Hire
{C#/.NET/Rust/Go/Java/PHP}


No offence Chris, but this is probably the 40598509486645th file destroyer we had in this section.
It's a nice project you got going.

It looks like you only do 1 pass on each file. If you REALLY wanted to be secure you could do more. It'd take some serious work to get past one pass in my opinion.
https://en.wikipedia.org/wiki/Gutmann_method
[Image: FiNQfeW.jpg]

It is believed data can be recovered from hard drives even after 3 passes.

Expanding security can be a small addition if you like coding for fun.

Edit: Some thing else you can look at: https://en.wikipedia.org/wiki/Data_recovery
(Jul 28, 2015 11:23 AM)Cr1p Wrote:  It's a nice project you got going.

It looks like you only do 1 pass on each file. If you REALLY wanted to be secure you could do more. It'd take some serious work to get past one pass in my opinion.
https://en.wikipedia.org/wiki/Gutmann_method
[Image: FiNQfeW.jpg]

It is believed data can be recovered from hard drives even after 3 passes.

Expanding security can be a small addition if you like coding for fun.

Edit: Some thing else you can look at: https://en.wikipedia.org/wiki/Data_recovery
Thankyou very much for this information this data removal and bytes are fascinating me currently.
MAKE REP GREAT AGAIN 2027
(Jul 28, 2015 11:53 AM)Immortal Wrote:  Thankyou very much for this information this data removal and bytes are fascinating me currently.
No worries man - I was the same when I found out about this stuff.
Have fun with it before it gets boring.
Not to be antagonistic towards the code, as I actually like it, but I would just like to point out the frustrating fact that the strings used in C# are pretty much plain-view. In response to d3agle 's question, I just felt it was important to note the (reasonable) possibility of finding some of the plain-text string's values somewhere down the line.
Wanted to note that within NTFS, files < 1024 bytes are also stored within the $MFT record. In short, don't entirely rely on file shredders especially not on anything less than a meg in size (which often text files are).
(Jul 31, 2015 03:41 PM)posixg0d Wrote:  Wanted to note that within NTFS, files < 1024 bytes are also stored within the $MFT record. In short, don't entirely rely on file shredders especially not on anything less than a meg in size (which often text files are).

I have a question about this, Would pumping a file full of random data to make it 2mb and then shredding it would that achieve the effect I'm looking for.
MAKE REP GREAT AGAIN 2027
Code
var newData = new byte[fi.Length];

      for (var i = 0; i < newData.Length; i++)
      {
      newData[i] = 0x0;
      }

      using (Stream s = File.Open(filePath, FileMode.Open))
      {
      s.Position = 0x0;
      s.Write(newData, 0, newData.Length);
      s.Close();
      }

Why do you initialize the array before writing if you know it's just gonna be 00's? After looking over your code quickly this is most likely a big factor to why your application crashes. Additionally, why do you call GC.Collect(); ( https://github.com/Immortal-/FileDestroy...er.cs#L351 ). I can almost guarantee you it doesn't do what you think it does and it's completely useless in your situation.
Probably coding some useless shit.
(Aug 1, 2015 01:58 AM)ubbelol Wrote:  
Code
var newData = new byte[fi.Length];

      for (var i = 0; i < newData.Length; i++)
      {
      newData[i] = 0x0;
      }

      using (Stream s = File.Open(filePath, FileMode.Open))
      {
      s.Position = 0x0;
      s.Write(newData, 0, newData.Length);
      s.Close();
      }

Why do you initialize the array before writing if you know it's just gonna be 00's? After looking over your code quickly this is most likely a big factor to why your application crashes. Additionally, why do you call GC.Collect(); ( https://github.com/Immortal-/FileDestroy...er.cs#L351 ). I can almost guarantee you it doesn't do what you think it does and it's completely useless in your situation.

Why do you initialize the array before writing if you know it's just gonna be 00's?

The way I was explained arrays (no real .net code education) was when you initialize them you must provide how big the array is or is going to be so, to overwrite the whole file I got to offset 0x0 and then fill the filesize with zeros.
my question is how else would you do this?

Additionally, why do you call GC.Collect();
This was to clear the memory of the program, and it was not supposed to be in this version, The version I currently have has a graph that when it is being used it causes a weird memory bug that when the graph is on the ram just fills up to 100% and then crashes unless after each file I do GC.Collect();
this is a feature that will be removed evently.
MAKE REP GREAT AGAIN 2027
(Aug 1, 2015 09:27 AM)Immortal Wrote:  Additionally, why do you call GC.Collect();
This was to clear the memory of the program, and it was not supposed to be in this version, The version I currently have has a graph that when it is being used it causes a weird memory bug that when the graph is on the ram just fills up to 100% and then crashes unless after each file I do GC.Collect();
this is a feature that will be removed evently.

Good idea. I've learned calling GC.Collect() is never a good idea... The best way to handle this is to find the source of the issue, and properly handle it to the best of your ability.
(Aug 1, 2015 09:27 AM)Immortal Wrote:  The way I was explained arrays (no real .net code education) was when you initialize them you must provide how big the array is or is going to be so, to overwrite the whole file I got to offset 0x0 and then fill the filesize with zeros.
my question is how else would you do this?

You're right you have to initialize an array with a size. What I meant was you don't need to write the entire buffer in one chunk like you do right now, that is memory suicide. Take advantage of streams and write it in smaller chunks.

(Aug 1, 2015 09:27 AM)Immortal Wrote:  This was to clear the memory of the program, and it was not supposed to be in this version, The version I currently have has a graph that when it is being used it causes a weird memory bug that when the graph is on the ram just fills up to 100% and then crashes unless after each file I do GC.Collect();
this is a feature that will be removed evently.

There's almost never a reason to manually call GC.Collect, at least for the kind of stuff people do here on HF. If you have a memory leak then work on trying to find it instead of cheap workarounds.
Probably coding some useless shit.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Tha SneakMar 13, 2025 07:05 PM 4 235 Mar 13, 2025 07:05 PM
Last Post: Tha Sneak
[C#] by PaskowskyJul 30, 2020 12:38 AM 10 403 Jul 30, 2020 12:38 AM
Last Post: Exalted
[Shell] by PhloxAug 28, 2017 02:37 PM 0 111 Aug 28, 2017 02:37 PM
Last Post: Phlox