<jupyter_start><jupyter_text>Running ifconfig and iwconfig as sudoIt is recommended to modify sudoers to allow your user to run ifconfig, iwconfig and tcpdump as sudo without password. otherwise, calling functions that require sudo from notebook, does not work.To modify your sudoer```sudo visudo``` Go to the end of the file and add```your_user_name ALL=(root) NOPASSWD: /sbin/iwconfig, /sbin/ifconfig, /usr/sbin/tcpdump```replace your_user_name by the name of your user<jupyter_code># Init device
wifi = WiFiDevice(iface='wlx1cbfce958ca7')<jupyter_output><empty_output><jupyter_text>Starts channel hopperTo verify monitor iwconfig info using ```watch -n 0.1 sudo iwconfig ```The frequency should be changing for the selected wireless interface<jupyter_code># start channel hopper
wifi.chopper_start()<jupyter_output><empty_output><jupyter_text>Tcpdump process startsSystem is now acquiring dataTo show data, you can use```wifi.read```to print the last line```wifi.read_start```to continuosly decode tcpdump messages into wifi.data, where all data is stored```wifi.sample```same as read_start, but wifi.data now just stores messages corresponding to the last sampling time (defined by wifi.ts)<jupyter_code>wifi.tcpdump_start()<jupyter_output><empty_output><jupyter_text>read<jupyter_code>wifi.read()<jupyter_output><empty_output><jupyter_text>read_start<jupyter_code>wifi.read_start()
for datum in wifi.data:
    print(datum)<jupyter_output><empty_output><jupyter_text>sample<jupyter_code>wifi.sample()
for datum in wifi.data:
    print(datum)
len(wifi.data)<jupyter_output><empty_output><jupyter_text>terminateto end processes, you can either use the wifi.x_process.terminate() when available. replace x by the name of the process for example```wifi.sample_process.terminate()```or ```wifi.terminate```to end all processes<jupyter_code>wifi.sample_alive()
wifi.sample_process.terminate()
wifi.sample_alive()
wifi.terminate()<jupyter_output><empty_output><jupyter_text>WiFiDeviceSHMInherits all methods from WiFiDevice, and additionally publishes data through SHM memory The data is a vector, of MAX_WIFI_LEN (defined in the .py file as 500) A dictionary (mac_dict) is used to decide the position of the signal intensity in the vector If update_dict is true (default), the dictionary is increased for each newly found mac_address<jupyter_code>%matplotlib inline
import sys
import pandas as pd
import numpy as np
sys.path.append('../src/rf_sensor') #rf_sensor/src/rf_sensor folder path
from WiFiDevice_shm import WiFiDeviceSHM
# Init device
wifi = WiFiDeviceSHM(iface='wlx1cbfce958ca7')
wifi.chopper_start()
# start sampling
wifi.sample()
for datum in wifi.data:
    print(datum)
wifi.shm_print()
wifi.terminate()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09147230320699709, 'fraction_numerical': 0.005466472303206997, 'mean_word_length': 7.394495412844036, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '215105', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 927, 'n_tokens_neox': 885, 'n_words': 261, 'path': 'notebooks/Standalone rf_sensor.ipynb', 'repo_name': 'ir-utsunomiya/rf_sensor', 'size': '2744'}