52
CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Embed Size (px)

Citation preview

Page 1: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

CSN08101Digital ForensicsLecture 3: Linux Searching

Module Leader: Dr Gordon RussellLecturers: Robert Ludwiniak

Page 2: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

• This week is all about:– Finding files– Searching files– Understanding files– Editing files

Page 3: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Essential Linux for ForensicsYou will learn in this lecture:• Searching and understanding files• Command Summary:

– md5sum– cmp– sha512sum– grep– find– file– pico/nano

• Concepts Summary– Regular Expressions

Page 4: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Directory Tree

/home/caine

file1 file2

file4file3 file5

dir1 dir2

• Some people asking about directory trees...

• Top of the tree is “/”, pronounced “slash” or “root”. All files and directories hang off this

• Off this are directories like /etc and /home

• Off /home is a directory “caine”.• So two levels above /home/caine is /• /home/caine is caine’s HOME

directory.

/home/etc

/

Page 5: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

file

• In windows, the file extension says what a file is. For example:– gordon.doc– This is a Word document, due to a file association (.doc -> Word)

• Secretive windows users may change an extension to hide evidence.• It would be better to look at the data in each file to decide what it is.• In Linux, there are no file extensions, and thus all associations are

calculated from the contents of a file.– This is often called Signature Analysis

• In Linux there is a useful tool for this analysis.– The command is “file”

Page 6: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Examples

$ file /bin/ls (the ls command)

/bin/ls: ELF ... Executable...dynamically linked ...

$ file randomfile (a jpeg image with random name)

randomfile: JPEG image data, JFIF standard 1.01

$ file /etc/hosts (just plan text about system hostnames)

/etc/hosts: ASCII text

$ file privateimg (a GIF with a silly name)

privateimg: : GIF image data, version 89a, 627 x 671

Page 7: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Hashing

• If a file is copied and renamed, how can we know both files are the same.

• One way is to HASH all the files, then see if the hash numbers are identical.

• A hash is an algorithm which reduces a large file into a simple short number, in a way that two files which are identical has the same hash, but two different files should have different hash numbers.

Page 8: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Simple hash – sum mod 8

• Consider a hashing algorithm which adds all the bytes of a file together then MODs the total by 8.

– MOD 8 is the remainder of a division by 8.

File 1 File 2

5 1

6 2

1 7

3 1

(5+6+1+3) => 1515 / 8 => 1 remainder 7

(1+2+7+1) => 1111 / 8 => 1 remainder 3

• So the hash of file1 is 7 and the hash of file 2 is 3. They are different hashes thus different files.

• This is a stupid hash algorithm as there are many files which will have the same hash, but which are in fact different.

Page 9: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

md5sum

• Calculates an 128 bit MD5 checksum• Takes 1 parameter:

– 1. the file being analysed

$ ls

file1 file2

$ md5sum file1

817ea56a11b3f9b476e0940f353c782a file1

$ md5sum file2

817ea56a11b3f9b476e0940f353c782a file2

Page 10: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Hash Collisions• If two files have different hash values then they are not identical.• If two files have the same hash values then they are probably

identical.• If two files are different but have the same hash they are referred to as

a hash collision or a false positive.– There are many possible files which will return the same hash– The better the hash function the less the chance of a hash collision– The more bits in the hash the less the chance of a hash collision

• The “cmp” command does a binary check– If “cmp” prints anything they the files do not match– If “cmp” prints nothing they are identical.

$ cmp file1 file2

file1 file2 differ: byte10, line 1

Page 11: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

sha512sum

• Calculates an 512 bit sha checksum• Takes 1 parameter:

– 1. the file being analysed

$ ls

file1 file2

$ sha512sum file1

499855a0e696e4084c02db1ee8f859d8cb52ea840eb38aa8e0d2cbaf794dbbae860b6f9ec1a5ae39403ce09a90a4caaba1f4483f42b9ea6758636e153fe5fefc file1

$ sha512sum file2

aec795cbaee4762735d38d9b37836846e30b40af0bef25f95606515bebc8358f8ca408291f79d0f9bde19512c8b60a3348bd1307cc51f249ea5224469721f536 file2

Page 12: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

SHA collisions

• SHA 512 has no known hash collisions• It is therefore almost certain that if two files have the same SHA 512

hash then they are identical...• Does not do any harm to check with cmp• But SHA 512 hashes are much much bigger than md5 128 bit hashes

– If you have to write them down it may be tiring and error-prone.

Page 13: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

find

• The “find” command is very powerful at searching for filenames.• If you know something about the files you are looking for, find can

locate all files in a tree which match the conditions.• It has slightly complex parameter format:

– Parameter 1: the top of the tree you want to search in– The remaining parameters are either

• Tests which have to be true before an action is carried out. Different tests are ANDed together by default.

• Actions which are carried out when all the rules are true.

• When find locates a matching file it carries out one of more actions.– For our studies we will only print to the screen, or exec a command.– “print” is the default action, so in our case we will not need to specify any actions.– Possible actions are things like “-print”, “-exec”, “-delete”, and many more...

Page 14: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

• Where rules have a numberical parameter, the number can be– N test to see if the number is N– +N test to see if a file has a number greater than N– -N test to see if a file has a number less than N

• Basic Rules include:– “-atime N”File accessed N*24 hours ago. E.g.

• “-atime +1” looks for a file accessed >1 day ago, e.g. 2 or more days ago.

• “-atime 1” looks for files accessed in the last 24 hours.

– “-user USER” Files owned by a particular USER– “-group GROUP” Files owned by a particular GROUP– “-name NAME” Files named NAME. Can use filename wildcards.– “-perm MODE” Files with MODE chmod permissions– “-size N” Files are size N. End the number with “c” for size in bytes.– “-type C” C can be “d” (directory), “f” (file), plus others

Page 15: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 1

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find /home/caine –size 187c

/home/caine/file1

/home/caine/dir1/file3

Page 16: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 2

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find . –user root

./file1

./dir1/file3

Page 17: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 3

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find . –group gordon

./dir1

./dir2

./dir1/file3

./dir1/file4

Page 18: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 4

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find . –perm 664

./file1

./dir1/file4

Page 19: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 5

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find . –perm 664 –user root

./file1

Page 20: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 6

/home/caine

file1 file2

file4file3 file5

dir1 dir2

$ cd /home/caine

$ ls -l

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir1

drwxrwxr-x. 2 gordon gordon 4096 Jan 30 11:52 dir2

-rw-rw-r--. 1 root caine 187 Jan 30 11:51 file1

-rw-r--r--. 1 gordon caine 157 Jan 31 16:40 file2

$ ls -l dir1

-rw-r--r--. 1 root gordon 187 Jan 30 11:51 file3

-rw-rw-r--. 1 gordon gordon 147 Jan 31 16:40 file4

$ find . –name ‘*[23]*’

./dir2

./file2

./dir1/file3

Page 21: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Question

What “find” command would locate files below /home/caine which had the permissions “rwxr-xr-x”, had a name starting with “f”, and which had a size greater than 500 bytes?

$ find /home/caine –type ??? –name ‘????’ –perm ???? –size ????c

Page 22: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

“-exec”

• Instead of “print” you may want the action to carry out a command every time there is a match

– For instance, “ls –l” the filenames which end in “.conf” in /etc

• At the end of the “find” line add

-exec COMMAND ... {} ... \;

• COMMAND is the command you want to run• You can include other options in this section• Where you want the name of the file found to appear in the exec

command write the open and close curly brackets “{}”.• End the exec area with slash and semicolon “\;”.

Page 23: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example 7• Find all files in /etc which start with “c” and end “.conf”, and show a long

“ls” listing for those files:

$ find /etc -name 'c*.conf' -exec ls -l {} \;-rw-r--r--. 1 root root 950 May 30 2011

/etc/sysconfig/cgred.conf

-rw-r--r--. 1 root root 91 Jun 2 2011 /etc/gdm/custom.conf

-rw-r-

• Find all files in /home/caine which end “.del” and delete those files.

$ find /home/caine -name '*.del' -exec rm {} \;

Page 24: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Question

What find command would find all files in /home/caine, and for each file calculate the md5sum?

$ find /home/caine –type ??? –exec ?????

Page 25: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Regular Expressions

• Regular expressions is a standard way of defining pattern matches.• It has a number of versions, but in each the core syntax is the same.• Used in a variety of search commands in linux.• Very different from Filename Expansions used in terminal commands

like “ls” and “cp”.

• One command which can use regexp is grep.– grep searches for pattern in the contents of a file, and reports the matches.– To trigger grep to use the regexp discussed here you must use the option “-E”.

