Giter VIP home page Giter VIP logo

rawcopy's Introduction

Introduction
This a console application that copy files off NTFS volumes by using low level disk reading method. 

Syntax
RawCopy /ImageFile:FullPath\ImageFilename /ImageVolume:[1,2...n] /FileNamePath:FullPath\Filename /OutputPath:FullPath /AllAttr:[0|1] /RawDirMode:[0|1|2] /WriteFSInfo:[0|1] /TcpSend:[0|1]

Explanation of parameters
/ImageFile:
The full path and filename of an image file to extract from. If this param is used, then /ImageVolume: must be set. Optional.
/ImageVolume:
The volume number to extract from. If volume is not NTFS nothing will be extracted. Only used with /ImageFile:.
/FileNamePath:
The full path and filename of file to extract. Can also be in the form of Volume:MftRef. Mandatory.
/OutputPath:
The output path to extract file to. Optional. If omitted, then extract path defaults to program directory.
/OutputName:
The output filename. Optional. If omitted, then filename be that of the original filename. Only used to override the original filename.
/AllAttr:
Boolean flag to trigger extraction of all attributes. Optional. Defaults to 0.
/RawDirMode:
An optional directory listing mode. 0 is no print. 1 is detailed print. 2 is basic print. If omitted it defaults to 0. Can be used in conjunction with any of the other parameters, however in order for this it is not possible to define FileNamePath with an MftRef.
/WriteFSInfo:
An optional boolean flag for writing a file with some volume information into VolInfo.txt in the defined output directory.
/TcpSend
An optional boolean flag for indicating that output should be sent over network. If this flag is set, then /OutputPath: value must be IP:PORT or DOMAIN:PORT

This tool will let you copy files that usually are not accessible because the system has locked them. For instance the registry hives like SYSTEM and SAM. Or files inside the "System Volume Information". Or pagefile.sys. Or any file on the filesystem.

It supports input file specified either with full file path, or by its $MFT record number (index number). 

So how do you get the index number of a given file that is not one of the known system files? Since version 1.0.0.13 the functionality of RawDir was ported into RawCopy. That way, one can do a search into directories such as the "System Volume Information" (RawCopy.exe /FileNamePath:"c:\System Volume Information" /RawDirMode:2).

For image files the volume letter in the /FileNamePath: parameter is ignored.

When specifying device paths in /FileNamePath it is possible to access attached devices that does not have any volumes mounted. Examples are HarddiskVolume1, Harddisk0Partition2, HarddiskVolumeShadowCopy1, PhysicalDrive1.

In order to extract files from a shadow copy within an image file, you will have to mount the image file beforehand so that Windows will present a symbolic link to the shadow copy such as \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy60. It is recommended to mount the image with a tool such as Arsenal Image Mounter (which is free).

The /WriteFSInfo: parameter can be useful when scripting since SectorsPerCluster and MFTRecordSize is used with LogFileParser and Mft2Csv.

When using /TcpSend:1 to send output to network you must obviously have something listening on the destination for this to work. For instance netcat. For now, the data is sent as is over network unencrypted.

This version is incompatible with Windows 2000 / NTFS 3.0. I have prepared a special build from v1.0.0.19 that can be used there; https://github.com/jschicht/RawCopy/releases/download/1.0.0.19/RawCopy_v1.0.0.19_.Win2000.zip  Earlier versions have not been tested.


Sample usage

Example for copying the hibernation file off a running system and save it to E:\output\hiberfil_c.sys
RawCopy.exe /FileNamePath:C:\hiberfil.sys /OutputPath:E:\output /OutputName:hiberfil_c.sys

Example for copying the SYSTEM hive off a running system
RawCopy.exe /FileNamePath:C:\WINDOWS\system32\config\SYSTEM /OutputPath:E:\output

Example for extracting the $MFT by specifying its index number, into to the program directory and override the default output filename to MFT_C.bin.
RawCopy.exe /FileNamePath:C:0 /OutputName:MFT_C.bin

Example for extracting MFT reference number 30224 and all attributes including $DATA, and dumping it into C:\tmp:
RawCopy.exe /FileNamePath:C:30224 /OutputPath:C:\tmp /AllAttr:1

Example for accessing a disk image and extracting MftRef ($LogFile) from volume number 2.
RawCopy.exe /ImageFile:e:\temp\diskimage.dd /ImageVolume:2 /FileNamePath:c:2 /OutputPath:e:\out

Example for accessing partition/volume image and extracting file.ext and dumping it into E:\out.
RawCopy.exe /ImageFile:e:\temp\partimage.dd /ImageVolume:1 /FileNamePath:c:\file.ext /OutputPath:e:\out

