Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Friday, January 3, 2025

PowerShell Get-FileHash

PowerShell Get-FileHash

เรียนรู้วิธีใช้คำสั่ง Microsoft PowerShell Get-FileHash โดยใช้ PowerShell ซึ่งจะใช้ได้กับไฟล์ทุกประเภท ไม่ว่าจะเป็น exe, msi, docx, pdf, iso และอื่นๆ

วิธีทำ  hash Checksum บน Windows (ไม่ต้องใช้แอพ)

Computes the hash value for a file by using a specified hash algorithm.

Download picture  SHA1: 9bcddbdc6e669ce7b3aaf031699fadcfed3eb6eb

PS#Get-FileHash D:\Lab\Hash\PIC1.jpg | Format-List

การใช้ Power Shell

1. กดWindows+Rเพื่อเปิดกล่องRun

2. พิมพ์powershel l แล้วคลิกตกลง

3. หน้าต่าง Windows PowerShell จะเปิดขึ้น

4. รันคำสั่งต่อไปนี้:


PowerShell Get-FileHash

Examples 1: Compute the hash value for a file

This example uses the Get-FileHash cmdlet to compute the hash value for the /etc/apt/sources.list file. The hash algorithm used is the default, SHA256. The output is piped to the Format-List cmdlet to format the output as a list.

Get-FileHash /etc/apt/sources.list | Format-List Algorithm : SHA256 Hash : 3CBCFDDEC145E3382D592266BE193E5BE53443138EE6AB6CA09FF20DF609E268 Path : /etc/apt/sources.list

Example 2: Compute the hash value for a file

Compute the hash value for a PowerShell.exe file:
PS C:\> Get-FileHash $pshome\powershell.exe | Format-List
Algorithm : SHA256
Hash      : 6A785ADC0263238DAB3EB37F4C185C8FBA7FEB5D425D034CA9864F1BE1C1B473
Path      : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Example 3: Compute the hash value for an ISO file

This example uses the Get-FileHash cmdlet and the SHA384 algorithm to compute the hash value for an ISO file that an administrator has downloaded from the internet. The output is piped to the Format-List cmdlet to format the output as a list.

Get-FileHash C:\Users\user1\Downloads\Contoso8_1_ENT.iso -Algorithm SHA384 | Format-List Algorithm : SHA384 Hash : 20AB1C2EE19FC96A7C66E33917D191A24E3CE9DAC99DB7C786ACCE31E559144FEAFC695C58E508E2EBBC9D3C96F21FA3 Path : C:\Users\user1\Downloads\Contoso8_1_ENT.iso


Parameters

-Algorithm

Specifies the cryptographic hash function to use for computing the hash value of the contents of the specified file or stream. A cryptographic hash function has the property that it is infeasible to find two different files with the same hash value. Hash functions are commonly used with digital signatures and for data integrity. The acceptable values for this parameter are:

  • SHA1
  • SHA256
  • SHA384
  • SHA512
  • MD5

อ่านเพิ่มเติม:

หมายเหตุ:เนื้อหาในเว็บไซต์นี้มีขึ้นเพื่อวัตถุประสงค์ในการให้ข้อมูล  เผยแพร่ความรู้และให้โอกาสในการค้นคว้าหาข้อมูลเพื่อการศึกษา   บุคคลที่สนใจโดยทั่วไป รวมถึงนักเรียน นิสิต นักศึกษา  ในการเรียนรู้เท่านั้น

* หากมีข้อมูลข้อผิดพลาดประการใด ขออภัยมา ณ ที่นี้ด้วย  รบกวนแจ้ง Admin เพื่อแก้ไขต่อไป
ขอบคุณครับ

#WINDOWSFORENSIC #COMPUTERFORENSICS #DFIR #FORENSICS #DIGITALFORENSICS #COMPUTERFORENSIC #INVESTIGATION #CYBERCRIME #FRAUD


Sunday, March 31, 2019

