Sophie Chen
ResumeLinkedInGitHubBluesky
Work
Work
  • Work
  • Digital Forensics Lab
    • 1 Setting Up
    • 2 Basic Computer Skills for Digital Forensics
      • 2.1 Number Systems
      • 2.2 PC Introduction
      • 2.3 Windows Command Line Tutorial
      • 2.4 Linux Command Line Tutorial
      • 2.5 Advanced Linux Command Line Tutorial
    • 3 Basic Networking Skills for Digital Forensics
      • 3.1 HTTP Analysis using Wireshark 1
      • 3.2 HTTP Analysis using Wireshark 2
      • 3.3 SYN Flood Attack Investigation using tshark
      • 3.4 SMTP Forensics
      • 3.5 ARP Poisoning Forensics
      • 3.6 Firewall
      • 3.7 DNS Introduction
      • 3.8 DNS Spoofing Forensics
      • 3.9 WEP40 Wireless Aircrack
    • 4 Computer and Digital Forensics
      • 4.1 Introduction to Digital Forensics
      • 4.2 Sleuth Kit Tutorial
      • 4.3 USB Image Acquisition
      • 4.4 Evidence Search - A Pattern Match Game
      • 4.5 Evidence Search - File Metadata
      • 4.6 Data Carving
      • 4.7 Steganography
      • 4.8 Forensic Report Template
    • 5 Computer Forensics Case Studies
      • 5.1 Investigating NIST Data Leakage
        • 5.1.1 Environment Setting Up
        • 5.1.2 Windows Registry
        • 5.1.3 Windows Event and XML
        • 5.1.4 Web History and SQL
        • 5.1.5 Email Investigation
        • 5.1.6 File Change History and USN Journal
        • 5.1.7 Network Evidence and shellbag
        • 5.1.8 Network Drive and Cloud
        • 5.1.9 Master File Table ($MFT) and Log File ($logFile) Analysis
        • 5.1.10 Windows Search History
        • 5.1.11 Windows Volume Shadow Copy Analysis/SQL database carving
        • 5.1.12 Recycle Bin and Anti-Forensics
        • 5.1.13 Data Carving
        • 5.1.14 Crack Windows Passwords
      • 5.2 Investigating P2P Data Leakage
        • 5.2.1 Lab Environment Setting Up
        • 5.2.2 Disk Image and Partitions
        • 5.2.3 Windows Registry and File Directory
        • 5.2.4 MFT Timeline
        • 5.2.5 USN Journal Timeline
        • 5.2.6 uTorrent Log File
        • 5.2.7 File Signature
        • 5.2.8 Emails
        • 5.2.9 Web History
        • 5.2.10 Website Analysis
        • 5.2.11 Timeline (Summary)
      • 5.3 Investigating Illegal Possession of Images
        • 5.3.1 Review HTTP Analysis using Wireshark (text)
        • 5.3.2 Rhion Possession Investigation 1: File recovering
        • 5.3.3 Rhion Possession Investigation 2: Steganography
        • 5.3.4 Rhion Possession Investigation 3: Extract Evidence from FTP Traffic
        • 5.3.5 Rhion Possession Investigation 4: Extract Evidence from HTTP Traffic
      • 5.4 Investigating Email Harassment
        • 5.4.1 Investigating Harassment Email using Wireshark
        • 5.4.2 t-shark Forensic Introduction
        • 5.4.3 Investigating Harassment Email using t-shark
      • 5.5 Investigating Illegal File Transferring
      • 5.6 Investigating Hacking Case
      • 5.7 Investigating Morris Worm Attack
        • 5.7.1 Morris Worm Attack
        • 5.7.2 Investigating Morris Worm Attack
    • 6 Mobile/IoT Forensics Case Studies
      • 6.1 Investigating Echo Show 8
        • 6.1.1 Echo Show Introduction
        • 6.1.2 Echo Show Evidence Planting
        • 6.1.3 Device Teardown and eMMC Chip-off
        • 6.1.4 Image Acquisition and Mounting
        • 6.1.5 Specifications: Device and OS Info
        • 6.1.6 Specifications: User Info
        • 6.1.7 Specifications: Network Connectivity Info
        • 6.1.8 Web Activity
        • 6.1.9 Phone Communication
        • 6.1.10 Multimedia: Photos and related Data
        • 6.1.11 Multimedia: Videos and related Data
        • 6.1.12 Multimedia: Audio and related Data
      • 6.2 Investigating Android 10
        • 6.2.1 Intro Pixel 3
        • 6.2.2 Pixel 3 Image
        • 6.2.3 Pixel 3 Device
        • 6.2.4 Pixel 3 System Setting
        • 6.2.5 Overview: App Life Cycle
        • 6.2.6 AOSP App Investigations: Messaging
        • 6.2.7 AOSP App Investigations: Contacts
        • 6.2.8 AOSP App Investigations: Calendar
        • 6.2.9 GMS App Investigations: Messaging
        • 6.2.10 GMS App Investigations: Dialer
        • 6.2.11 GMS App Investigations: Maps
        • 6.2.12 GMS App Investigations: Photos
        • 6.2.13 Third-Party App Investigations: Kik
        • 6.2.14 Third-Party App Investigations: textnow
        • 6.2.15 Third-Party App Investigations: whatapp
        • 6.2.16 Pixel 3 Rooting
      • 6.3 Investigating iPhone iOS 13.4.1
        • 6.3.1 Intro Intro iPhone iOS 13
        • 6.3.2 iOS 13.4.1 Image
        • 6.3.3 iPhone Device Investigation
        • 6.3.4 iOS System Settings
        • 6.3.5 Overview of App Life Cycle
        • 6.3.6 Messages Investigations
        • 6.3.7 Contacts Investigations
        • 6.3.8 Calendar Investigations
        • 6.3.9 Safari Investigations
        • 6.3.10 Photo Investigations
        • 6.3.11 KnowledgeC Investigations
        • 6.3.12 Health Investigations
        • 6.3.13 Location Investigations
        • 6.3.14 Cellebrite Investigations
        • 6.3.15 Magnet Axiom Investigations
        • 6.3.16 Jailbreak Investigations
      • 6.4 Investigating Drone DJI
        • 6.4.1 DJI Mavic Air Mobile
        • 6.4.2 DJI Mavic Air MicroSD Raw
        • 6.4.3 DJI Mavic Air MicroSD Encase Format
  • CTF Walkthroughs
    • Hack The Box
      • Linux Fundamentals
      • Windows Fundamentals
    • TryHackMe
      • Linux Fundamentals Part 1
      • Linux Fundamentals Part 2
      • Linux Fundamentals Part 3
      • Introductory Networking
      • HTTP in Detail
      • DNS in Detail
      • Intro to Cyber Threat Intel
      • Threat Intelligence Tools
      • MAL: Malware Introductory
      • Intro to Digital Forensics
      • Digital Forensics Case B4DM755
  • Multithreaded Network File Server
  • Thread Library
  • Virtual Memory Pager
