---
# System prepended metadata

title: MISC by ha
tags: [2024 NISRA Enlightened]

---

:::info
# MISC
講師：小紅
時間：8/26 10:00~12:00
:::

[簡報](https://drive.google.com/file/d/1PpVSCNiV1zoC1RWhBHJd_JEKPbbY-Zwb/view?pli=1)

- binary、hex、ASCII、bits、bytes
- PNG、JPEG 的 header/structure
- ZIP psesudo encrypt

## 二進位

- Binary: Base on 0,1
> $x_0\times2^0+x_1\times2^1+x_2\times2^2+...+x_n\times2^n$

## Hexadecimal

|   Decimal   |  0  | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10  | 11  | 12  | 13  | 14  | 15  |
|:-----------:|:---:| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |:---:|:---:|
| Hexadeciaml |  0  | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | A   | B   | C   | D   |  E  |  F  |

## ASCII

- **A**merican **S**tandard **C**ode for **I**nformation **I**nterchange
- 編碼

## XOR 互斥或

- symbol: XOR, ⊕, ⊻

|  A  | B   | A ⊕ B | A ⊕ B ⊕ B |
|:---:| --- |:-----:|:---------:|
|  0  | 0   |   0   |     0     |
|  0  | 1   |   1   |     0     |
|  1  | 0   |   1   |     1     |
|  1  | 1   |   0   |     1     |

- (A\^B)\^B = A\^B\^B = A
- 有交換律

## Bit & Byte

1 byte = 8 bits

[Github: ImHex](https://github.com/WerWolv/ImHex)

## PNG

![](https://github.com/corkami/formats/blob/master/image/PNGRGB_dissected.png?raw=true)

## JPEG

早期 windows 的附檔名只能寫三個字元，所以 `jpeg` → `jpg`

![](https://github.com/corkami/formats/blob/master/image/JPEGRGB_dissected.png?raw=true)

## ZIP

`bit flag`、`general flag`，把 `0x0100` 換成 `0x0000`

## Screenshot

CVE-2023-28303
CVE-2023-21036

裁切後的截圖沒有丟掉原本的資料，可以透過腳本還原

[acropalypse](https://acropalypse.app/)
[acropalypse script](https://gist.github.com/DavidBuchanan314/93de9d07f7fab494bcdf17c2bd6cef02)

## Steganography 隱寫

offset
XOR

LSB：用圖片 RGB 的 **L**ast **S**ignificant **B**it 紀錄訊息，隱藏在圖片裡面。

`0xfe` = `0b11111110`