Я использую Ubuntu (если это поможет)
У меня есть USB-устройство с адаптером беспроводной сети, которое я использую (tenda N150). ) для сканирования сетей.
Я использовал учебник, и в нем просили перевести устройство в режим монитора.
Код: Выделить всё
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
Код: Выделить всё
from scapy.all import *
from threading import Thread
import pandas
import time
import os
# initialize the networks dataframe that will contain all access points nearby
networks = pandas.DataFrame(columns=["BSSID", "SSID", "dBm_Signal", "Channel", "Crypto"])
# set the index BSSID (MAC address of the AP)
networks.set_index("BSSID", inplace=True)
def callback(packet):
if packet.haslayer(Dot11Beacon):
# extract the MAC address of the network
bssid = packet[Dot11].addr2
# get the name of it
ssid = packet[Dot11Elt].info.decode()
try:
dbm_signal = packet.dBm_AntSignal
except:
dbm_signal = "N/A"
# extract network stats
stats = packet[Dot11Beacon].network_stats()
# get the channel of the AP
channel = stats.get("channel")
# get the crypto
crypto = stats.get("crypto")
networks.loc[bssid] = (ssid, dbm_signal, channel, crypto)
def print_all():
while True:
os.system("clear")
print(networks)
time.sleep(0.5)
def change_channel():
ch = 1
while True:
os.system(f"iwconfig {interface} channel {ch}")
# switch channel from 1 to 14 each 0.5s
ch = ch % 14 + 1
time.sleep(0.5)
if __name__ == "__main__":
# interface name, check using iwconfig
interface = "wlxc83a35c2e0bb"
# start the thread that prints all the networks
printer = Thread(target=print_all)
printer.daemon = True
printer.start()
# start the channel changer
channel_changer = Thread(target=change_channel)
channel_changer.daemon = True
channel_changer.start()
# start sniffing
sniff(prn=callback, iface=interface, monitor=True)
Код: Выделить всё
OSError: [Errno 100] Network is down
Код: Выделить всё
wlxc83a35c2e0bb IEEE 802.11 Mode:Monitor Tx-Power=20 dBm
Retry short long limit:2 RTS thr:off Fragment thr:off
Power Management:off
код, который я пробовал, написан выше
Подробнее здесь: https://stackoverflow.com/questions/759 ... ork-is-dow