• Example. Does the file “file1” have the string “hello” in it:

$ grep –E ‘hello’ file1

Page 26: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Regexp: Single Characters

• Normal characters, like ‘a’ or ‘z’, look for those characters.• Some other characters have a special meaning. For example:

– A dot “.” character can match any character.– [...] – Characters within square brackets mean match 1 character and that character

must be one of those shown in the square brackets– \. (slash dot) – To actually look for a dot and not represent any character– \[ (slash bracket) – Actually look for a square bracket

• In effect if a character has a special meaning, you can stop that special meaning a force grep to look for that character just by putting a “\” (slash) character in front of it.

– This is called an escape sequence.

Page 27: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example - dot

$ grep –E ‘teleplastic’ /usr/share/dict/words

teleplastic

$ grep –E ‘teleplasmic’ /usr/share/dict/words

teleplasmic

$ grep –E ‘teleplas.ic’ /usr/share/dict/words

teleplastic

teleplasmic

^

Page 28: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example - set

$ grep –E ‘publicise’ /usr/share/dict/words

publicise

$ grep –E ‘publicize’ /usr/share/dict/words

publicize

$ grep –E ‘publici[sz]e’ /usr/share/dict/words

publicize

publicise

^

Page 29: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example - escaping

$ grep –E ‘etc\.’ /usr/share/dict/words

etc.

$ grep –E ‘etc.’ /usr/share/dict/words

etc.

etch

Page 30: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Anchors

• By default regexp looks for a match somewhere on each whole line.

$ grep –E ‘bump’ /usr/share/dict/words

bump

bumpy

unbump

unbumpy• If you want to say “match from start of line” you say “^” (hat) at the

beginning of the regexp.• If you want to say “match to the end of line” you say “$” (dollar) at the

end of the regexp.

Page 31: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example – Single Anchor

$ grep –E ‘bump’ /usr/share/dict/words

bump

bumpy

unbump

unbumpy

$ grep –E ‘^bump’ /usr/share/dict/words

bump

bumpy

$ grep –E ‘bump$’ /usr/share/dict/words

bump

unbump

Page 32: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example – Double Anchor

$ grep –E ‘bump’ /usr/share/dict/words

bump

bumpy

unbump

unbumpy

$ grep –E ‘^bump$’ /usr/share/dict/words

bump

Page 33: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Repetition

• You can add special characters to say how many times the previous character should appear.

• c* - character Star – 0 or more ‘c’ characters• c+ - character Plus – 1 or more ‘c’ characters• c? - character Questionmark – 0 or 1 of the ‘c’ character

• In these examples ‘c’ can by any normal character, or a special character (e.g. “5*”, “[123]+”, “H?”).

Page 34: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Example – Repetition

• Words which start with ‘a’ and end with ‘z’

$ grep –E ‘^a.*z$’ /usr/share/dict/words

abuzz

allez

• Word has ‘a’ then ‘b’ then ‘c’, with 0 or more characters in between.

$ grep –E ‘a.*b.*c’ /usr/share/dict/words

diabetic

...

Page 35: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

The Regular Expression Engine

• In the example “Word has ‘a’ then ‘b’ then ‘c’, with 0 or more characters in between”, can the first “.*” also include the “b”?

$ grep –E ‘a.*b.*c’ /usr/share/dict/words

diabetic

• Here the first “.*” could have been “beti”, in which case it would not match. So how does the wildcard work?

• It is down to what sort of regular expression engine is in use...

Page 36: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

The Engine...

http://ttte.wikia.com/wiki/Gordon

Page 37: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Greedy Matching

• http://img.ezinemark.com/imagemanager2/files/30003693/2011/02/2011-02-16-10-03-54-1-chipmunk-is-one-type-of-ravenous-rodents.jpeg

Page 38: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Greedy wildcards

• Wildcards match as much as possible, then try less and less until they work.

So “^a.*b.*c$” matching “amebic” is:

a .* b .* c

a mebic - - -

a mebi - - -

a meb - - -

a me b ic -

a me b i c

• So the first one matches 5, then 4, etc, until something goes right. This retry process is called “backtracking”.

Page 39: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Backreferences

• Sometimes you want to group part of a regular expression statement, and reuse what that matched in a later part of the expression:

– For example, look for a 3 character string beginning with ‘a’ which occurs twice in a line.

– This could match WALL-TO-WALL and RAZZMATAZZ

• To do this we need to group the first match, then reuse the group with a backreference.

• A group is part of a match surrounded by brackets “(....)”.– The brackets are not treated as something to look for, but are special characters.

• The point where you want to say “the thing which was in the brackets” you say “\1”, where 1 is the bracket number (e.g. You can have more than 1 set of brackets).

Page 40: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Backreference Example 1

• So to look for a 3 character string beginning with ‘a’ which occurs twice in a line...

– This could match WALL-TO-WALL and RAZZMATAZZ

grep –E ‘(a..).*\1’ /usr/share/dict/words

abracadabra

...

• In other words:– Search for “a..” (three characters where the first character is A)– Remember that match and call it GROUP 1.– Then 0 or more characters are matched– Then the same three character combination called GROUP 1 has to appear.

Page 41: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Backreference Example 2

• Look for words in the dictionary which have three vowels appearing together, then the SAME three vowels appearing together AGAIN in the same word.

grep -E '([aeiou][aeiou][aeiou]).*\1' /usr/share/dict/words

aeonicaeonist

Andreaeaceae

homoiousious

...

Page 42: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Editing with nano

• “nano” is a simple and quite powerful terminal-based editor in Linux.• Derived from “pico”, but rewritten due to licensing issues.• Kind of like notepad in Windows.

• You start the editor by saying “nano” then the file being edited (or to be created).

$ nano newfile

Page 43: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

• You can start editing and typing immediately using the cursor keys to navigate.

• On screen commands are done using CTRL then the key shown.

Page 44: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

• CTRL-X (it is always a lowercase key, so dont press CTRL-SHIFT-X) – exit nano and if required prompt for you to save the file

• CTRL-O – save the current file• CTRL-G – shows many more possible key combinations to do things

like:– Cut and paste– Jump down and up by a page– Run a spell checker

• CTRL-_ - (underscore) Jump to a particular line number.

Page 45: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Nano cut-and-paste

1. Move to the start of the text to cut

2. Press CTRL ^ (the hat character)

3. You will see “[ Mark Set ]”

4. Move the cursor to the end of the area to cut (does not include the current cursor position).

5. Press CTRL K to cut that text

6. Move the cursor to where you want the text to go

7. Press CTRL U to paste

Page 46: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Next Time

• Robert is taking the first hour.• The second hour will be on disk-level commands in linux.

Page 47: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Assessment: Short-Answer Examples

• The short answer class test has no past papers yet (as this is a new module for this year).

• This section contains example questions which are of the same style as you might expect in the actual past paper.

• Obviously it is likely that the actual questions shown here are not the ACTUAL questions which will appear in the exam!

• Remember this short answer exam is CLOSED BOOK. You are not permitted to use the internet or access your notes during the exam.

Page 48: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Q1

• You are in /home/caine, and need to copy the file /etc/stuff/myfile1 to the directory /home/gordon/dir1. Without changing directory what would this copy command look like, including parameters? You must use RELATIVE file naming (i.e. use “..” rather than starting each parameter with “/”).

Insert answer here:

Page 49: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Q2

• You are forensically examining a computer and spot a file called “blah”. Suggest a command which uses signature analysis that would allow you to better understand what this file is likely to contain.

Insert answer here:

Page 50: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Q3• As a result of some initial forensic analysis the following is now

known:$ ls –l

-rw-rwx---. 1 caine caine 15413 Jan 30 11:51 file1

-rw-rwx---. 1 caine caine 15413 Jan 30 11:51 file2

-rw-rwx---. 1 caine caine 15413 Jan 30 11:51 file3

-rw-rwx---. 1 caine caine 14513 Jan 30 11:51 file4

Md5sum information:

3e042346d21615461b7051380210f561 file1

4e042346d21615461b7051380210f561 file2

3e042346d21615461b7051380210f561 file3

3e042346d21615461b7051380210f561 file4

What files are copied of what files, explaining your answer?Insert answer here:

Page 51: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Q4

• Show an appropriate “find” command syntax to print all files in /home which have the string “aaa” in their name, as well as the permissions read and execute for other, group, and owner.

Insert answer here:

Page 52: CSN08101 Digital Forensics Lecture 3: Linux Searching Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Q5

• Supply a grep command using standard regular expressions to find all words in a file “words” (where the words in the file are one per line) where each word both starts and ends with “ing”. Include in your search the possibility that the first character could also be a capital letter.

Insert answer here: