概要
umap2はFacedancerが推奨されていますが、高額で手に入りにくいのでRaspberryPi Zero Wを使用してumap2を動かす方法を紹介します。
環境構築
古いバージョンのものが必要なのでOSのインストールから解説していきます。
OSインストール
公式サイトからRaspberry Pi ImagerをダウンロードしてPCにインストールする。
umap2はpython2で動くため、OSアーカイブから2022-09-22-raspios-bullseye-armhf-full.img.xzをダウンロードする。
Raspberry Pi Imagerを使って書き込む(ユーザー名・パスワードを設定しておく)
シリアル通信を行うためconfig.txtに下記の内容を追記する。
[pm0]
dtoverlay=dwc2
enable_uart=1
Wi-Fi設定
LANポートが無いのでWi-Fiの設定を行う。
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
の中にあるSSIDとパスワードを設定する。
python2利用設定
python2で開発されたものなので、python2の環境を設定する。
sudo apt-get -y install python-dev
python2をメイン環境に設定する。
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --config python
下記画面で、python2を選択する。
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.9 2 auto mode
1 /usr/bin/python2.7 1 manual mode
2 /usr/bin/python3.9 2 manual mode
Press <enter> to keep the current choice[*], or type selection number:1
バージョンが変更されたか確認する。
python -V
Python 2.7.18
環境変数を設定する。
sudo nano ~/.bashrc
PATH=/home/pi/.local/bin:$PATH
source ~/.bashrc
ツールインストール
pip2をインストールする。
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python2 get-pip.py
必要なモジュールをインストールする。
sudo apt install python-setuptools
sudo pip2 install requests
sudo pip2 install bitstring
追加モジュールインストールする。
git clone https://github.com/BinyaminSharet/Mtp.git
cd Mtp
sudo python2 setup.py install
umap2インストール
umap2をダウンロードする。
git clone https://github.com/nccgroup/umap2.git
umap2をインストールする。
cd umap
sudo python2 setup.py install
テスト用のファイル・ディレクトリを作成する。
cd umap/data
tar xvf fat32.3M.stick.img.tar
mkdir mtp_fs
実行方法
ログイン
teratarmのシリアルポートで接続。スピードを115200に変更する。
umap2実行
gadget
ディレクトリに移動し、ラズパイ用のシェルスクリプトを実行する。
cd umap/gadget
sudo sh start_gadgetfs_RaspiZeroW.sh
その後umap/data
に移動して実行する。
cd
cd umap/data
sudo umap2scan -P gadgetfs
出力結果を保存したい場合はteratarmのログ機能を利用してください。