SANS Digital Forensics and Incident Response Blog

Robocopy - a Computer Forensics tool?

The usual practice for obtaining potential evidence would be to acquire a bit for bit forensic image of the drive and to lock the image up in an evidence safe. Depending upon the legal team's request, one may also replace the original hard drive and keep it in the safe instead of just an image. Another option I like is having a third party acquire the drive on our behalf and keep it in their secure area for us. Sometimes, however, for various reasons, a forensic image may not be feasible. So, then, what is another option?

In a recent e-mail exchange with Rob Lee, I asked him what he thought about using Robocopy as a tool for acquiring files for forensics purposes. What if I wanted to simply preserve files for a litigation hold? I was concerned that using copy tools may affect metadata if those tools change the "last accessed" date on the file(s) collected. (See http://csrc.nist.gov/publications/nistpubs/800-86/SP800-86.pdf section 4.2.3 for a discussion of metadata).

My question to Rob was, for litigation hold purposes, when the case is mainly about the content of the files and not the date and time they were last accessed, could we say that files acquired with Robocopy would be acceptable to opposing counsel? Of course, all my legal type friends would immediately respond, "It depends." I understand that. On the other hand, the files I needed were on a remote PC — (like several states away remote) — and the litigation was not even in the discovery phase.

The upshot of our e-mail exchange was that, sometimes you get the evidence any way you can! We need to show the court, in case of litigation, that we performed due diligence in a timely manner. Armed with that view, I set out to write a script to execute on the computer that would acquire all the files that might be relevant.

To find out the capabilities of Robocopy, refer to the Microsoft TechNet Robocopy page where the parameters are spelled out. In building such a script, you will want to use parameters to avoid copying files you know you don't need. For example, in a single Robocopy command, you can specify all the file extensions you wish to acquire. You may only be interested in .doc and .xls files. If so, only getting those files can simplify your life. In my case, we were looking for files that could have been created in the normal course of business, so — as you will see in my example — we were "grabbing" a fairly extensive list of file types.

Here is a script I wrote for quick acquisition of files for review purposes. The script expects the user to have a portable drive plugged in to which he/she can copy files. This script acquires all files modified since the date specified, and gets everything in all subdirectories that match the file extensions specified. I designed the script to require two parameters. The first parameter is the drive to be searched (letter only — no colon). The second parameter is the earliest date desired. If I enter 20080101, only files modified since 1/1/08 will be acquired. The file extensions are built into the script. So to execute this script, you might type:

NameOfScript c 20080101

Where "NameOfScript" = whatever you named your script, c=drive C:, and 20080101 represents the oldest files you wish to acquire, based on the last date the file was modified.

Also note that every time this script runs, it creates a directory with the same name as the computer name, and appends a dash and the letter of the drive acquired. That way, if you copy a C drive and a D drive, you will end up with two different subdirectories on your target drive.


echo off
cls
if "%1" == "" goto error
if "%2" == "" goto error
echo About to copy files from %1: to %computername%-%1 on portable drive.
echo.
echo.
echo If this is not what you want to do,
echo Use CTRL C to abort now, or else
pause
md %computername%-%1
cd
attrib -h -s %computername%-%1
ver | find "Microsoft" > %computername%-%1Version.txt
type %computername%-%1Version.txt
find "XP" %computername%-%1Version.txt
if "%errorlevel%" == "0" goto XPCommand
echo.
echo Error Level not equal to 0
echo VISTA System....
rem Call the Vista version of Robocopy for the XJ parm. Note no path to robocopy provided.
pause
robocopy %1: %computername%-%1 *.pst *.ost *.out *.xls* *.txt *.doc* *.zip *.csv *.mdb *.ldif *.rtf *.dbf *.prt *.pdf *.tif* /S /COPY:DAT /IA:RASHCNETO /MAXAGE:%2 /TS /FP /XJ /NC /NS /NP /W:0 /R:0 /TEE /LOG:%computername%-%1ROBOLOG.TXT
goto VistaCommand


:XPCommand
echo.
echo Error Level 0
echo XP System....
pause
Scriptsrobocopy %1: %computername%-%1 *.pst *.out *.xls* *.txt *.doc* *.zip *.csv *.mdb *.ldif *.rtf *.dbf *.prt *.pdf *.tif* /S /COPY:DAT /IA:RASHCNETO /MAXAGE:%2 /TS /FP /XJ /NC /NS /NP /W:0 /R:0 /TEE /LOG:%computername%-%1ROBOLOG.TXT


:VistaCommand
echo.
echo.
echo NOTE: This script will NOT automatically acquire files from
echo additional drives or partitions.
echo To acquire from additional drives/partitions, run this script again
echo with the added drive designation as the source.
echo.
echo.
scriptstail %computername%-%1ROBOLOG.TXT
echo.
echo.
echo (Message indicating failed copies: "Access is Denied")
echo Hit CTRL C to exit now, or else Opening log next...
pause
notepad %computername%-%1ROBOLOG.TXT
goto End
:error
echo.
echo.
echo.
echo ERROR - Invalid Syntax
echo.
echo Syntax: ScriptName source yyyymmdd
echo.
echo.
echo NOTE: Do NOT include a : in the source designation! Use only the drive letter.
echo.
echo.
echo For example, ScriptName c 20080101
echo will acquire selected files from the C: drive. Dated from 1/1/08
echo.
echo To acquire from additional drives/partitions, run ScriptName again with
echo the added drive designation as the source.
pause:End

One parameter you may play with is a date range. Robocopy will allow you to establish a minage (minimum age) and a maxage for each file by specifying a date in the format: yyyymmdd. There are a number of other parameters that I use in the above script, also intended to make sure I get what I want and don't get what I don't want. Here are the other parameters I typically use:


/s=get files in subdirectories
/copyall=copy all ntfs metadata (including acls, owner, and audit information)
/copy:DAT=data, attributes, timestamps (no acls, owner info, or audit info)
/eta=estimate % complete (remove to save log space - not helpful if creating a log file)
/IA=include files with these attributes
/maxage=only get files newer than yyyymmdd
/minage=don't get files newer than yyyymmdd
/fp=Displays full path in log whether files are copied or not
/nc=supress output of robocopy file classes
/xj=exclude junctions - for Vista version only to avoid looping through junctions
/ts=display time stamps from source in log
/ns=suppress output of file and directory sizes (saves log space)
/np=turn off % complete so it doesn't clog up log file
/W:0 wait on error for 0 seconds (default is 30 seconds on EVERY failure!)
/R:0 retry on error 0 times (default 1 million!!!)
/tee=echo to terminal in addition to sending to log file
/log:=log to this file name (the script places a file called robocopy.txt in the created directory for future reference)

One other important note on the age parameters: Make sure that the files you need will really fall between the dates you specify! For example, if you want e-mail files (like Outlook pst files) that have messages within your date range, you will not get them if the file has been modified in the last couple of days. Say you want all messages sent/received between 1/1/06 and 1/1/07. If you specify those dates and the pst file was modified yesterday, you will not get the older messages. Therefore, you may wish to add another command to copy the pst files regardless of date, just so you can get the older messages. There may be other files that fall into this category. If that is the case, you may wish to only specify a maximum age (maxage) without specifying a minimum age (minage). That way you will be sure to get everything you need.

There are many other parameters that may be applicable in your situation. Again, I point you to the TechNet Robocopy page for more information.

In short, if the files you need to acquire have not been deleted, Robocopy can be an effective and quick means of grabbing the files you need, especially if the main purpose is a quick review of a particular set of files meeting specific parameters.

J. Michael Butler, GCFA Gold #00056, is an Information Security Consultant employed by a fortune 500 application service provider who processes approximately half of the $5 trillion of residential mortgage debt in the US. He is a certified computer forensics specialist. In addition, he authored the enterprise wide security incident management plan and information security policies for his corporation. He can be reached at jmbutler_1 at hotmail dot com.

https://blogs.sans.org/computer-forensics/2008/12/01/keeping-evidence-safe-for-litigation/

http://www.sans.org/training/instructors.php#Lee

http://en.wikipedia.org/wiki/Discovery_(law)

http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

http://www.law.com/jsp/legaltechnology/pubArticleLT.jsp?id=1184231195691

http://csrc.nist.gov/publications/nistpubs/800-86/SP800-86.pdf

http://technet.microsoft.com/en-us/library/cc733145.aspx

3 Comments

Posted August 31, 2013 at 8:44 PM | Permalink | Reply

garrydam

Nice post.Another software that I am sharing might also help you with some errors .Try and download " Long Path Tool " is also useful in situations where you see these error messages: Cannot read from source file or disk, there has been a sharing violation, cannot delete file or folder, the file name you specified is not valid or too long,
the source or destination file may be in use and many other file managing errors.

Posted October 23, 2013 at 6:42 PM | Permalink | Reply

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent
GSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows versions from widows XP/ 2003 and later.
Go To:>> http://www.gurusquad.com/GSCOPYPRO

Posted November 14, 2013 at 6:35 PM | Permalink | Reply

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent

GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent
GSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows vSCersions from widows XP/ 2003 and later.
Go To:>> http://www.gurusquad.com/GSCOPYPRO