[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Securely deleting *Windows* files (was Re: simple way to securely destroy deleted files in a file system)



On 07/16/2010 11:10 AM, H.S. wrote:
On 10-07-16 12:00 PM, Ron Johnson wrote:

Aren't you askig the wrong list?


The filesystem is vfat, files are being deleted from within Linux using
Linux tools and the partition just happens to be a Windows installation*
but could be any generic storage device. So, no.

I presume you are implying that I ask on a Windows list. Please correct
me if I am wrong. If I am not, it would be the wrong list to ask about
using dd to delete files, unless dd is developed, or at least also being
supported, by MS.


I don't think you can of= just the "empty" parts of your partition.

Attached is a Python script I use to "zero" out the free space of a mounted partition.

--
Seek truth from facts.
#!/usr/bin/python

import sys, statvfs, os
import time
import traceback
import math

__buff = ''

def write_buff(f, buff_size):
    global __buff
    stats = os.statvfs(loc)
    free_bytes = stats[statvfs.F_BSIZE] * stats[statvfs.F_BFREE]
    if free_bytes < buff_size:
        __buff = chr(0xFF) * free_bytes
    try:
        f.write(__buff)
        f.flush()
    except:
        print 'write error'
        traceback.print_exc(file=sys.stdout)
        sys.exit()
    return free_bytes - buff_size    

try:
    loc = sys.argv[1]
except:
    print 'need a mount point!!!'
    sys.exit(1)

try:
    stats = os.statvfs(loc)
except:
    print loc + ' is an invalid mount point'
free_bytes = stats[statvfs.F_BSIZE] * stats[statvfs.F_BFREE]
print 'free bytes = ', free_bytes

try:
    buff_size = int(sys.argv[2]) * 2**20 
except:
    buff_size = 16 * 2**20
__buff = chr(0xFF) * buff_size

f = open(loc+'/oooooooo.ooo', 'wb')

start_tm = time.time()
start_st = time.localtime(start_tm)
print 'Starting at ', time.strftime('%Y-%m-%d %H:%M:%S', start_st)

c = 0
bytes_free = free_bytes
try:
    while bytes_free >= 0:
        bytes_free = write_buff(f, buff_size)
        c += 1
        if int(math.fmod(c, 500)) == 0:
            print '%s %8d %16d' % (time.strftime('%Y-%m-%d %H:%M:%S'), c, free_bytes - bytes_free)
except:
    print 'Terminating prematurely'
    traceback.print_exc(file=sys.stdout)

f.close()

os.remove(loc+'/oooooooo.ooo')

end_tm = time.time()
end_st = time.localtime(end_tm)
print 'Stopping at ', time.strftime('%Y-%m-%d %H:%M:%S', end_st)
elapsed = end_tm - start_tm
print 'Elapsed minutes: %10.2f' % (elapsed*1.0/60,)

Reply to: