homepage
Open menu Go one level top
  • Train and Certify
    • Get Started in Cyber
    • Courses & Certifications
    • Training Roadmap
    • Search For Training
    • Online Training
    • OnDemand
    • Live Training
    • Summits
    • Cyber Ranges
    • College Degrees & Certificates
    • NICE Framework
    • DoDD 8140
    • Specials
  • Manage Your Team
    • Overview
    • Security Awareness Training
    • Voucher Program
    • Private Training
    • Workforce Development
    • Skill Assessments
    • Hiring Opportunities
  • Resources
    • Overview
    • Reading Room
    • Webcasts
    • Newsletters
    • Blog
    • Tip of The Day
    • Posters
    • Top 25 Programming Errors
    • The Critical Security Controls
    • Security Policy Project
    • Critical Vulnerability Recaps
    • Affiliate Directory
  • Focus Areas
    • Blue Team Operations
    • Cloud Security
    • Digital Forensics & Incident Response
    • Industrial Control Systems
    • Leadership
    • Offensive Operations
  • Get Involved
    • Overview
    • SANS Community
    • CyberTalent
    • Work Study
    • Instructor Development
    • Sponsorship Opportunities
    • COINS
  • About
    • About SANS
    • Why SANS?
    • Instructors
    • Cybersecurity Innovation Awards
    • Contact
    • Frequently Asked Questions
    • Customer Reviews
    • Press Room
  • Log In
  • Join
  • Contact Us
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  1. Home >
  2. Blog >
  3. Robocopy - a Computer Forensics tool?
J. Michael Butler

Robocopy - a Computer Forensics tool?

January 8, 2009

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.

  1. https://blogs.sans.org/computer-forensics/2008/12/01/keeping-evidence-safe-for-litigation/
  2. http://www.sans.org/training/instructors.php#Lee
  3. http://en.wikipedia.org/wiki/Discovery_(law)
  4. http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
  5. http://www.law.com/jsp/legaltechnology/pubArticleLT.jsp?id=1184231195691
  6. http://csrc.nist.gov/publications/nistpubs/800-86/SP800-86.pdf
  7. http://technet.microsoft.com/en-us/library/cc733145.aspx
Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Join the SANS Community to receive the latest curated cybersecurity news, vulnerabilities, and mitigations, training opportunities, plus our webcast schedule.
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kingdom of Saudi Arabia
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia (Slovak Republic)
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

Tags:
  • Digital Forensics and Incident Response

Related Content

Blog
Digital Forensics and Incident Response
January 21, 2021
Things the Community Said About Chris Krebs's CTI Keynote
Chris Krebs Fmr. Director, US Cybersecurity and Infrastructure Security Agency (CISA); Founder, Krebs Stamos Group was the keynote speaker
SANS Institute
read more
Blog
Digital Forensics and Incident Response
January 7, 2021
How You Can Start Learning Malware Analysis
Lenny Zeltser shares a roadmap for getting into malware analysis, with pointers to 10 hours of free recorded content and additional references.
370x370_Lenny-Zeltser.jpg
Lenny Zeltser
read more
Blog
Digital Forensics and Incident Response
September 26, 2019
The State of Malware Analysis: Advice from the Trenches
What malware analysis approaches work well? Which don’t? How are the tools and methodologies evolving? The following discussion–captured as an MP3 audio file–offers friendly advice from 5 malware analysts. These are some of the practitioners who teach the reverse-engineering malware course...
370x370_Lenny-Zeltser.jpg
Lenny Zeltser
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters
  • The Critical Security Controls
  • Focus Areas
  • Blue Team Operations
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
Subscribe to SANS Newsletters
Join the SANS Community to receive the latest curated cybersecurity news, vulnerabilities, and mitigations, training opportunities, plus our webcast schedule.
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kingdom of Saudi Arabia
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia (Slovak Republic)
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe
  • © 2021 SANS™ Institute
  • Privacy Policy
  • Contact
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn