SlideShare a Scribd company logo
Forensic Analysts are on the front lines of
computer investigations. This guide aims to
support Forensic Analysts in their quest to
uncover the truth.
grep's strength is extracting information from
text files. grep operates on one or multiple
files when provided with a command line
argument(s) that can also include wildcards:
Example: grep "John" addressbook
Would return the lines that contained the
"John" string in the addressbook text file
Some useful flags:
-A Print number of lines after the match
-B Print number of lines before match
-c Report number of occurrences
-f Reads one or more patterns from a file.
Pattern are terminated by a newline
-h Suppress the file names on the output
-i Ignore case
-l Report matching files, not matching lines
-P Interpret pattern as a Perl Regex
-v Reverse operation: return the lines not
matching the string
The egrep (extended grep) utility can be useful
to match several possible strings at the same
time (in an OR mode):
egrep "John|Peter" addressbook
grep "John|Peter" addressbook
grep/egrep
Purpose
How To Use This Sheet
When performing an investigation it is helpful to be
reminded of the powerful options available to the
investigator. This document is aimed to be a
reference to the tools that could be used.
This sheet is split into these sections:
• Hex File Headers
• grep/egrep
• sort
• awk
• sed
• uniq
• date
• Windows findstr
The key to successful forensics is minimizing
your data loss, accurate reporting, and a
thorough investigation.
File headers are used to identify a file by
examining the first 4 or 5 bytes of its
hexadecimal content.
Filetype Start Start ASCII
Translation
ani 52 49 46 46 RIFF
au 2E 73 6E 64 snd
bmp 42 4D F8 A9 BM
bmp 42 4D 62 25 BMp%
bmp 42 4D 76 03 BMv
cab 4D 53 43 46 MSCF
dll 4D 5A 90 00 MZ
Excel D0 CF 11 E0
exe 4D 5A 50 00 MZP (inno)
exe 4D 5A 90 00 MZ
flv 46 4C 56 01 FLV
gif 47 49 46 38 39 61 GIF89a
gif 47 49 46 38 37 61 GIF87a
gz 1F 8B 08 08
ico 00 00 01 00
jpeg FF D8 FF E1
jpeg FF D8 FF E0 JFIF
jpeg FF D8 FF FE JFIF
Linux bin 7F 45 4C 46 ELF
png 89 50 4E 47 PNG
msi D0 CF 11 E0
mp3 49 44 33 2E ID3
mp3 49 44 33 03 ID3
OFT 4F 46 54 32 OFT2
PPT D0 CF 11 E0
PDF 25 50 44 46 %PDF
rar 52 61 72 21 Rar!
sfw 43 57 53 06/08 cws
tar 1F 8B 08 00
tgz 1F 9D 90 70
Word D0 CF 11 E0
wmv 30 26 B2 75
zip 50 4B 03 04 PK
Hex File Header and ASCII Equivalent
Hex File Headers and
Regex for Forensics
Cheat Sheet v1.0
SANS Forensics
http://computer-forensics.sans.org
http://blogs.sans.org/computer-forensics
By Guy Bruneau, gbruneau@sans.org
sort
sort, as its name implies, will sort the
output. There are a few interesting options you
can use:
-d Uses dictionary order. Only letters,
digits and blanks.
-n will sort the output assuming it is
numerical (instead of string)
-u will remove redundant line, 'uniquing'
the results
awk is an extremely useful tool, especially for
parsing data structured in columns. It is
straightforward to use for simple purposes. Its
basic use is to select some particular columns
from the output: column 1 is referred to as $1,
column 2 as $2, etc.
The space is the default awk separator. However
if you want to be able to parse data separated
by some other character, e.g. ":", you can use
the -F flag.
Example: echo "hello:goodbye" | awk -F:
'{print $2}'
Would return "goodbye" as an output
awk
sed is an excellent command for character
substitution. Example: if you want to
substitute the first occurrence of the 'a'
character by an 'e':
echo "hallo" | sed 's/a/e/'
The output would be: hello
You can use the g modifier to substitute all
instances:
echo "Hallo Janny" | sed 's/a/e/g'
The output would be: Hello Jenny
sed
Forensic Analysis
Cheat Sheet
Forensics
MANDIANT
contact@mandiant.com
703.683.3141
http://www.mandiant.org
The Windows findstr has one interesting
feature that differs from grep. If you need
to search for multiple strings, you need to
separate them with a space.
For example, you want or need to look for a
match for WHITE or GREEN in a text file, you
write your command like this:
findstr "WHITE GREEN" textfile
To make the search case insensitive, add the
/I to print all variant of WHITE or GREEN.
Windows findstr Command List
/B Matches pattern if at the beginning of
a line.
/E Matches pattern if at the end of a
line.
/L Uses search strings literally.
/R Uses search strings as regular
expressions.
/S Searches for matching files in the
current directory and all
subdirectories.
/I Specifies that the search is not to be
case-sensitive.
/X Prints lines that match exactly.
/V Prints only lines that do not contain
a match.
/N Prints the line number before each
line that matches.
/M Prints only the filename if a file
contains a match.
/O Prints character offset before each
matching line.
/P Skip files with non-printable
characters.
Windows findstr
Check the date man page for more options.
Returns the real date from epoch time:
date –d @1284127201
Return an epoch time of 1288756800:
date +%s -d “2010-11-03”
Return a 2 days old date:
date --date="-2 days" +"%Y-%m-%d"
Return 20:00 hours:
date -d @1288310401 +%k:%M
The uniq command reads the input and compares
adjacent lines. If two or more adjacent lines
are identical, all but one is removed.
Here is a list of the most common options used
with uniq:
-c Prefix line with number of occurrence
-f Avoid comparing the first N fields
-i Ignore case
-s Avoid comparing the first N characters
-u Only print unique lines
Consider this input file:
a
b
c
b
Now run uniq on it: sort testfile | uniq
a
b
c
Now run uniq -c on it:
1 a
2 b
1 c
uniq
Date

