homepage
Open menu
Go one level top
  • Train and Certify
    Train and Certify

    Immediately apply the skills and techniques learned in SANS courses, ranges, and summits

    • Overview
    • Courses
      • Overview
      • Full Course List
      • By Focus Areas
        • Cloud Security
        • Cyber Defense
        • Cybersecurity and IT Essentials
        • DFIR
        • Industrial Control Systems
        • Offensive Operations
        • Management, Legal, and Audit
      • By Skill Levels
        • New to Cyber
        • Essentials
        • Advanced
        • Expert
      • Training Formats
        • OnDemand
        • In-Person
        • Live Online
      • Course Demos
    • Training Roadmaps
      • Skills Roadmap
      • Focus Area Job Roles
        • Cyber Defence Job Roles
        • Offensive Operations Job Roles
        • DFIR Job Roles
        • Cloud Job Roles
        • ICS Job Roles
        • Leadership Job Roles
      • NICE Framework
        • Security Provisionals
        • Operate and Maintain
        • Oversee and Govern
        • Protect and Defend
        • Analyze
        • Collect and Operate
        • Investigate
        • Industrial Control Systems
    • GIAC Certifications
    • Training Events & Summits
      • Events Overview
      • Event Locations
        • Asia
        • Australia & New Zealand
        • Latin America
        • Mainland Europe
        • Middle East & Africa
        • Scandinavia
        • United Kingdom & Ireland
        • United States & Canada
      • Summits
    • OnDemand
    • Get Started in Cyber
      • Overview
      • Degree and Certificate Programs
      • Scholarships
    • Cyber Ranges
  • Manage Your Team
    Manage Your Team

    Build a world-class cyber team with our workforce development programs

    • Overview
    • Why Work with SANS
    • Group Purchasing
    • Build Your Team
      • Team Development
      • Assessments
      • Private Training
      • Hire Cyber Professionals
      • By Industry
        • Health Care
        • Industrial Control Systems Security
        • Military
    • Leadership Training
  • Security Awareness
    Security Awareness

    Increase your staff’s cyber awareness, help them change their behaviors, and reduce your organizational risk

    • Overview
    • Products & Services
      • Security Awareness Training
        • EndUser Training
        • Phishing Platform
      • Specialized
        • Developer Training
        • ICS Engineer Training
        • NERC CIP Training
        • IT Administrator
      • Risk Assessments
        • Knowledge Assessment
        • Culture Assessment
        • Behavioral Risk Assessment
    • OUCH! Newsletter
    • Career Development
      • Overview
      • Training & Courses
      • Professional Credential
    • Blog
    • Partners
    • Reports & Case Studies
  • Resources
    Resources

    Enhance your skills with access to thousands of free resources, 150+ instructor-developed tools, and the latest cybersecurity news and analysis

    • Overview
    • Webcasts
    • Free Cybersecurity Events
      • Free Events Overview
      • Summits
      • Solutions Forums
      • Community Nights
    • Content
      • Newsletters
        • NewsBites
        • @RISK
        • OUCH! Newsletter
      • Blog
      • Podcasts
      • Summit Presentations
      • Posters & Cheat Sheets
    • Research
      • White Papers
      • Security Policies
    • Tools
    • Focus Areas
      • Cyber Defense
      • Cloud Security
      • Digital Forensics & Incident Response
      • Industrial Control Systems
      • Cyber Security Leadership
      • Offensive Operations
  • Get Involved
    Get Involved

    Help keep the cyber community one step ahead of threats. Join the SANS community or begin your journey of becoming a SANS Certified Instructor today.

    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    About

    Learn more about how SANS empowers and educates current and future cybersecurity practitioners with knowledge and skills

    • SANS
      • Overview
      • Our Founder
      • Awards
    • Instructors
      • Our Instructors
      • Full Instructor List
    • Mission
      • Our Mission
      • Diversity
      • Scholarships
    • Contact
      • Contact Customer Service
      • Contact Sales
      • Press & Media Enquiries
    • Frequent Asked Questions
    • Customer Reviews
    • Press
    • Careers
  • Contact Sales
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Rapier: A Different Data Carver
Keven Murphy

