Giter Site home page Giter Site logo

ntfsrecover's Introduction

Introduction

Dead-simple (and somewhat stupid) NTFS data-recovery program. Works with Python 2.7 or Python 3.x, no dependencies. It can be used to recover deleted files or files off of damaged drives, although recovery quality will depend on how badly the file data has been damaged or overwritten.

Warning: to avoid data loss, please use this on a clean clone of the disk (e.g. by using ddrescue), rather than on the original disk. This program will read large swaths of the disk (specifically the entire Master File Table), which may stress an already damaged disk. Making a clean copy ensures that you can rerun the program as many times as you want without further data loss.

Motivation

A friend recently had an NTFS drive crash on him, and I happened to have learned about NTFS literally the day before (thanks MMA/TWCTF 2016!). So I put that to good use by writing this NTFS data recovery tool.

Disk paths

You may specify a path to a partition image file (previously created using e.g. ddrescue), or a raw disk path to read directly from the physical disk. Note that the latter should be used with extreme caution if the disk has failed, as it may stress an already-damaged disk to the point of failure.

Specifying disk paths is OS-specific:

Windows

On Windows disk paths should be specified using the device path:

\\.\Harddisk*Partition*

For example, \\.\Harddisk0Partition1 for the first partition on the first drive (note that Harddisk is 0-indexed while Partition is 1-indexed).

The program diskpart may be used to view the disk and partition numbers - use list disk, followed by select disk N, followed by list partition.

Linux

On Linux, disk paths should be specified using /dev paths, which depends on the device type. fdisk -l, parted -l or lsblk can show you which device path to use.

macOS

On macOS, disk paths should be specified using /dev/diskNsM paths. diskutil list will show you all partitions and their corresponding disk paths.

Usage

First, make a backup of your MFT:

python ntfsrecover.py /dev/diskX --save-mft mft

This will also print out the full paths to every single file on your disk. (This will be verbose as hell, but it's very useful!). Next, you can use --pattern in conjunction with --mft to selectively recover files. (--mft saves the program from having to read the MFT again; only file data will need to be read).

python ntfsrecover.py /dev/diskX --mft mft --pattern "*.jpg" --outdir recovered

You can specify --pattern multiple times to recover multiple different kinds of files in one run. It will match either the full path or the filename; thus, you can do things like --pattern "*/My Documents/*".

ntfsrecover's People

Contributors

nneonneo avatar

Watchers

 avatar

Forkers

exhorder6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.