Example for making a raw dirlisting in detailed mode in c:\$Extend:
RawCopy.exe /FileNamePath:c:\$Extend /RawDirMode:1

Example for making a raw dirlisting in basic mode in c:\System Volume Information inside a disk image file:
RawCopy.exe /ImageFile:e:\temp\diskimage.dd /ImageVolume:1 /FileNamePath:"c:\System Volume Information" /RawDirMode:2

Example for making a raw dirlisting in detailed mode on the root level inside a shadow copy:
RawCopy.exe /FileNamePath:\\.\HarddiskVolumeShadowCopy1:x:\ /RawDirMode:1

Example for extracting $MFT from partition 2 on harddisk 1 and dumping it into e:\out:
RawCopy.exe /FileNamePath:\\.\Harddisk0Partition2:0 /OutputPath:e:\out

Example for extracting $MFT from second volume on PhysicalDrive0, and save it as E:\out\MFT_Pd0Vol2.bin:
RawCopy.exe /FileNamePath:\\.\PhysicalDrive0:0 /ImageVolume:2 /OutputPath:e:\out /OutputName:MFT_Pd0Vol2.bin

Example for extracting $LogFile from system volume and send it over the network:
RawCopy.exe /FileNamePath:c:\$LogFile /TcpSend:1 /OutputPath:10.10.10.10:6666
RawCopy.exe /FileNamePath:c:\$LogFile /TcpSend:1 /OutputPath:www.mypublicdomain.com:6666

rawcopy's People

Contributors

jschicht avatar natocccp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rawcopy's Issues

Rawcopy and "soft" links

When I make a link to a different directory, rawcopy does not copy the whole file.

Example:

mklink /d "c:\asset" "C:"

rawcopy /FileNamePath:c:\asset\hiberfil.sys /OutputPath:c:\temp

The actual size of hiberfil.sys is 6,662,176 KB

The size of the copied hiberfil.sys is 467,456 KB

64-Bit excutable is detected as malware (false positive)

RawCopy64.exe is detected as malware (Microsoft Windows Defender and VirusTotal) for some days.

Building it with the actual version of AutoIt3 and SciTE4Autoit3 (AutoIt3Wrapper) fixed the problem for me.

I am afraid, however, that this solution will be of a short or limited duration only!?

Checksum / hash of generated file is different

Firstly, thanks for this great program.
I'm currently using it to copy Outlook pst files that are locked whist they are in use.

The files are copied correctly and when I look at the file size in Windows they are the same.

However when I check the files in Cygwin using md5sum and openssl sha1 the results don't match.
Digging further using cmp I get the following message: differ: byte 1758375937, line 5547995.

So it seems the difference is small, but it's there.

Is this an issue?

Thanks

Only closed source?

To clarify, these projects are all closed source? The code is not available? Or is the code hosted elsewhere?

ERROR

I have an error during Registery Hive Command:

RawCopy64.exe /FileNamePath:C:\WINDOWS\system32\config\SYSTEM /OutputPath:D:\output

After start;
Error occur:
"Line 17247 (File "C:\RawCopy64.exe"):
Array Variable has incorrect number of subscript or subscript dimension range exceeded"

error

Output NT_USER.DAT file is much larger than source NT_USER.DAT

Hey Jschicht,

Awesome program overall, but I seem to be running into an issue while using Windows Management Instrumentation Command-line (WMIC).

I have RAWCOPY copied to a local adminshare on a target machine and remotely envoke the command using WMIC. The command appears to execute properly, however, the output file is 231,424KB, when the source NT_USER.dat file is only ~3MB. What's interesting is if I copy another file "NT_USER" file, the output size is the same. IE: if I copy NT_USER.INI which is only ~1KB, the output still is 231,424KB.

Any idea what might be causing the issue?

For reference the command I use is:

wmic /node:[REMOTE_IP] process call create "cmd.exe /c \[REMOTEIP][ADMINSHARE]\rawcopy.exe /filenamepath:c:[SOURCEFILEPATH]\NT_USER.DAT /outputpath:\[REMOTEIP][ADMINSHARE]"

Any help is appreciated!

Thank you.

Good day. incompatible with windows

When trying to run rawcopy64.exe on Windows 64 bit i get error :

This version Rawcopy64.exe is incompatible with version Windows

How to resolve this issue?

Thanks in advance

FEATURE Request (not an issue)

First of all thanks for making this great tool.

This would have been a truly amazing tool for the DFIR community if the tool supported wildcards.
For example, it would have been awesome to copy all SAM* files with just one command:
"c:\windows\system32\config\SAM*"

Windows 10

Does rawcopy work in Windows 10?

James