Digital Forensics:Powershell Forensic

Digital Forensics:Powershell Forensic

   วันนี้ Admin ไปเจอ เครื่องมือสำหรับ Forensics โดยใช้ powershell ใครที่ถนัด Powershell  มาทางนี้ครับ  ชื่อว่า PowerForensics มี Module หลายตัวให้ศึกษา แต่เนื่องจากผู้ที่ศึกษาต้องมีพื่้นความรู้เรื่อง Windows File system ระดับหนึ่งก่อน ถึงจะเข้าใจว่าแต่ละคำสั่งใช้ทำอะไร ผมบอกเลยเรื่องนี้ยาก  แต่เครื่องมือใช้งานง่าย  เอาว่าผมข้ามไปอธิบายวิธีการติตตั้งและใช้งานเลยครับ

สิ่งที่ต้องเตรียม

- Powershell   ใน windows 7, 8 ,10 ,Up 
- เครื่องสำหรับทดสอบ Windows windows 7, 8 ,10  Up
- PowerForensics  download จาก github
 - ให้ท่านศึกษาเพิ่มเติมเรื่อง Windows File System , NTFS, MFT  ก่อนทำเรื่องนี้

หมายเหตุ  หากท่านมี Toots ตัวอื่นก็สามารถใช้งานแทนได้

 Step 1 ไป download   PowerForensics จาก github

Step 2   ทำการแตกไฟล์ไว้ที่ Foder C:\Program Files\WindowsPowerShell\Modules\


Step 3  ทำการ Import-Module โดยใช้คำสั่งดังนี้
#Import-Module 'C:\Program Files\WindowsPowerShell\Modules\PowerForensicsv2'

Step 4  ทำการเรียกดูคำสั่งที่อยูู่ใน PowerForensicsv2  โดยใช้คำสั่งดังนี้
#Get-Command -Module PowerForensicsv2
Step 5 ทำการเรียกดูตำแหน่งและรายละเอียดของ Timestamp ของ โปรแกรม  notepad.exe ใน  MFT  โดยใช้คำสั่ง  Get-ForensicFileRecord -Path C:\Windows\notepad.exe


Step 5 ทำการเรียกดูตำแหน่งและรายละเอียดของ Timestamp ของ  MFT ใน C:\  โดยใช้คำสั่ง  Get-ForensicFileRecord -Path c:\$mft

Step 6 ทำการเรียกดูตำแหน่งและรายละเอียดของ Timestamp ของ  Index 0  โดยใช้คำสั่ง  Get-ForensicFileRecord -Index 0

 Step  7 ทำการใช้  FTK Imager  เปิด ดู Timestamp ของ  $MFT ใน C:\


 ศึกษาเพิ่มเติม:
https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/Import-Module?view=powershell-6
https://github.com/Invoke-IR/PowerForensics/releases
http://www.invoke-ir.com/2016/02/


หมายเหตุ:เนื้อหาในเว็บไซต์นี้มีขึ้นเพื่อวัตถุประสงค์ในการให้ข้อมูลและเพื่อการศึกษาเท่านั้น

* หากมีข้อมูลข้อผิดพลาดประการใด ขออภัยมา ณ ที่นี้ด้วย  รบกวนแจ้ง Admin เพื่อแก้ไขต่อไป
ขอบคุณครับ


#WindowsForensic #ComputerForensics #dfir #forensics #digitalforensics #computerforensic #investigation #cybercrime #fraud #Powershell Forensic

บุก 2 จุด ทลายเครือข่ายค้าคลิปเยาวชนแนว นาย – ทาส เปิดกลุ่มลับเก็บค่าสมาชิก

บุก 2 จุด ทลายเครือข่ายค้าคลิปเยาวชนแนว นาย – ทาส เปิดกลุ่มลับเก็บค่าสมาชิก Photo Credit:F Bตำรวจสอบสวนกลาง ตำรวจสอบสวนกลาง (CIB) โดย กองบัง...