Rapier: A Different Data Carver

January 20, 2009

Rapier is a data carver written for Linux. It is a bit different than the other ones out there. First of all, the data carver treats the input file as a stream of data. For example, if the header/word is broken up between cluster/sector boundaries, Rapier doesn't see the data divided up between the clusters/sectors. Instead, it ignores these boundaries. Secondly, headers and footers (footers are not 100% implemented yet) can be up to 100 bytes/characters long. Third, there are a few built-in search patterns. Those are index.dat and registry files. Like most data carvers, it doesn't review the data it carves out to see if it is good data. That part is left to the forensics examiner.

Every byte on the drive is reviewed by Rapier. I realize that this can make it run long as compared to other data carvers. But I have good reasons for that. About a year ago I was using Foremost trying to recover some WMV files for a case I was working. Foremost was able to recover two files. I ran PhotoRec on the drive while reviewing the Foremost output. Photorec found a couple more than Foremost. After that, it got me wondering if either tool had found all of the wmv files. Then I used Sigfind,which identified a total of eight files. I ended up carving them out by hand.

Based upon that experience, I was thinking that the Boyer-Moore string search (see Foremost's engine.c file) that Foremost used was missing things. In the end, I decided it might be fun to write my own. Let me say that it was an interesting challenge and continues to be.

Author's Note: I mean no disrespect to the people who wrote and maintain Foremost and PhotoRec. I use both pieces of software every day. Both of them are great tools. Neither am I saying that Rapier is the best thing since sliced bread. It is just that, sometimes, you need to use a different tool.

How To Run Rapier

Just running Rapier without any command line arguments shows the following:

Rapier 0.2 Alpha -c {config_filename} -f {filename} -l log {filename} [-b bsize] [-t] [-v]
Note: [] optional command arguments.
    -c   Config file
    -f   Input filename
    -l   Log filename
    -b   Block size -- Default is 512
    -t   Put starting date & time and ending date & time in the logs
    -v   Verbose

Running Rapier is pretty easy. The steps below outline the general process:

  1. Rapier requires an image to review. You can either give it a dd image, device (/dev/hda1 for example), or a blkls file that consists of unallocated space or slack space.
  2. Adjust the rapier.conf file to what you are looking for.
  3. Run Rapier:
    # ./rapier -v -t -c rapier.config  -f image_file.unallocated.dd -b 4096 -l rapier.log

File Recovery

Rapier automatically recovers the files after it has completed its scan. In the directory you ran Rapier from, you will find the files Rapier recovered in the following filename format: {extension}-{starting offset}-{ending offset}.{extension}. For example an index.dat file might have the following name: dat-26215424-26248192.dat. In a future release, I plan on creating directories based upon the extension and putting those files in the respective directory.

Rapier Files and Log Output

Rapier creates three additional files besides the ones it recovers. The first is the log file given by the -l option. The second is CSV file, {log file}.csv, that contains a table of the files it finds with the starting and ending offsets. The third file is a binary file that has the name of {log file}.found.dat. This file contains binary data of the files Rapier has found with the offset information. I thought it might be handy to be able to recovery the files without re-scanning the entire drive. This option is something I am working for the next version.

An Example Log File

Rapier Log File
Version: 0.2 Alpha
Copyright by Citadel Systems, L.L.C.
Website: http://www.citadelsystems.net
License: Citadel Systems, L.L.C. grants Licensee a non-exclusive and non-transferable
license to use the Product. Licensee may not use the product for commercial purposes
beyond an initial thirty (30) day evaluation period without the purchase of a commercial
license from Citadel Systems, L.L.C. Commercial purposes include any activity engaged in
for the purpose of directly generating revenue or in support of activity that generates
revenue. This license does not entitle Licensee to receive from Citadel Systems, L.L.C.
hard-copy documentation, technical support, telephone assistance, or enhancements or
updates to the Product.

Rapier started at: Sun Jan 11 15:58:08 2009

Searching for the following
---------------------------
Total Number of headers: 2
Ext.: dat
Header Length (HEX) 10 in bytes:
Header (HEX): 43 6C 69 65 6E 74 20 55 72 6C
Length to get: 10240000

Ext.: txt
Header Length (HEX) 7 in bytes:
Header (HEX): 46 49 4E 44 5F 4D 45
Length to get: 1024

=============================================================================================================================

-----------------------------------------------------------------------------------------------------------------------------
Found txt header at Block/Sector:  79    Offset: 4092  Total Offset: 327676      Additional Bytes Before Header: 10
-----------------------------------------------------------------------------------------------------------------------------
Found dat header at Block/Sector:  6400  Offset: 1024  Total Offset: 26215424    Additional Bytes Before Header: 0
-----------------------------------------------------------------------------------------------------------------------------
Found dat header at Block/Sector:  6528  Offset: 1024  Total Offset: 26739712    Additional Bytes Before Header: 0
-----------------------------------------------------------------------------------------------------------------------------
Found dat header at Block/Sector:  6656  Offset: 1024  Total Offset: 27264000    Additional Bytes Before Header: 0
-----------------------------------------------------------------------------------------------------------------------------

Note: The number in Block/Sector field above is based upon the block size (-b) option in the command line. To figure out the offset of the file based on block/sector and offset within that block/sector it would be: (6656 * 4096 block size) + 1024 = 27264000.

Opening Rapier data file: rapier.log.found.dat

Reading Rapier data file
========================

File -- Header: txt     Total Offset: 327676
Filename: txt-327676-328700.txt          Startpos: 327666        Endpos: 328700          Filelength: 1024

File -- Header: dat     Total Offset: 26215424
Filename: dat-26215424-26248192.dat      Startpos: 26215424      Endpos: 26248192        Filelength: 32768

File -- Header: dat     Total Offset: 26739712
Filename: dat-26739712-26772480.dat      Startpos: 26739712      Endpos: 26772480        Filelength: 32768

File -- Header: dat     Total Offset: 27264000
Filename: dat-27264000-27280384.dat      Startpos: 27264000      Endpos: 27280384        Filelength: 16384

Recovery of files done

Rapier finished at: Sun Jan 11 15:58:11 2009

An Example CSV File

"Rapier CSV Log File"
"Version: 0.2 Alpha"
"Copyright by Citadel Systems, L.L.C."
"Website: http://www.citadelsystems.net"
"License: Citadel Systems, L.L.C. grants Licensee a non-exclusive and"
"non-transferable license to use the Product. Licensee may not use the"
"product for commercial purposes beyond an initial thirty (30) day "
"evaluation period without the purchase of a commercial license from "
"Citadel Systems, L.L.C. Commercial purposes include any activity engaged"
"in for the purpose of directly generating revenue or in support of "
"activity that generates revenue. This license does not entitle Licensee"
"to receive from Citadel Systems, L.L.C. hard-copy documentation, "
"technical support, telephone assistance, or enhancements or updates to "


"the Product."

"Rapier started at: Sun Jan 11 15:58:08 2009"

Filename,File Type (Extension),Starting Offset,Ending Offset,File Length

txt-327676-328700.txt,txt,327666,328700,1024
dat-26215424-26248192.dat,dat,26215424,26248192,32768
dat-26739712-26772480.dat,dat,26739712,26772480,32768
dat-27264000-27280384.dat,dat,27264000,27280384,16384

"Rapier finished at: Sun Jan 11 15:58:11 2009"

Other Suggested Uses

Word Searches

Version 0.2 does something new. It can be configured to search for a word then pull out X number of bytes before the word and after the word. This feature came in handy when I was doing my forensics review for Toad SQL logs (see my blog on Oracle Forensics: Toad from Quest Software). I was able to find my keyword and then pull out 4096 bytes before my keyword. Also, I set the total file size to be 8192 bytes, which includes the 4096 bytes before my keyword + keyword + what ever is left to make a total of 8192 bytes. For example, my keyword length is 10, Rapier would grab 4096 bytes before my keyword + 10 (keyword length) + 4082 bytes after my keyword = 8192 bytes total.

ascii_config_generator.pl For Generating Rapier Config Files From Keywords

Located under the tools directory, in the Rapier file download, is a ASCII to hex converter. If you have a list of keywords use this to create your rapier.config file. Below is from the output of ascii_config_generator.pl -man.

ascii_config_generator.pl [options]

Options:
    --help            Brief help message
    --man             Full documentation
    --wordfile {file} File containing the wordlist. Note: 1 word per line.
    --output {file}   New Rapier config file
    --beforetext {#}  How many bytes to grab before keyword. Default: 1024. Optional.
    --totallength {#} Total length to grab. Default: 4096. Optional.
    --nocase          Do not create lines with uppper and lower case. Optional.

Below is an example of it being ran at the command line:

<strong>#</strong>  ./ascii_config_generator.pl --wordfile keywords.txt \
   --output new_rapier.config --beforetext 512 --totallength 4096

Sample Output From The Script

hello,\x68\x65\x6C\x6C\x6F,,512,4096
Dodge_Charger,\x44\x6F\x64\x67\x65\x5F\x43\x68\x61\x72\x67\x65\x72,,512,4096
Daytona,\x44\x61\x79\x74\x6F\x6E\x61,,512,4096
HELLO,\x48\x45\x4C\x4C\x4F,,512,4096
DODGE_CHARGER,\x44\x4F\x44\x47\x45\x5F\x43\x48\x41\x52\x47\x45\x52,,512,4096
DAYTONA,\x44\x41\x59\x54\x4F\x4E\x41,,512,4096
hello,\x68\x65\x6C\x6C\x6F,,512,4096
dodge_charger,\x64\x6F\x64\x67\x65\x5F\x63\x68\x61\x72\x67\x65\x72,,512,4096
daytona,\x64\x61\x79\x74\x6F\x6E\x61,,512,4096

The script will generate three lines for every keyword. The first set of lines, I had three keywords in my list, are converted to hex exactly how they look in the keyword file. The next set is convert into all upper case and the last set is converted into all lower case. The only thing left to do is use the new config file with Rapier.

Screenshots of Rapier

Rapier working — Click on the picture to bring up a larger view.

Additional Headers

If you need headers for files try: http://www.garykessler.net/library/file_sigs.html

Download

Download it at: http://www.citadelsystems.net/index.php/forensics-tools/34-data-carver/46-rapier

Keven Murphy, GCFA Gold #24, is an IT security manager contracted to a Fortune 100 defense contractor.

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
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
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
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
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

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tags:
  • Digital Forensics and Incident Response

Related Content

Blog
CTI_Blog_Image.png
Incident Response & Threat Hunting, Digital Forensics and Incident Response
January 23, 2023
A Visual Summary of SANS CTI Summit 2023
Check out these graphic recordings created in real-time throughout the event for SANS Cyber Threat Intelligence Summit 2023
370x370-person-placeholder.png
Alison Kim
read more
Blog
FOR577.png
Digital Forensics and Incident Response
September 22, 2022
NEW SANS DFIR COURSE IN DEVELOPMENT | FOR577: LINUX Incident Response & Analysis
FOR577: Linux Incident Response & Analysis course teaches how Linux systems work and how to respond and investigate attacks effectively.
Viv_Ross_370x370.png
Viviana Ross
read more
Blog
Untitled_design-43.png
Digital Forensics and Incident Response, Cybersecurity and IT Essentials, Industrial Control Systems Security, Purple Team, Open-Source Intelligence (OSINT), Penetration Testing and Red Teaming, Cyber Defense, Cloud Security, Security Management, Legal, and Audit
December 8, 2021
Good News: SANS Virtual Summits Will Remain FREE for the Community in 2022
They’re virtual. They’re global. They’re free.
370x370-person-placeholder.png
Emily Blades
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
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
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
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
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

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • © 2023 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn