2024-07-19 04:51:22 +00:00
# 图像采集与挂载
{% hint style="success" %}
学习与实践 AWS 黑客技术:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
学习与实践 GCP 黑客技术:< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks 培训 GCP 红队专家 (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
< details >
2024-07-19 04:51:22 +00:00
< summary > 支持 HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-19 04:51:22 +00:00
* 查看 [**订阅计划** ](https://github.com/sponsors/carlospolop )!
* **加入** 💬 [**Discord 群组** ](https://discord.gg/hRep4RUj7f ) 或 [**Telegram 群组** ](https://t.me/peass ) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **通过向** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) 和 [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) GitHub 仓库提交 PR 分享黑客技巧。
2022-04-28 16:01:33 +00:00
< / details >
2024-07-19 04:51:22 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-05-02 15:03:25 +00:00
< figure > < img src = "https://pentest.eu/RENDER_WebSec_10fps_21sec_9MB_29042024.gif" alt = "" > < figcaption > < / figcaption > < / figure >
2024-04-07 22:57:42 +00:00
{% embed url="https://websec.nl/" %}
2024-07-19 04:51:22 +00:00
## 采集
2022-04-28 16:01:33 +00:00
2022-09-09 12:03:08 +00:00
### DD
2021-01-05 13:06:39 +00:00
```bash
#This will generate a raw copy of the disk
dd if=/dev/sdb of=disk.img
```
2024-02-07 05:49:16 +00:00
### dcfldd
2021-01-05 13:06:39 +00:00
```bash
2022-09-09 12:03:08 +00:00
#Raw copy with hashes along the way (more secur as it checks hashes while it's copying the data)
2021-01-05 13:06:39 +00:00
dcfldd if=< subject device > of=< image file > bs=512 hash=< algorithm > hashwindow=< chunk size > hashlog=< hash file >
dcfldd if=/dev/sdc of=/media/usb/pc.image hash=sha256 hashwindow=1M hashlog=/media/usb/pc.hashes
```
2022-09-09 12:03:08 +00:00
### FTK Imager
2021-01-05 13:06:39 +00:00
2024-07-19 04:51:22 +00:00
您可以[**从这里下载 FTK imager**](https://accessdata.com/product-download/debian-and-ubuntu-x64-3-1-1)。
2021-01-05 13:06:39 +00:00
```bash
ftkimager /dev/sdb evidence --e01 --case-number 1 --evidence-number 1 --description 'A description' --examiner 'Your name'
```
2022-09-09 12:03:08 +00:00
### EWF
2021-01-05 13:06:39 +00:00
2024-07-19 04:51:22 +00:00
您可以使用[ **ewf tools** ](https://github.com/libyal/libewf)生成磁盘映像。
2021-01-05 13:06:39 +00:00
```bash
ewfacquire /dev/sdb
#Name: evidence
#Case number: 1
#Description: A description for the case
#Evidence number: 1
#Examiner Name: Your name
#Media type: fixed
#Media characteristics: physical
#File format: encase6
#Compression method: deflate
2022-05-01 12:41:36 +00:00
#Compression level: fast
2021-01-05 13:06:39 +00:00
#Then use default values
#It will generate the disk image in the current directory
```
2024-07-19 04:51:22 +00:00
## Mount
2021-01-05 13:06:39 +00:00
2024-07-19 04:51:22 +00:00
### Several types
2021-04-01 21:44:54 +00:00
2024-07-19 04:51:22 +00:00
在**Windows**中, 您可以尝试使用Arsenal Image Mounter的免费版本 ([https://arsenalrecon.com/downloads/](https://arsenalrecon.com/downloads/)) 来**挂载取证镜像**。
2021-04-01 21:44:54 +00:00
2022-09-09 12:03:08 +00:00
### Raw
2021-01-05 13:06:39 +00:00
```bash
#Get file type
2023-08-03 19:12:22 +00:00
file evidence.img
2021-01-05 13:06:39 +00:00
evidence.img: Linux rev 1.0 ext4 filesystem data, UUID=1031571c-f398-4bfb-a414-b82b280cf299 (extents) (64bit) (large files) (huge files)
#Mount it
mount evidence.img /mnt
```
2024-02-07 05:49:16 +00:00
### EWF
2021-01-05 13:06:39 +00:00
```bash
#Get file type
2023-08-03 19:12:22 +00:00
file evidence.E01
2021-01-05 13:06:39 +00:00
evidence.E01: EWF/Expert Witness/EnCase image file format
#Transform to raw
mkdir output
ewfmount evidence.E01 output/
2023-08-03 19:12:22 +00:00
file output/ewf1
2021-01-05 13:06:39 +00:00
output/ewf1: Linux rev 1.0 ext4 filesystem data, UUID=05acca66-d042-4ab2-9e9c-be813be09b24 (needs journal recovery) (extents) (64bit) (large files) (huge files)
#Mount
mount output/ewf1 -o ro,norecovery /mnt
```
2022-09-09 12:03:08 +00:00
### ArsenalImageMounter
2021-05-28 17:29:30 +00:00
2024-07-19 04:51:22 +00:00
这是一个用于挂载卷的Windows应用程序。您可以在这里下载 [https://arsenalrecon.com/downloads/ ](https://arsenalrecon.com/downloads/ )
2021-01-05 13:06:39 +00:00
2024-07-19 04:51:22 +00:00
### Errors
2021-01-05 13:06:39 +00:00
2024-07-19 04:51:22 +00:00
* **`cannot mount /dev/loop0 read-only`** 在这种情况下,您需要使用标志 ** `-o ro,norecovery` **
* **`wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.`** 在这种情况下,挂载失败是因为文件系统的偏移量与磁盘映像的偏移量不同。您需要找到扇区大小和起始扇区:
2021-01-05 13:06:39 +00:00
```bash
2023-08-03 19:12:22 +00:00
fdisk -l disk.img
2021-01-05 13:06:39 +00:00
Disk disk.img: 102 MiB, 106954648 bytes, 208896 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00495395
Device Boot Start End Sectors Size Id Type
disk.img1 2048 208895 206848 101M 1 FAT12
```
2024-07-19 04:51:22 +00:00
注意扇区大小为 **512** ,起始为 **2048** 。然后像这样挂载镜像:
2021-01-05 13:06:39 +00:00
```bash
mount disk.img /mnt -o ro,offset=$((2048*512))
```
2024-05-02 15:03:25 +00:00
< figure > < img src = "https://pentest.eu/RENDER_WebSec_10fps_21sec_9MB_29042024.gif" alt = "" > < figcaption > < / figcaption > < / figure >
2024-04-07 22:57:42 +00:00
{% embed url="https://websec.nl/" %}
2024-07-19 04:51:22 +00:00
{% hint style="success" %}
学习和实践 AWS 黑客技术:< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > [**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)< img src = "/.gitbook/assets/arte.png" alt = "" data-size = "line" > \
学习和实践 GCP 黑客技术:< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > [**HackTricks 培训 GCP 红队专家 (GRTE)**< img src = "/.gitbook/assets/grte.png" alt = "" data-size = "line" > ](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
< details >
2024-07-19 04:51:22 +00:00
< summary > 支持 HackTricks< / summary >
2022-04-28 16:01:33 +00:00
2024-07-19 04:51:22 +00:00
* 查看 [**订阅计划** ](https://github.com/sponsors/carlospolop )!
* **加入** 💬 [**Discord 群组** ](https://discord.gg/hRep4RUj7f ) 或 [**Telegram 群组** ](https://t.me/peass ) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
* **通过向** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) 和 [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) GitHub 仓库提交 PR 来分享黑客技巧。
2022-04-28 16:01:33 +00:00
< / details >
2024-07-19 04:51:22 +00:00
{% endhint %}