How to use a Raspberry Pi as a Wi-Fi sniffer

By | 2024년 3월 23일
Table of Contents

How to use a Raspberry Pi as a Wi-Fi sniffer

참조

참조

사전지식

무선 랜카드(동글이) 가 monitor mode 여야 합니다.
monitor mode 가 아니면 그냥 나와 관련된 패킷만 볼 수 있습니다.

공기중에 떠 다니는 모든 패킷을 보려면 monitor mode 가 필요하고…
monitor mode 에서는 인터넷이 않됩니다.

그래서 별도 와이파이 랜카드(일명 동글이) 가 필요합니다.

요점 : 추가 무선 랜카드(동글이) 사세요.

준비물

라즈베리 파이
TP-Link Archer T2U Plus / AC600 High Gain USB Wifi Adapter

동글이는 아무거나 해도 되지만,
최소한 모니터 모드가 가능해야 하고,
2.4기가 5기가 모두 접속 가능한게 좋습니다.

라즈베리파이 OS 설치

윈도우는 제약사항이 많다고 합니다.
리눅스를 설치해 줍니다.
Ubuntu 를 설치해 줍니다.

드라이버 설치

sudo apt-get update
sudo apt install git
sudo apt install wireless-tools

sudo apt install netplan.io
sudo apt install network-manager

sudo apt install build-essential libelf-dev linux-headers-$(uname -r)
git clone https://github.com/aircrack-ng/rtl8812au.git
cd rtl8812au/
make
sudo make install
# reboot pi
sudo reboot

iwconfig

프로그램 설치

Should non-superusers be able to capture packets? 라는 질문이 나오면 Yes 를 입력해 줍니다.

# sudo apt-get update
sudo apt-get install wireshark-common aircrack-ng tshark
# sudo apt-get install wireshark

sudo chmod a+x /usr/bin/dumpcap

동글이 연결

무선랜과 별개로 새로 패킷 스니핑을 위한 동글이를 연결합니다.

ip address show
......
4: wlx3c52a146f8b2: <BROADCAST,MULTICAST> mtu 2312 qdisc noop state DOWN group default qlen 1000
    link/ether 3c:52:a1:46:f8:b2 brd ff:ff:ff:ff:ff:ff
......

monitor mode 활성화

iwconfig
......
wlx3c52a146f8b2  unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency=2.437 GHz  Access Point: Not-Associated
......

sudo apt install net-tools
sudo ifconfig wlx3c52a146f8b2 down

# 일시적인 오류가 있을 수 있음
# sudo iwconfig wlx3c52a146f8b2 mode monitor
# Error for wireless request "Set Mode" (8B06) :
#     SET failed on device wlx3c52a146f8b2 ; Operation not permitted.
# sudo iwconfig wlx3c52a146f8b2 mode monitor
# Error for wireless request "Set Mode" (8B06) :
#     SET failed on device wlx3c52a146f8b2 ; Operation not permitted.
# sudo ifconfig wlx3c52a146f8b2 up
# sudo ifconfig wlx3c52a146f8b2 down
# sudo iwconfig wlx3c52a146f8b2 mode monitor
# sudo ifconfig wlx3c52a146f8b2 up

sudo iwconfig wlx3c52a146f8b2 mode monitor
sudo ifconfig wlx3c52a146f8b2 up

iwconfig
......
wlx3c52a146f8b2  IEEE 802.11b  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Monitor  Frequency:2.437 GHz  Access Point: Not-Associated
......

Mode:Monitor 로 모니터 모드인 것을 확인할 수 있습니다.

고난의 행군

iwconfig
......
wlx3c52a146f8b2  IEEE 802.11b  ESSID:""  Nickname:"<WIFI@REALTEK>"
          Mode:Monitor  Frequency:2.437 GHz  Access Point: Not-Associated
......

Mode:Monitor 옆애 Frequency:2.437 GHz 라는거 보이시나요?

와이파이 통신중 2.437 GHz 대역 하나만 본다는 의미입니다.

모든 통신을 확인하려면…
와이파이 2.4GHz 구간에도 채널이 10개 이상 있고…
와이파이 5GHz 구간에도 채널이 10개 이상 있고…

열심히 모든 채널을 순차 검색해야 합니다.

One thought on “How to use a Raspberry Pi as a Wi-Fi sniffer

답글 남기기