使用python安全删除 [英] Secure delete with python

查看:126
本文介绍了使用python安全删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我在徘徊是否已经在

python中实现了支持安全删除数据的方法或功能?

我对能够安全擦除数据的东西感兴趣(从单个文件到一堆MB'),这应该在Linux和
Windows。


我在google上试过,但我找不到对我有用的东西。


谢谢非常提前。


Boris Genc

Hi everybody.
I was wandering is there a method or a function already implemented in
python that supports secure deletion of data?

I''m interested in something which is able to securely wipe data (from
single file to bunch of MB''s), and that should run both on Linux and
Windows.

I tried on google, but I hadn''t found anything useful to me.

Thank you very much in advance.

Boris Genc

推荐答案

Boris Genc< boris.genc@REMOVE_mindless_ME .COM>写道:
Boris Genc <boris.genc@REMOVE_mindless_ME.com> wrote:
大家好。
我在徘徊是否有一个方法或功能已在
python中实现,支持安全删除数据?

我对能够安全擦除数据的东西感兴趣(从单个文件到一堆MB),并且应该在Linux和Windows上运行。
Hi everybody.
I was wandering is there a method or a function already implemented in
python that supports secure deletion of data?

I''m interested in something which is able to securely wipe data (from
single file to bunch of MB''s), and that should run both on Linux and
Windows.




当人们谈论安全删除数据时,他们通常意味着要覆盖用于存放<的物理磁盘块。带有随机数据的
文件。你如何做到这一点的细节非常依赖于操作系统(可能还有什么样的文件系统,硬件等等)。更不用说安全

的定义会因数据类型和谁在做而有所不同(即我认为安全可能不会不要和军方一起通过。



When people talk about secure deletion of data, they generally mean
things like over-writing the physical disk blocks that used to hold the
file with random data. The details of how you do this is extremely
operating system dependent (and probably also on what kind of file
system, hardware, etc). Not to mention that the definition of "secure"
will vary with the type of data, and who''s doing it (i.e. what I
consider secure probably doesn''t pass muster with the military).


Boris Genc写道:
Boris Genc wrote:
大家好。
我在徘徊是否有在支持安全删除数据的python中已经实现的方法或函数?

我对能够安全擦除数据的东西感兴趣(从单个文件到单个文件)一堆MB'',这应该在Linux和
Windows上运行。

我试过谷歌,但我没有找到任何有用的东西。

非常感谢您提前。

Boris Genc
Hi everybody.
I was wandering is there a method or a function already implemented in
python that supports secure deletion of data?

I''m interested in something which is able to securely wipe data (from
single file to bunch of MB''s), and that should run both on Linux and
Windows.

I tried on google, but I hadn''t found anything useful to me.

Thank you very much in advance.

Boris Genc



类似


fp = open(path," wb")

for i in range(os.path.getsize(path)):

fp.write(" *")

fp.close()

os.unlink(path)


可能是你可以用便携式方式做的(多个写入阶段与

不同的数据可以提高''安全'')。但是,以便携方式解决的问题不能解决的问题是数据可能存在于

磁盘上的其他位置(例如临时文件,备份,交换文件...... )。除非你知道*确切*

* *不能*是数据的另一个副本,你也必须删除文件系统中所有未使用的
部分 - 一个过程这在很大程度上取决于使用哪个
文件系统。


something like

fp = open(path, "wb")
for i in range(os.path.getsize(path)):
fp.write("*")
fp.close()
os.unlink(path)

is probably all you can do in a portable way (multiple write phases with
different data could improve the ''security''). But a problem that cannot be
solved in a portable way is that the data might exist at other locations on the
disk (e.g. temporary file, backup, swapfile...). Unless you know *exactly* that
there *cannot* be another copy of the data, you would have to erase all unused
parts of the filesystem, too - a process that heavily depends on which
filesystem is used.


Benjamin Niemann写道:
Benjamin Niemann wrote:
Boris Genc写道:
Boris Genc wrote:
大家好。
我在徘徊是否有一个方法或功能已在
python中实现,支持安全删除数据?

我对能够安全擦除数据的东西感兴趣(从单个文件到一堆MB),并且应该在Linux和Windows上运行。

我试过google,但是我没有发现任何对我有用的东西。

非常感谢你。

Boris Genc
Hi everybody.
I was wandering is there a method or a function already implemented in
python that supports secure deletion of data?

I''m interested in something which is able to securely wipe data (from
single file to bunch of MB''s), and that should run both on Linux and
Windows.

I tried on google, but I hadn''t found anything useful to me.

Thank you very much in advance.

Boris Genc





fp = open(path," wb")
for i in range(os.path.getsize(path)) :
fp。写(" *")
fp.close()
os.unlink(路径)



something like

fp = open(path, "wb")
for i in range(os.path.getsize(path)):
fp.write("*")
fp.close()
os.unlink(path)




并不能保证这个实际上会覆盖旧文件。

文件系统可以选择在磁盘的另一个位置写入新内容,

保持原始数据不变。



and there is no guarantee that this actually overwrites the old file. The
filesystem may choose to write the new content at another location of the disk,
leaving the original data untouched.


这篇关于使用python安全删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