推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
explist
V2EX  ›  Python

如何创建定量大小的文件(用于覆盖隐私数据)

  •  
  •   explist · Dec 1, 2016 · 2912 views
    This topic created in 3624 days ago, the information mentioned may be changed or developed.

    有个 U 盘,虽然隐私数据都被删除了,但怕别人用软件恢复这些数据,所以想创建一个大文件来覆盖整个 U 盘,这个文件应怎么创建?

    with open('test','wb') as f:

          while True:
                if f.tell()>=SIZE: break
                f.write(b'\xFF')
    
    15 replies  •  2016-12-02 20:38:19 +08:00
    update
    update
    Dec 1, 2016
    1
    低格
    choury
    choury
    Dec 1, 2016 via Android
    2
    要用随机数据
    ltyj2003
    ltyj2003
    Dec 1, 2016 via Android
    3
    使用 hd tune 或者 dg 直接填一遍即可。
    hgc81538
    hgc81538
    Dec 1, 2016
    4
    hgc81538
    hgc81538
    Dec 1, 2016
    5
    msg7086
    msg7086
    Dec 1, 2016
    6
    @hgc81538 Windows 也可以用 dd ……不过没 random 所以只能填零。
    flynaj
    flynaj
    Dec 1, 2016
    7
    最简单的格式化一下就行,不要点上快速格式化,让他完全格式化!
    ToughGuy
    ToughGuy
    Dec 1, 2016
    8
    dd if=/dev/zero of=/dev/sdX

    谨慎使用
    jimzhong
    jimzhong
    Dec 1, 2016
    9
    复制几个电影进去就好了
    loading
    loading
    Dec 1, 2016 via Android❤️1
    10
    复制几个小电影进去。


    最好你有你要删除文件的文件名,用那些文件名,有奇效!
    explist
    explist
    OP
    Dec 1, 2016
    11
    没有刚好那么大的电影
    honeycomb
    honeycomb
    Dec 1, 2016
    12
    把这个 U 盘建一个 bitlocker ,然后格式化就可以了。
    virtualworld
    virtualworld
    Dec 1, 2016❤️1
    13
    @explist 随便一款压缩软件都能分卷压缩,用复制模式,等于把电影分成几个等份大小的文件不就完了。
    zjddp
    zjddp
    Dec 2, 2016
    14
    我的做法是有敏感数据的直接物理销毁
    当然,里面数据的价值远远高于设备价值
    Arnie97
    Arnie97
    Dec 2, 2016 via Android❤️1
    15
    import os
    with open('w', 'w') as f:
    f.write(os.urandom(1234567))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4987 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 89ms · UTC 07:03 · PVG 15:03 · LAX 23:03 · JFK 02:03
    ♥ Do have faith in what you're doing.