0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RaspberryPi Zero Wでumap2を使ってUSBホストスキャンする方法

Last updated at Posted at 2025-01-08

概要

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のログ機能を利用してください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?