Powered by GitBook
On this page
  • Number Systems
  • Binary, Decimal, and Hexadecimal
  • Converting Between the Number Systems
  • American Standard Code for Information Interchange (ASCII)
  • Epoch Time and Timestamps
  • Hashing
  • Data Stored in Memory
  1. Digital Forensics Lab
  2. 2 Basic Computer Skills for Digital Forensics

2.1 Number Systems


Number Systems

Binary, Decimal, and Hexadecimal

The binary, decimal, and hexadecimal number systems are all used by forensic professionals.

As humans, we are used to counting numbers using the decimal system. The decimal system consists of ten digits (0-9). When we count, we start with the ten digits (0, 1, 2, ..., 7, 8, 9). When we run out of digits, we increase the number in the tens place by 1 and reset our ones place back to 0 (10). We continue this pattern for the hundreds place, thousands place, etc. Because of this pattern, we can break down decimal numbers as follows:

324=3∗102+2∗101+4∗100324 = 3*10^2 + 2*10^1 + 4 *10^0324=3∗102+2∗101+4∗100

Decimal is also known as base 10 because the digit in each place value is multiplied by 10 raised to an exponent.

Binary is similar to decimal. However, instead of being base 10, binary is base 2. As a result, we have only two digits: 0 and 1. When we count, we start with our digits (0, 1). After 1, we run out of digits. Thus, we increase the number in next place by 1 and reset our ones place back to 0 (10). As a result, 3 in decimal is 10 in binary, 4 in decimal is 11 in binary, and so on. This pattern allows us to break binary numbers down as follows:

0b1011=1∗23+0∗22+1∗21+1∗20=110b1011 = 1*2^3 + 0*2^2 + 1*2^1 + 1*2^0 = 110b1011=1∗23+0∗22+1∗21+1∗20=11

Notice how similar this break down is similar to the decimal, only instead of multiplying by 10 raised to an exponent, we multiply by 2 raised to an exponent.

Hexadecimal is base 16. Instead of having ten digits or two digits, we have 16 (0-9 and A-F). As with binary and decimal, we move on to the next place when we run out of digits. Here is an example of how we break down a hexadecimal number:

0xA3D4=10∗163+3∗162+13∗161+4∗160=419400xA3D4 = 10*16^3 + 3*16^2 + 13*16^1 + 4*16^0=419400xA3D4=10∗163+3∗162+13∗161+4∗160=41940

In this case, we multiply by 16 raised to an exponent. Notice how A = 10, B = 11, ..., F = 15 in hexadecimal.

As shown in the examples above, I prefix binary numbers with "0b" and hexadecimal numbers with "0x" in order to make it clear what number system the following digits are written in. Numbers that do not start with any prefix are assumed to be in decimal.

Converting Between the Number Systems

The examples given in the previous section also show how we can convert from binary to decimal and hexadecimal to decimal.

We can convert to from decimal to binary as follows:

25=1∗24+1∗23+0∗22+0∗21+1∗20=0b1100125 = 1*2^4 + 1*2^3 + 0*2^2+0*2^1+1*2^0 = 0b1100125=1∗24+1∗23+0∗22+0∗21+1∗20=0b11001

We can convert from decimal to hexadecimal as follows:

Since one hexadecimal digit is four binary digits, conversions between hexadecimal and binary are straightforward. Notice how each group of four binary digits corresponds to one hex digit.

0b11001=0b0001 1001=0x190b11001 = 0b0001 \ 1001 = 0x190b11001=0b0001 1001=0x19
0xF3=0b1111 0011=0b111100110xF3 = 0b1111 \ 0011 = 0b111100110xF3=0b1111 0011=0b11110011

We can also do conversions using the command line. I denote the beginnings of commands with $. These $ are not part of the actual commands.

Let's convert from binary and hexadecimal to decimal. Note that the 2# indicates that the following numbers are to be represented as base 2. You can use 16# or 0x to indicate base 16. The $(( )) construction indicates that we want to do shell arithmetic.

$ echo "$((2#101010))"
42
$ echo "$((16#AB2))"
2738
$ echo "$((0xAB2))"
2738

To convert from decimal to binary and hexadecimal, we first need to download basic calculator (bc).

$ sudo apt install bc

After basic calculator is installed, we can convert:

$ echo "obase=2;126" | bc
1111110
$ echo "obase=16;2738" | bc
AB2

We can also use the programming language C in the command line to convert. %x is for printing as hexadecimal, %d is for printing as decimal, and %s is for printing as string.

$ printf "%x" 2738
ab2

Python is a high-level, general-purpose programming language. It has widespread use in scientific computing, software engineering, cybersecurity, and more. Python can also be used to convert between the number systems. In order to run Python (version 3) from the command line, first python3 in the command line.

$ python3

Any commands that follow will be interpreted as Python. The beginnings of Python commands run from the command line are denoted with >>>. These >>> are not part of the actual commands.

Let's convert from binary and hexadecimal to decimal. The first argument of int() is the string. The second argument indicates which base to interpret the string as.

>>> int("101010", 2)
42
>>> int("ab2", 16)
2738

To convert from decimal to binary and hexadecimal, we can use the following commands:

>>> bin(126)
'0b1111110'
>>> hex(2375)
'0x947'

Press CTRL+Z to exit Python mode.

American Standard Code for Information Interchange (ASCII)

ASCII is a method of representing common English-language symbols in computing devices using binary. According to ASCII, each symbol is represented by eight bits, or one byte. We can view the ASCII conversion table in the command line:

$ man ascii

As with the number systems, we can convert between ASCII and numbers using the command line or Python. On the command line, we can convert between ASCII and hexadecimal with the following commands:

$ printf "\x48\x65\x6c\x6c\x6f"
Hello
$ echo -n Hello | xxd
00000000: 4865 6c6c 6f                             Hello                       Hello

In Python, ASCII conversions between ASCII and decimal can be done as such:

>>> chr(97)
'a'
>>> ord('a')  
97

ASCII and hexadecimal conversions can also be done in Python using the binascii module.

>>> import binascii
>>> binascii.hexlify(b'hello')
b'68656c6c6f'
>>> binascii.unhexlify(b'68656c6c6f')
b'hello'

