iT邦幫忙

2025 iThome 鐵人賽

DAY 13
0
Security

藍隊星星的數位鑑識筆記系列 第 13

Day.13 隱寫術 Steganography(五)Steganography in Python

  • 分享至 

  • xImage
  •  

目錄

  1. 前言
  2. Steganography
  3. WavSteg
  4. LSBSteg
  5. StegDetect
  6. 總結

正文

前言

這是我在 Day.11 很崩潰地嘗試各種工具時找到的 python 工具,感覺很有趣所以就想來介紹給大家試試~

Steganography

一個整合了 WavSteg、LSBSteg、StegDetect 的工具,可以直接在 Terminal 上執行指令或是撰寫 Python 程式然後引用這個函式庫。

記得要先安裝好 python3 的環境喔!

安裝步驟

  • 用 pip 下載(如果 pip 的環境變數沒有設好可以用第二行的指令
    pip install stego-lsb
    python -m pip install stego-lsb
    
  • 從 github 下載
    git clone https://github.com/ragibson/Steganography
    cd Steganography
    python setup.py install
    

WavSteg

專門用來隱寫 .wav 檔案的工具。

  • 參數:
參數 英文說明 中文說明
h, --hide To hide data in a sound file 嵌入檔案
-r, --recover To recover data from a sound file 提取檔案
-i, --input Path to a .wav file 檔案(.wav 檔)的路徑
-s, --secret Path to a file to hide in the sound file 機密資訊檔案的路徑
-o, --output Path to an output file 輸出檔案的路徑
-n, --lsb-count How many LSBs to use [default: 2] 想要使用多少 LSB(預設 2)
-b, --bytes How many bytes to recover from the sound file 想從音檔中提取多少位元組
--help Show this message and exit. 幫助
  • 嵌入檔案(若機密檔案太大,會提供使用者嵌入該檔案的建議 LSB 數)
    stegolsb wavsteg -h -i <.wav檔案路徑> -s <機密檔案路徑> -o <輸出檔案路徑> -n <LSB 數>
    
  • 提取檔案
    stegolsb wavsteg -r -i <.wav檔案路徑> -o <輸出檔案路徑> -n <LSB 數> -b <提取出的大小>
    

LSBSteg

用來隱寫圖片檔案的工具。

  • 參數:
參數 英文說明 中文說明
h, --hide To hide data in an image file 嵌入檔案
-r, --recover To recover data from a image file 提取檔案
-a, --analyze Print how much data can be hidden within an image [default: False] 輸出該圖片可隱藏的資訊大小(預設不顯示)
-i, --input Path to a bitmap (.bmp or .png) file 圖片檔案的路徑
-s, --secret Path to a file to hide in the image file 機密資訊檔案的路徑
-o, --output Path to an output file 輸出檔案的路徑
-n, --lsb-count How many LSBs to use [default: 2] 想要使用多少 LSB(預設 2)
-c, --compression 1 (best speed) to 9 (smallest file size) [default: 1] 1(最快)到9(最小的檔案容量)(預設 1)
--help Show this message and exit. 幫助
  • 嵌入檔案
    stegolsb steglsb -h -i <圖片檔案路徑> -s <機密檔案路徑> -o <輸出檔案路徑> -n <LSB 數> -c <整數範圍>
    
  • 提取檔案
    stegolsb steglsb -r -i <圖片檔案路徑> -o <輸出檔案路徑> -n <LSB 數>
    

StegDetect

用來偵測圖片隱寫的工具。

  • 參數:
參數 英文說明 中文說明
-i, --input To hide data in a image 圖片檔案的路徑
-n, --lsb-count How many LSBs to use [default: 2] 想要使用多少 LSB(預設 2)
--help Show this message and exit. 幫助

總結

因為今天有神盾獎又有其他的事情要忙,所以就很快速的和大家介紹這些工具~明天再來帶大家做一些隱寫術的題目喔!敬請期待。

參考資料


上一篇
Day.12 隱寫術 Steganography(四)聲音隱寫之 Audacity
系列文
藍隊星星的數位鑑識筆記13
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言