• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    Python
  • Created about 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NTFS data-recovery program written in Python

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/*".

More Repositories

1

2048-ai

AI for the 2048 game
Python
1,069
star
2

sha1collider

Build two PDFs that have different content but identical SHA1 sums.
Python
410
star
3

universal-doom

A single .exe binary which runs DOOM on DOS 6, Windows 95 and Windows 10 (and probably everything in between).
Python
277
star
4

iOS-SOCKS-Server

iOS HTTP/SOCKS proxy server for fake-tethering
Python
259
star
5

eqgrp-free-file

Free sampling of files from the purported Equation Group hack.
Python
177
star
6

pwn-stuff

Miscellaneous utilities and such that I use for pwning. Open sourced since people might find these useful. Be warned: nothing is stable.
Python
129
star
7

ffsend

Python client for Firefox Send
Python
120
star
8

Il2CppVersions

Build scripts & historical header files for every available minor version of Unity's Il2Cpp project
C
108
star
9

ghidra-rickroll

Get rickrolled, right in your favourite NSA reverse engineering tool
C
77
star
10

socks5-ios

SOCKS server for iOS. Handy for defeating tethering speed limits, among other uses.
Objective-C
75
star
11

threes-ai

AI for the game Threes!
Python
57
star
12

iOS-Torrent-Client

A torrent client for iOS which runs on play.js - without sideloading or jailbreaking!
JavaScript
32
star
13

direct-handtracking

DIRECT - Depth IR Enhanced Contact Tracking
C++
30
star
14

fixedint

Fixed-width integers for Python
Python
28
star
15

doublethink

Doublethink challenge from DEF CON 2018
Python
23
star
16

ofxWin8Touch

Windows 8 touch driver for OpenFrameworks using WM_POINTER events
C++
21
star
17

openFrameworks-AndroidStudio

OpenFrameworks modifications to work with Android Studio
19
star
18

sstic-2021

Files for my solution to the SSTIC 2021 challenge
C
15
star
19

firefox-charset-extension

Override Character Encoding extension for Firefox
JavaScript
12
star
20

sublime-replace-with-python

"Replace with Python" for Sublime Text 2
Python
9
star
21

Insta360-X3-Firmware-Tools

Tools for unpacking and repacking firmware images for the Insta360 X3
Python
6
star
22

bgrep

Binary grep with support for sophisticated regexes and grep(1)-like usage
Python
6
star
23

steam-phishing-analysis

Analysis and dissection of a Steam login phishing site.
HTML
6
star
24

sstv-encoder

SSTV encoder for Terebeep challenge at PlaidCTF 2017
Python
5
star
25

net-nrbf

Utilities to dump and process .NET binary-serialized data streams.
Python
4
star
26

pogo-iv-reader

Screenshot-reading IV calculator for Pokemon GO
Python
4
star
27

android_remote_control

Control an Android phone's touchscreen via ADB.
Python
3
star
28

hexacon-2022

Files for my solution to the Hexacon 2022 challenge
Python
3
star
29

pandt

HCI P&T projects
C
3
star
30

libm3

Library for reading and writing Blizzard .m3 model files.
C++
3
star
31

sstic-2023

My writeup for the SSTIC 2023 challenge (https://www.sstic.org/2023/challenge/)
Python
3
star
32

ghidra-skeleton-language

Skeleton language module for Ghidra
Java
2
star
33

sarah2-attack

Cryptanalysis of the Sarah2 pen-and-paper cipher
Python
2
star
34

weka-android

Weka for Android.
Java
1
star
35

ofxGestureCam

OpenFrameworks addon for the Creative Gesture Cam
C
1
star