More Related Content

Viewers also liked

Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識
維泰 蔡
 
Tmux quick-reference
Tmux quick-referenceTmux quick-reference
Tmux quick-referenceRamesh Kumar
 
Webサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてWebサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてyut148atgmaildotcom
 
RHEL roadmap
RHEL roadmapRHEL roadmap
RHEL roadmap
Ramesh Kumar
 
UNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAYUNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAY
Andrejs Vorobjovs
 
Sorting techniques in Perl
Sorting techniques in PerlSorting techniques in Perl
Sorting techniques in Perl
Yogesh Sawant
 
Unix interview questions
Unix interview questionsUnix interview questions
Unix interview questions
Kalyan Hadoop
 
Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01
Kalyan Hadoop
 
shell script introduction
shell script introductionshell script introduction
shell script introduction
Jie Jin
 
Recommender system
Recommender systemRecommender system
Recommender system
Jie Jin
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
Ahmed El-Arabawy
 
sed -- A programmer's perspective
sed -- A programmer's perspectivesed -- A programmer's perspective
sed -- A programmer's perspective
Li Ding
 
Orienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshotsOrienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshots
Kalyan Hadoop
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
Brendan Gregg
 
Naive Bayes
Naive Bayes Naive Bayes
Naive Bayes
Eric Wilson
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
Yogesh Sawant
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREs
Brendan Gregg
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
Brendan Gregg
 

Viewers also liked (20)

Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識
 
Tmux quick-reference
Tmux quick-referenceTmux quick-reference
Tmux quick-reference
 
Webサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてWebサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについて
 
RHEL roadmap
RHEL roadmapRHEL roadmap
RHEL roadmap
 
UNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAYUNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAY
 
Cacti manual
Cacti manualCacti manual
Cacti manual
 
Sorting techniques in Perl
Sorting techniques in PerlSorting techniques in Perl
Sorting techniques in Perl
 
Unix interview questions
Unix interview questionsUnix interview questions
Unix interview questions
 
Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01
 
Url
UrlUrl
Url
 
shell script introduction
shell script introductionshell script introduction
shell script introduction
 
Recommender system
Recommender systemRecommender system
Recommender system
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
 
sed -- A programmer's perspective
sed -- A programmer's perspectivesed -- A programmer's perspective
sed -- A programmer's perspective
 
Orienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshotsOrienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshots
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
 
Naive Bayes
Naive Bayes Naive Bayes
Naive Bayes
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
 
SREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREsSREcon 2016 Performance Checklists for SREs
SREcon 2016 Performance Checklists for SREs
 
Java Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame GraphsJava Performance Analysis on Linux with Flame Graphs
Java Performance Analysis on Linux with Flame Graphs
 

Similar to Cheatsheet: Hex file headers and regex

Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing toolsroot_fibo
 
Unix Tutorial
Unix TutorialUnix Tutorial
Unix Tutorial
Sanjay Saluth
 
Awk A Pattern Scanning And Processing Language
Awk   A Pattern Scanning And Processing LanguageAwk   A Pattern Scanning And Processing Language
Awk A Pattern Scanning And Processing Language
Crystal Sanchez
 
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Brooke Heidt
 
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaaShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ewout2
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
Jose Pla
 
intro unix/linux 05
intro unix/linux 05intro unix/linux 05
intro unix/linux 05
duquoi
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
charsbar
 
awkbash quick ref for Red hat Linux admin
awkbash quick ref for Red hat Linux adminawkbash quick ref for Red hat Linux admin
awkbash quick ref for Red hat Linux admin
ZoumanaDiomande1
 
Talk Unix Shell Script 1
Talk Unix Shell Script 1Talk Unix Shell Script 1
Talk Unix Shell Script 1Dr.Ravi
 
Talk Unix Shell Script
Talk Unix Shell ScriptTalk Unix Shell Script
Talk Unix Shell ScriptDr.Ravi
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
Saifur Rahman
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
Nirajan Pant
 
Advanced perl finer points ,pack&unpack,eval,files
Advanced perl   finer points ,pack&unpack,eval,filesAdvanced perl   finer points ,pack&unpack,eval,files
Advanced perl finer points ,pack&unpack,eval,files
Shankar D
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
KalpeshRaut7
 
Shell Scripts
Shell ScriptsShell Scripts
Shell ScriptsDr.Ravi
 

Similar to Cheatsheet: Hex file headers and regex (20)

Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing tools
 
CInputOutput.ppt
CInputOutput.pptCInputOutput.ppt
CInputOutput.ppt
 
Unix Tutorial
Unix TutorialUnix Tutorial
Unix Tutorial
 
Awk A Pattern Scanning And Processing Language
Awk   A Pattern Scanning And Processing LanguageAwk   A Pattern Scanning And Processing Language
Awk A Pattern Scanning And Processing Language
 
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)
 
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaaShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
 
intro unix/linux 05
intro unix/linux 05intro unix/linux 05
intro unix/linux 05
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
awkbash quick ref for Red hat Linux admin
awkbash quick ref for Red hat Linux adminawkbash quick ref for Red hat Linux admin
awkbash quick ref for Red hat Linux admin
 
Talk Unix Shell Script 1
Talk Unix Shell Script 1Talk Unix Shell Script 1
Talk Unix Shell Script 1
 
Talk Unix Shell Script
Talk Unix Shell ScriptTalk Unix Shell Script
Talk Unix Shell Script
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
 
Advanced perl finer points ,pack&unpack,eval,files
Advanced perl   finer points ,pack&unpack,eval,filesAdvanced perl   finer points ,pack&unpack,eval,files
Advanced perl finer points ,pack&unpack,eval,files
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
 
Shell Scripts
Shell ScriptsShell Scripts
Shell Scripts
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 

More from Kasper de Waard

Cheatsheet: Netcat
Cheatsheet: NetcatCheatsheet: Netcat
Cheatsheet: Netcat
Kasper de Waard
 
Cheatsheet: Metasploit
Cheatsheet: MetasploitCheatsheet: Metasploit
Cheatsheet: Metasploit
Kasper de Waard
 
Cheatsheet: Google Search
Cheatsheet: Google SearchCheatsheet: Google Search
Cheatsheet: Google Search
Kasper de Waard
 
Irm 15-trademark infringement
Irm 15-trademark infringementIrm 15-trademark infringement
Irm 15-trademark infringement
Kasper de Waard
 
Irm 14-scam
Irm 14-scamIrm 14-scam
Irm 14-scam
Kasper de Waard
 
Irm 13-phishing
Irm 13-phishingIrm 13-phishing
Irm 13-phishing
Kasper de Waard
 
Irm 12-insiderabuse
Irm 12-insiderabuseIrm 12-insiderabuse
Irm 12-insiderabuse
Kasper de Waard
 
Irm 10-social engineering
Irm 10-social engineeringIrm 10-social engineering
Irm 10-social engineering
Kasper de Waard
 
Irm 8-blackmail
Irm 8-blackmailIrm 8-blackmail
Irm 8-blackmail
Kasper de Waard
 
Irm 6-website-defacement
Irm 6-website-defacementIrm 6-website-defacement
Irm 6-website-defacement
Kasper de Waard
 
Irm 5-malicious networkbehaviour
Irm 5-malicious networkbehaviourIrm 5-malicious networkbehaviour
Irm 5-malicious networkbehaviour
Kasper de Waard
 
Irm 4-ddos
Irm 4-ddosIrm 4-ddos
Irm 4-ddos
Kasper de Waard
 

More from Kasper de Waard (12)

Cheatsheet: Netcat
Cheatsheet: NetcatCheatsheet: Netcat
Cheatsheet: Netcat
 
Cheatsheet: Metasploit
Cheatsheet: MetasploitCheatsheet: Metasploit
Cheatsheet: Metasploit
 
Cheatsheet: Google Search
Cheatsheet: Google SearchCheatsheet: Google Search
Cheatsheet: Google Search
 
Irm 15-trademark infringement
Irm 15-trademark infringementIrm 15-trademark infringement
Irm 15-trademark infringement
 
Irm 14-scam
Irm 14-scamIrm 14-scam
Irm 14-scam
 
Irm 13-phishing
Irm 13-phishingIrm 13-phishing
Irm 13-phishing
 
Irm 12-insiderabuse
Irm 12-insiderabuseIrm 12-insiderabuse
Irm 12-insiderabuse
 
Irm 10-social engineering
Irm 10-social engineeringIrm 10-social engineering
Irm 10-social engineering
 
Irm 8-blackmail
Irm 8-blackmailIrm 8-blackmail
Irm 8-blackmail
 
Irm 6-website-defacement
Irm 6-website-defacementIrm 6-website-defacement
Irm 6-website-defacement
 
Irm 5-malicious networkbehaviour
Irm 5-malicious networkbehaviourIrm 5-malicious networkbehaviour
Irm 5-malicious networkbehaviour
 
Irm 4-ddos
Irm 4-ddosIrm 4-ddos
Irm 4-ddos
 

Recently uploaded

Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
TristanJasperRamos
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
Himani415946
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
ShahulHameed54211
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 

Recently uploaded (16)

Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 