You may have heard of UTF-8 Unicode, a different method of representing symbols in computing devices. While ASCII uses 7 bits to represent symbols, UTF-8 uses a variable length of bits. As a result, UTF-8 is able to represent a much wider range of symbols, especially those that are non-English.

Epoch Time and Timestamps

Epoch time is a type of time representation that is especially important for digital forensics. Epoch time represents time as the number of seconds or milliseconds that have passed since a certain time, known as the epoch.

Unix Epoch Time, or POSIX Time, measures time elapsed in seconds from the Unix epoch, 00:00:00 UTC on January 1, 1970.

We can view the current time through the command line.

$ date
Sun Mar 17 11:04:04 EDT 2024
$ date "+%s"
1710687863

We can also convert times between a human-readable format and Unix Epoch Time.

$ date -d @17106878300
Fri Feb  5 01:38:20 EST 2512
$ date -d @17106878300 --utc
Fri Feb  5 06:38:20 UTC 2512

We can also see the Unix Epoch Time with Python using the datetime module. Notice how our default time zone is the timezone of our system.

>>> from datetime import datetime, timezone
>>> datetime.now()
datetime.datetime(2024, 3, 17, 11, 48, 15, 575908)
>>> datetime.now(timezone.utc)
datetime.datetime(2024, 3, 17, 15, 48, 41, 32137, tzinfo=datetime.timezone.utc)
>>> datetime.now().timestamp()
1710690562.438871f

We can convert between times with Python as well.

>>> from datetime import datetime
>>> datetime.fromtimestamp(1675008832)
datetime.datetime(2023, 1, 29, 11, 13, 52)
>>> datetime.utcfromtimestamp(1675008832)
datetime.datetime(2023, 1, 29, 16, 13, 52)

The time module also allows us to get the current time.

>> import time
>> time.ctime()
'Sun Mar 17 11:42:17 2024'
>> time.time()
1710690139.564818

Mac Absolute Time, or Cocoa Core Date time, measures time elapsed in seconds from the Cocoa Core Date, 00:00:00 UTC on January 1, 2001.

WebKit is an open-source rendering engine used by web browsers such as Safari and Google Chrome. WebKit Time measures time elapsed in microseconds from 00:00:00 UTC on January 1, 1601.

Windows Filetime measures time elapsed in 100 nanosecond intervals from 00:00:00 UTC on January 1, 1601.

Hashing

Hash functions are publicly-known functions that take in arbitrary input and output a fixed-length string (called the hash). Hash functions are not designed to be reversed. These functions have many applications, from storing passwords securely to ensuring that a message has integrity and has not been changed (if you're interested in cryptographic theory, I recommend learning about HMAC construction). A secure hash function should have three characteristics:

  1. Preimage resistance: given a hash, it is hard to find the original input

  2. Second preimage resistance: given an input, is hard to find another input that has the same hash

  3. Collision resistance: it is hard to find a pair of inputs that have the same hash

The command line can be used to run find the hash of a particular input into a particular hash function. Note that the hash functions SHA-1 and MD5 are now considered completely broken. In practice, we use SHA-256 and SHA-3.

$ echo -n hello | sha1sum
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d  -
$ echo -n hello | md5sum
5d41402abc4b2a76b9719d911017c592  -

The echo command usually adds a new line () at the end of the string it is echoing. The -n flag included in the commands above specifies that we want to compute hash of the string hello not hello. As you can see below, leaving out this flag dramatically changes the resulting hashes.

$ echo hello | sha1sum
f572d396fae9206628714fb2ce00f72e94f2258f  -
$ echo hello | md5sum
b1946ac92492d2347c6235b4d2611184  -

We can also find hashes in Python.

>>> import hashlib
>>> hashlib.sha1("hello".encode("utf-8")).hexdigest()
'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
>>> hashlib.md5("hello".encode("utf-8")).hexdigest()
'5d41402abc4b2a76b9719d911017c592'

Data Stored in Memory

Endianness describes the order in which bytes are stored in memory. Suppose that we have a byte-addressable memory (such that each memory address holds one byte).

  • Little endian means that the least significant byte is stored in the smallest address.

  • Big endian means that the most significant byte is stored in the smallest address.

You can check the endianness of your personal computer:

$ lscpu

Last updated 2 months ago

Up Next:

⋅ ⋅

2.2 PC Introduction
Home
Work
Thoughts
The output of the man ascii command is the ASCII table.
The output of lscpu includes the endianness of the system.