"Error in function CreateFile: Access is denied."

Hello,

I just tried RawCopy while looking for an alternative to Hobocopy that would work on my new Windows10 computer.

It looks like RawCopy requires opening a cmd window as Admin :

c:\Temp\Backup>RawCopy.exe /FileNamePath:c:\Documents\blah\blah.txt
RawCopy v1.0.0.19

Error in function CreateFile: Access is denied.
 for: \\.\c:
CreateFile: Access is denied.

Cheers,

Why does RawCopy ask for Administrator Privilege ?

To my understanding if you have read access to the file, you don't need admin privs to copy it using rawcopy even if Windows protects that file, however, each time I run rawcopy it asks for admin privs by default.

Copy directory

Just curious if rawcopy can copy a directory with/without recurse and not just one file. Possible feature request?

RawCopy and UAC limitations...

Hi to all,

When I try to call to RawCopy or RawCopy64, ever appear the UAC message limitation with indication of author not is recognized. Any solution?

Thanks in advanced,
Oscar.

Error in function CreateFile: Access is denied

Hi,
I'm trying to copy a locked file (.ost) from a remote mapped folder P: (where outlook is running) to another mapped remote folder M: (NAS). Using this command:

RawCopy64.exe /FileNamePath:P:\mypath\myfile.ost /OutputPath:M:\NASpat /OutputName:myfile.ost

Error in function CreateFile: Access is denied. for \.\P:

what i'm doing wrong?
thanks

Destination Ignored

In the current version of RawCopy (1.0.0.10), the destination path and file name are ignored. Instead, the file is copied to the RawCopy directory with the original file name. I have tried both relative and absolute file names to no avail.

Attempted command:
rawcopy-master\rawcopy.exe C:\Users\user\ntuser.dat test.dat
rawcopy-master\rawcopy.exe C:\Users\user\ntuser.dat C:\test.dat

Both results in the file being copied to rawcopy-master\ntuser.dat

Thanks!
David

Feature request - copy out of images

Would be really useful if you could use this tool to copy out files from e01/vhd/vmdk files
Ie rawcopy -I image.vmdk
Always find it annoying when testing to load up the snapshot in xways each time to pull out the registry files I need.

Грубая ошибка в тексте программы

If NOT StringMid($record,1,8) = '46494C45' Then

В этой строке - две грубейших ошибки. Во-первых, автор забыл "0x" перед "46494С45" (это проверка наличия строки FILE в начале записи MFT). Сама по себе работа с бинарными данными в виде шестнадцатеричного строкового представления (сравнение, обрезание и так далее) сразу бросается в глаза как порочная практика в этой программе, и стоило ожидать, что она приведёт к ошибке. И казалось бы, автор должен был это заметить, ведь теперь условие в этой строке должно было бы выполняться каждый раз (и каждый раз выходила бы ошибка), но нет: в этой же строке автор допустил вторую ошибку - неправильное представление о приоритете операторов. Оператор NOT имеет больший приоритет, чем оператор сравнения, а автор забыл (или не знал) об этом. В результате теперь всё наоборот: условие в этой строке НИКОГДА не выполняется, и данная проверка не выполняется.

Doesn't work on 'WindowsApps' Windows 10 folder

Trying to copy a file inside the 'WindowsApps' folder to outside another folder. Rawcopy request administrator rights via UAC which I accept but then rawcopy window closes itself without any message. The file is not copied.

Encrypted Container file

tying to copy veracrypt container file "failure" located at the root of S: drive while it is in currently mounted so I can automate backups while in use because the file itself is quite large at 50gb and growing.

C:\Users\rk\Downloads\RawCopy_v1.0.0.7>rawcopy64 s:\failure q:\backup
RawCopy v1.0.0.6

Error: NtOpenFile returned: 0xC0000043
Opening target file failed, now re-trying with INDX method from parent folder
Error: Cannot get IndexNumber of parent folder

C:\Users\rk\Downloads\RawCopy_v1.0.0.7>rawcopy64 /FileNamePath:S:\failure /OutputPath:Q:\backup
RawCopy v1.0.0.6

Error: File probably locked

C:\Users\rk\Downloads\RawCopy_v1.0.0.7>

Copying a non-existing file copies the mft in its place?

If you run the following command, even though the source file does not exist RawCopy just warns you and then starts copying a file anyway to the destination. Looking at what's created, it appears to be the MFT file (not confirmed). Looks like this started happening on version 1.0.0.13 (1.0.0.12 works as expected).

rawCopy64.exe /FileNamePath:"c:\abcdefg" /OutputPath:"c:\tmp\"

Warning: File not found with regular file search: c:\abcdefg
Writing: abcdefg

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.