dswqgu 发表于 2025-10-21 19:46:40

iKuai 系统ISO镜像解包

本人所有帖子仅作技术研究,请勿非法破坏,请遵守相关法律法规,后果自负!
## 前言

iKuai 系统镜像解包,下载地址:https://www.ikuai8.com/component/download

## 下载依赖

```
apt install p7zip-full
apt install binwalk
apt install qemu-utils
```

## 解压 iso 文件

```
7z x iKuai8_x64_3.7.1_Build202304060952.iso -oiKuai
```

- 提取 rootfs 文件

```
cp iKuai/boot/rootfs ./
```

## 分析 rootfs 文件

```
binwalk rootfs
```

输出结果:

```
DECIMAL       HEXADECIMAL   DESCRIPTION
--------------------------------------------------------------------------------
24917484      0x17C35EC       QEMU QCOW Image
34312044      0x20B8F6C       gzip compressed data, from Unix, last modified: 2023-04-06 01:53:28
```

## 分割数据

```
binwalk -e -C . rootfs
```

- 得到`_rootfs.extracted/20B8F6C`文件和`_rootfs.extracted/20B8F6C.gz`文件

## 解包头部

### 把头部转 raw

```
qemu-img convert -O raw _rootfs.extracted/20B8F6C rootfs_head.raw
```

### 查看 raw 文件类型

```
file -s rootfs_head.raw
```

- 结果是归档文件

```
rootfs_head.raw: POSIX tar archive (GNU)
```

### 解包归档文件

```
mkdir -p /mnt/rootfs_head
tar -xf rootfs_head.raw -C /mnt/rootfs_head
```

### 得到的是启动介质根目录

```
tree /mnt/rootfs_head
```

输出结果:

```
/mnt/rootfs_head
└── root.grub
    ├── boot
    │ ├── grub
    │ │ ├── grub.cfg
    │ │ ├── grub-disk.cfg
    │ │ ├── grub-disk.img
    │ │ ├── grub-efi.img
    │ │ ├── grub-gpt-boot.img
    │ │ ├── grub-gpt-core.img
    │ │ ├── grub-iso.img
    │ │ ├── i386-pc
    │ │ │ ├── loopback.mod
    │ │ │ └── probe.mod
    │ │ └── x86_64-efi
    │ │   ├── loopback.mod
    │ │   └── probe.mod
    │ └── vmlinuz
    └── EFI
      └── BOOT
            ├── BOOTX64.EFI
            └── grub.cfg
```

## 解包尾部

### 把尾部转 raw

```
qemu-img convert -O raw _rootfs.extracted/20B8F6C.gz rootfs_tail.raw
```

### 查看 raw 文件类型

```
file -s rootfs_tail.raw
```

- 结果是归档文件

```
rootfs_tail.raw: gzip compressed data, last modified: Thu Apr6 01:53:28 2023, from Unix, original size modulo 2^32 0
```

### 解包归档文件

```
mkdir -p /mnt/rootfs_tail
tar -xf rootfs_tail.raw -C /mnt/rootfs_tail
```

### 得到的还是启动介质根目录

```
tree /mnt/rootfs_tail
```

输出内容:

```
/mnt/rootfs_tail
└── root.grub
    ├── boot
    │ ├── grub
    │ │ ├── grub.cfg
    │ │ ├── grub-disk.cfg
    │ │ ├── grub-disk.img
    │ │ ├── grub-efi.img
    │ │ ├── grub-gpt-boot.img
    │ │ ├── grub-gpt-core.img
    │ │ ├── grub-iso.img
    │ │ ├── i386-pc
    │ │ │ ├── loopback.mod
    │ │ │ └── probe.mod
    │ │ └── x86_64-efi
    │ │   ├── loopback.mod
    │ │   └── probe.mod
    │ └── vmlinuz
    └── EFI
      └── BOOT
            ├── BOOTX64.EFI
            └── grub.cfg
```

## 重新解包头部

### 分割头部数据

```
dd if=rootfs of=qcow2.bin bs=1 skip=24917484 count=$((34312044-24917484))
```

### 查看文件类型

```
file qcow2.bin
```

输出内容:

```
qcow2.bin: QEMU QCOW2 Image
```

### 把头部转为 raw

```
qemu-img convert -O raw qcow2.bin qcow.raw
```

## 修改文件内容

- 在`/mnt/r`挂载点中修改文件内容

## 卸载

```
umount /mnt/r
losetup -d /dev/loopN
```

## 合并新 rootfs 文件

### 提取原 rootfs 头部

```
dd if=rootfs bs=1 count=24917484 of=rootfs.head
```

- 得到`rootfs.head`文件

### 压缩新 QCOW2 文件

```
qemu-img convert -O qcow2 -c rootfs.raw rootfs.qcow2.new
```

- 得到修改后的`rootfs.qcow2.new`文件

### 合并新 rootfs 文件

```
cat rootfs.head rootfs.qcow2.new > rootfs.mod
```

## 重新打包 iso 文件

### 替换新 roofs 文件

```
cp rootfs.mod ikuai/boot/rootfs
```

### 重新打包 iso 文件

```
7z a iKuai8.iso iKuai
```

## 完成

cxcx 发表于 2025-10-21 19:48:01

不觉明历!

ahqier 发表于 2025-10-21 20:09:49

佬厉害啊

chendeshen 发表于 2025-10-21 22:30:18

佬厉害啊

倒霉鬼 发表于 2025-10-21 23:43:50

终于看到ikuai了又,当初来这个论坛就是奔着ikuai来的{tieba23}{tieba23}{tieba23}

tianzi 发表于 2025-10-22 11:54:57

厉害了

yczxknp 发表于 2025-11-11 12:16:25

学习学习了!
页: [1]
查看完整版本: iKuai 系统ISO镜像解包