Sunday, January 23, 2022

Making Image of A Laptop (Part 2)

1.      Making image with Kali Linux

1.1   Description

 

The first step of the incident response is to image the suspicious system and get the hash of the

DD image, which can prove the status of the suspicious system don’t get any modifications. Keep in mind that the less changes on the suspicious system, the better.

 

1.2   Requirement

1)    USB sticker, 8GB or greater. It will be used to boot the system with a customized Linux to make the image.

2)    USB External hard drive. Recommend 1TB or greater. It will be used to save the image.

3)    Download Kali ISO (https://www.kali.org/docs/introduction/download-official-kali-linux-images/ )

4)    Rufus 3.8 or later (https://rufus.ie/)

 

1.3   Make a bootable USB Sticker with Kali Linux

1)    On a test laptop (not the suspicious laptop), download Kali Linux ISO from https://www.kali.org/get-kali/#kali-bare-metal, make sure you select the correct version.

2)    Download Rufus from https://rufus.ie/

3)    Insert the USB sticker. Run Rufus, select the device and ISO file (Boot selection), leave other options as default setting. Click “Start” button to start making the bootable USB.



 

 

1.4   Make DD image of the suspicious system

 

1)    Make the suspicious computer sleep or shut it down as soon as possible to maintain the environment.

2)    Find out how to boot from a USB Stricker on the suspicious laptop. Different laptop might have different methods.

3)    Attached the Kali Linux USB sticker and boot the suspicious system from it.

4)    On the “Boot menu”, select “Live (forensic mode)”. This option is going to run the Kali without installing.



5)    Attach the external USB hard disk. The image will be saved on it.

6)    Open the “Terminal Simulator”.



7)    Run the following command

# sudo su

# fdisk -l

# dd if=/dev/nvme0n1 of=/media/kali/Fast_External/myimage.img bs=65536  conv=noerror,sync

 

Note: In this example, the computer’s disk name is “nvme0n1” and the name of external USB Hard Disk is “Fast_External” change these points according to the result of fdisk command.



Also refer to:

1)    Making Image of a laptop – Summary (https://andyinmatrix.blogspot.com/2022/01/making-image-of-laptop-summary.html )

2)    Paladin Edge 64 (https://andyinmatrix.blogspot.com/2021/03/making-image-of-laptop.html )

3)    Kali Linux (https://andyinmatrix.blogspot.com/2022/01/making-image-of-laptop-part-2.html )

4)    FTK Imager (https://andyinmatrix.blogspot.com/2022/01/making-image-of-laptop-part-3.html )

 


Thursday, January 6, 2022

Windows File operation during IR

 

Windows File operation during IR (Incident Response)

 

(Just for my references)

Sort files by date

 

dir *.* /s /O:D > c:\temp\filelist.txt

dir /O:-D: sort by time, newer to older

 

Show file ownership

dir *.exe /ah /q

 

Search file using Where command:

WHERE /R c:\windows *.exe *.dll *.bat

 

File Property

Powershell:

Get-ItemProperty -Path .\test.exe | Format-list -Property * -Force

Get-Item .\test.exe | select-object -Property *

Get-acl .\test.exe | select-object -Property *

 

Search files with modified day

Command line: (new files since 2021-12-21)

forfiles.exe /D +2021-12-21 /S /C "cmd.exe /c IF @isdir==FALSE dir /q @file"

If you got “ERROR: Invalid date specified.”, type "FORFILES /?" to find out the correct date format.

 

PowerShell: (new files since 10 days ago)

$time = (Get-Date).AddDays(-10)

Get-ChildItem c:\windows -Recurse | Where-Object {$_.LastWriteTime -gt $time}

 

Get file hash

Command line: certutil.exe -hashfile c:\test.exe sha256

Powershell: Get-FileHash c:\test.exe | Format-List

 

Delete file / folder

Below commands delete all *.txt files under c:\temp folder and subfolder older than 10 days. Save it as a .bat file and run it:

Set "Target=c:\temp\"

Set "daysold=10"

If Exist "%Target%" (

 rem ECHO Y| Icacls %Target% /T /C /grant Administrators:F

"forfiles.exe" /p "%Target%" /M *.txt /d -%daysold% /c "cmd /c if @isdir==FALSE del @file /q"

)

 

Below commands delete all $Recycle.Bin folder under c:\temp folder and subfolder older than 10 days. Save it as a .bat file and run it:

Set "Target=C:\temp\$Recycle.Bin"

Set "daysold=10"

If Exist "%Target%" (

"forfiles.exe" /p "%Target%" /d -%daysold% /c "cmd.exe /c IF @isdir==TRUE RD @Path /S /Q"

)

 

Another example:

Rem if starting from c:\, use c:\\, “c:\” doesn’t seem to work

Set "Target=c:\\"

If Exist "%Target%" (

 "forfiles.exe" /p "%Target%" /S /M $Recycle.Bin /c "cmd /c attrib @file -S -H +A"

 "forfiles.exe" /p "%Target%" /S /M $Recycle.Bin /c "cmd /c rmdir @file /s /q"

)

 

 

Below commands delete all files under c:\temp folder and subfolder older than 10 days. Save it as a .bat file and run it:

 

$DateToDelete = 10

$StartFolder = "c:\temp"

dir $StartFolder -Recurse -Force -ea 0 | ?{!$_.PsIsContainer -and $_.LastWriteTime -lt (Get-Date).AddDays(-$DateToDelete)} | rmdir -Force

 

Tuesday, August 31, 2021

How to import eBooks to iPad mini

(Just for my reference)

Environment:

1.     Mac OS Big Sur

2.     Build-in tool: SimpleHTTPServer

3.     iPad mini

 

Steps:

1.   Make sure iPad mini and the MacBook are in the same network.

2.   Open Terminal window on Mac.

3.   Go to the folder where the eBooks were located. (cd commad)

4.   Run command: python -m SimpleHTTPServer 8000

5.   Parameter 8000 is the port number. It can be changed.

6.   Open Safari of the iPad mini.

7.   On the Address bar, enter http://MacIP:8000, it should list the books on the folder.

8.   Click one of the books. And then click “Open from ‘iBooks’”

9.   The book will be copied to iBooks app.

10.          Return to Safari, and repeat it.

11.          After finishing the importing, close the Safari browser.

12.          On MacBook, press Ctrl+c to end the simple http server.