It is my first post on the forum and I hope everyone enjoys the progress I've had with being able to sniff and inject raw wifi packets. I spent the last week getting 802.11 promiscuous mode and packet injection working in micropython v1.12 (v1.12-256-geae495a71-dirty) using ESP-IDF v4.0. I've uploaded the firmware.bin and example python code to github.
https://github.com/NicheSecTech/esp32-m ... iff-inject
When you look at the example, it may seem like a strange way of getting the wifi packets over a UDP socket, but after many attempts with calling a python function from inside a C callback, and several days reading frustrating posts on this forum, I found this way works.
Long story short, code like this:
Code: Select all
STATIC void esp_sniffer_cb(void *recv_buf, wifi_promiscuous_pkt_type_t type){
mp_obj_t step_function = mp_load_global(qstr_from_str("testme"));
mp_call_function_1(step_function, mp_obj_new_int(12345));
....
I hope you enjoy it and use it responsibly.
Cheers!