Cheatsheet: Hex file headers and regex

  • 1. Forensic Analysts are on the front lines of computer investigations. This guide aims to support Forensic Analysts in their quest to uncover the truth. grep's strength is extracting information from text files. grep operates on one or multiple files when provided with a command line argument(s) that can also include wildcards: Example: grep "John" addressbook Would return the lines that contained the "John" string in the addressbook text file Some useful flags: -A Print number of lines after the match -B Print number of lines before match -c Report number of occurrences -f Reads one or more patterns from a file. Pattern are terminated by a newline -h Suppress the file names on the output -i Ignore case -l Report matching files, not matching lines -P Interpret pattern as a Perl Regex -v Reverse operation: return the lines not matching the string The egrep (extended grep) utility can be useful to match several possible strings at the same time (in an OR mode): egrep "John|Peter" addressbook grep "John|Peter" addressbook grep/egrep Purpose How To Use This Sheet When performing an investigation it is helpful to be reminded of the powerful options available to the investigator. This document is aimed to be a reference to the tools that could be used. This sheet is split into these sections: • Hex File Headers • grep/egrep • sort • awk • sed • uniq • date • Windows findstr The key to successful forensics is minimizing your data loss, accurate reporting, and a thorough investigation. File headers are used to identify a file by examining the first 4 or 5 bytes of its hexadecimal content. Filetype Start Start ASCII Translation ani 52 49 46 46 RIFF au 2E 73 6E 64 snd bmp 42 4D F8 A9 BM bmp 42 4D 62 25 BMp% bmp 42 4D 76 03 BMv cab 4D 53 43 46 MSCF dll 4D 5A 90 00 MZ Excel D0 CF 11 E0 exe 4D 5A 50 00 MZP (inno) exe 4D 5A 90 00 MZ flv 46 4C 56 01 FLV gif 47 49 46 38 39 61 GIF89a gif 47 49 46 38 37 61 GIF87a gz 1F 8B 08 08 ico 00 00 01 00 jpeg FF D8 FF E1 jpeg FF D8 FF E0 JFIF jpeg FF D8 FF FE JFIF Linux bin 7F 45 4C 46 ELF png 89 50 4E 47 PNG msi D0 CF 11 E0 mp3 49 44 33 2E ID3 mp3 49 44 33 03 ID3 OFT 4F 46 54 32 OFT2 PPT D0 CF 11 E0 PDF 25 50 44 46 %PDF rar 52 61 72 21 Rar! sfw 43 57 53 06/08 cws tar 1F 8B 08 00 tgz 1F 9D 90 70 Word D0 CF 11 E0 wmv 30 26 B2 75 zip 50 4B 03 04 PK Hex File Header and ASCII Equivalent Hex File Headers and Regex for Forensics Cheat Sheet v1.0 SANS Forensics http://computer-forensics.sans.org http://blogs.sans.org/computer-forensics By Guy Bruneau, gbruneau@sans.org sort sort, as its name implies, will sort the output. There are a few interesting options you can use: -d Uses dictionary order. Only letters, digits and blanks. -n will sort the output assuming it is numerical (instead of string) -u will remove redundant line, 'uniquing' the results
  • 2. awk is an extremely useful tool, especially for parsing data structured in columns. It is straightforward to use for simple purposes. Its basic use is to select some particular columns from the output: column 1 is referred to as $1, column 2 as $2, etc. The space is the default awk separator. However if you want to be able to parse data separated by some other character, e.g. ":", you can use the -F flag. Example: echo "hello:goodbye" | awk -F: '{print $2}' Would return "goodbye" as an output awk sed is an excellent command for character substitution. Example: if you want to substitute the first occurrence of the 'a' character by an 'e': echo "hallo" | sed 's/a/e/' The output would be: hello You can use the g modifier to substitute all instances: echo "Hallo Janny" | sed 's/a/e/g' The output would be: Hello Jenny sed Forensic Analysis Cheat Sheet Forensics MANDIANT contact@mandiant.com 703.683.3141 http://www.mandiant.org The Windows findstr has one interesting feature that differs from grep. If you need to search for multiple strings, you need to separate them with a space. For example, you want or need to look for a match for WHITE or GREEN in a text file, you write your command like this: findstr "WHITE GREEN" textfile To make the search case insensitive, add the /I to print all variant of WHITE or GREEN. Windows findstr Command List /B Matches pattern if at the beginning of a line. /E Matches pattern if at the end of a line. /L Uses search strings literally. /R Uses search strings as regular expressions. /S Searches for matching files in the current directory and all subdirectories. /I Specifies that the search is not to be case-sensitive. /X Prints lines that match exactly. /V Prints only lines that do not contain a match. /N Prints the line number before each line that matches. /M Prints only the filename if a file contains a match. /O Prints character offset before each matching line. /P Skip files with non-printable characters. Windows findstr Check the date man page for more options. Returns the real date from epoch time: date –d @1284127201 Return an epoch time of 1288756800: date +%s -d “2010-11-03” Return a 2 days old date: date --date="-2 days" +"%Y-%m-%d" Return 20:00 hours: date -d @1288310401 +%k:%M The uniq command reads the input and compares adjacent lines. If two or more adjacent lines are identical, all but one is removed. Here is a list of the most common options used with uniq: -c Prefix line with number of occurrence -f Avoid comparing the first N fields -i Ignore case -s Avoid comparing the first N characters -u Only print unique lines Consider this input file: a b c b Now run uniq on it: sort testfile | uniq a b c Now run uniq -c on it: 1 a 2 b 1 c uniq Date