diff --git a/PCM/Play_file/ccc_16k.wav b/PCM/Play_file/ccc_16k.wav new file mode 100644 index 0000000..a1a28e0 Binary files /dev/null and b/PCM/Play_file/ccc_16k.wav differ diff --git a/PCM/Play_file/play_file.lua b/PCM/Play_file/play_file.lua index 79a0f8c..c04e3d9 100644 --- a/PCM/Play_file/play_file.lua +++ b/PCM/Play_file/play_file.lua @@ -1,6 +1,6 @@ -- Scripts pour jouer un fichier son sur un HP -print("\n play_file.lua zf190130.2335 \n") +print("\n play_file.lua zf190131.1023 \n") -- **************************************************************************** @@ -28,7 +28,7 @@ function cb_paused(d) print("playback paused") end -file.open("toto.wav", "r") +file.open("ccc_16k.wav", "r") drv = pcm.new(pcm.SD, 5) diff --git a/WIFI_sniffer/b.lua b/WIFI_sniffer/b.lua index 801a343..05928aa 100644 --- a/WIFI_sniffer/b.lua +++ b/WIFI_sniffer/b.lua @@ -1,7 +1,7 @@ -- Scripts pour tester le sniffer de smartphone qui essaient de se connecter sur des AP WIFI -- source: https://nodemcu.readthedocs.io/en/dev/modules/wifi/#wifieventmonregister -print("\n b.lua zf190119.1920 \n") +print("\n b.lua zf190202.1534 \n") --f= "set_time.lua" if file.exists(f) then dofile(f) end @@ -12,10 +12,20 @@ zmac_adrs["b8:d7:af:a6:bd:86"]={["zname"]="S7 zf"} zmac_adrs["cc:c0:79:7d:f5:d5"]={["zname"]="S7 Mélanie"} zmac_adrs["5c:f9:38:a1:f7:f0"]={["zname"]="MAC zf"} zmac_adrs["d8:30:62:5a:d6:3a"]={["zname"]="IMAC Maman"} +zmac_adrs["88:e9:fe:6b:ec:1e"]={["zname"]="MAC Luc"} +zmac_adrs["0c:2c:54:b3:c5:1a"]={["zname"]="HU Nicolas"} +zmac_adrs["c0:a6:00:bf:4e:43"]={["zname"]="IPHONE Maeva"} + + + + + function zshow() + i=1 for k, v in pairs(zmac_adrs) do - print(k,zmac_adrs[k]["zname"],zmac_adrs[k]["zrssi"],zmac_adrs[k]["ztime"]) + print(i..", ", k..", ", zmac_adrs[k]["zname"], zmac_adrs[k]["zrssi"], zmac_adrs[k]["ztime"]) + i=i+1 end end --[[ @@ -28,26 +38,30 @@ function zround(num, dec) end function zsniff(T) - print("\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI) - ztime() - if zmac_adrs[T.MAC] == nil then - print("Oh une inconnue !") - zmac_adrs[T.MAC]={} - end - zmac_adrs[T.MAC]["ztime"]=string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]) - if zmac_adrs[T.MAC]["zrssi"] == nil then - zmac_adrs[T.MAC]["zrssi"]=T.RSSI - else - zmac_adrs[T.MAC]["zrssi"]=zround((4*zmac_adrs[T.MAC]["zrssi"]+T.RSSI)/5, 0) - end - if zmac_adrs[T.MAC]["zname"] ~= nil then - print("Bonjour "..zmac_adrs[T.MAC]["zname"].." !") + + if T.RSSI > -60 then +-- print("\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI) +-- ztime() + if zmac_adrs[T.MAC] == nil then + print("Oh une inconnue !") + zmac_adrs[T.MAC]={} + end + -- zmac_adrs[T.MAC]["ztime"]=string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]) + if zmac_adrs[T.MAC]["zrssi"] == nil then + zmac_adrs[T.MAC]["zrssi"]=T.RSSI + else + zmac_adrs[T.MAC]["zrssi"]=zround((4*zmac_adrs[T.MAC]["zrssi"]+T.RSSI)/5, 0) + end + if zmac_adrs[T.MAC]["zname"] ~= nil then + print("Bonjour "..zmac_adrs[T.MAC]["zname"].." !") + end end end wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff) --[[ wifi.eventmon.unregister(wifi.eventmon.AP_PROBEREQRECVED) +zshow() ]] diff --git a/WIFI_sniffer/boot.lua b/WIFI_sniffer/boot.lua index a83edb8..5dcdab3 100644 --- a/WIFI_sniffer/boot.lua +++ b/WIFI_sniffer/boot.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son appli -print("\n boot.lua zf190119.1933 \n") +print("\n boot.lua zf190202.1527 \n") function heartbeat() f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end @@ -14,16 +14,16 @@ end f= "wifi_ap_start.lua" if file.exists(f) then dofile(f) end f= "wifi_cli_conf.lua" if file.exists(f) then dofile(f) end f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end -f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end -f= "web_ide2.lua" if file.exists(f) then dofile(f) end -f= "web_srv.lua" if file.exists(f) then dofile(f) end +--f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end +--f= "web_ide2.lua" if file.exists(f) then dofile(f) end +--f= "web_srv.lua" if file.exists(f) then dofile(f) end f= "set_time.lua" if file.exists(f) then dofile(f) end --f= "dsleep.lua" if file.exists(f) then dofile(f) end f= "b.lua" if file.exists(f) then dofile(f) end -heartbeat() +--heartbeat() diff --git a/WIFI_sniffer/tst_sniffer_wifi1.csv b/WIFI_sniffer/tst_sniffer_wifi1.csv new file mode 100644 index 0000000..5102bf3 --- /dev/null +++ b/WIFI_sniffer/tst_sniffer_wifi1.csv @@ -0,0 +1,74 @@ +1, da:a1:19:9b:4a:ba,0,-59,0 +2, 9a:2e:66:00:03:c2,0,-58,0 +3, 02:50:09:00:02:1e,0,-50,0 +4, 9a:e6:33:b4:e9:a3,0,-58,0 +5, 02:be:a3:2d:79:40,0,-40,0 +6, da:a1:19:b6:6b:50,0,-18,0 +7, f6:58:e4:25:70:b8,0,-57,0 +8, 16:92:17:8f:1b:8c,0,-58,0 +9, 9a:b8:4c:16:fe:f2,0,-59,0 +10, 80:58:f8:17:dc:d8,0,-48,0 +11, c0:a6:00:bf:4e:43,0,-55,0 +12, 80:58:f8:69:65:61,0,-42,0 +13, 56:c8:77:a2:ac:9a,0,-57,0 +14, 80:58:f8:49:1b:9d,0,-35,0 +15, 26:b4:90:7b:35:4c,0,-57,0 +16, 02:ab:db:d0:ce:ae,0,-34,0 +17, da:a1:19:fa:ba:d3,0,-59,0 +18, da:a1:19:95:ad:85,0,-57,0 +19, 3a:42:0a:8d:2b:89,0,-58,0 +20, 02:a5:79:4e:6c:8a,0,-42,0 +21, da:a1:19:5a:8a:7a,0,-58,0 +22, da:a1:19:d2:cb:be,0,-59,0 +23, cc:c0:79:7d:f5:d5, S7 Mélanie,0,0 +24, da:a1:19:6a:ce:8f,0,-55,0 +25, 1a:8c:3b:82:77:be,0,-58,0 +26, da:a1:19:01:2e:80,0,-54,0 +27, b8:d7:af:a6:bd:86, S7 zf,0,0 +28, 96:a6:83:5c:39:15,0,-56,0 +29, da:a1:19:5f:b4:06,0,-52,0 +30, d8:30:62:5a:d6:3a, IMAC Maman,0,0 +31, 4a:0f:35:e2:24:22,0,-47,0 +32, be:d8:cc:17:36:2c,0,-41,0 +33, 02:2a:5c:ff:53:d3,0,-47,0 +34, da:a1:19:e1:e9:b7,0,-49,0 +35, da:a1:19:eb:5e:a2,0,-58,0 +38, da:a1:19:99:b6:98,0,-58,0 +36, 02:6a:8d:b8:14:e2,0,-37,0 +37, 80:58:f8:3d:5d:59,0,-37,0 +39, 02:00:6c:8a:09:a9,0,-35,0 +40, ba:4b:28:9c:18:b6,0,-59,0 +41, da:a1:19:41:cb:f0,0,-55,0 +42, d6:75:c7:4e:52:20,0,-56,0 +43, da:a1:19:fa:53:66,0,-32,0 +44, 92:76:98:d8:ab:ce,0,-56,0 +45, 02:6e:d1:5f:35:c6,0,-40,0 +46, da:a1:19:a7:be:86,0,-50,0 +47, 5c:f9:38:a1:f7:f0, MAC zf-28,0 +48, 80:58:f8:e6:e2:de,0,-47,0 +49, 0c:2c:54:b3:c5:1a,0,-34,0 +50, da:a1:19:e1:23:63,0,-57,0 +51, da:a1:19:ec:26:dd,0,-56,0 +52, 02:62:96:8b:80:4f,0,-29,0 +53, 02:de:2f:a2:95:98,0,-40,0 +54, 0e:c6:f3:36:ae:d9,0,-58,0 +55, da:a1:19:e8:48:bd,0,-49,0 +56, 02:be:a3:95:0e:8b,0,-30,0 +57, ca:8e:46:cc:78:bd,0,-58,0 +58, 80:58:f8:44:09:ce,0,-30,0 +59, 02:07:49:35:67:10,0,-58,0 +60, c0:ee:fb:4a:ff:28,0,-55,0 +61, da:a1:19:ed:93:84,0,-59,0 +62, 02:c5:a0:96:05:bd,0,-32,0 +63, da:a1:19:a6:a0:93,0,-56,0 +64, 46:79:22:70:f5:b8,0,-59,0 +65, 86:27:18:64:f8:c0,0,-57,0 +66, da:a1:19:89:2c:80,0,-59,0 +67, da:a1:19:01:85:98,0,-47,0 +68, 80:58:f8:1c:18:4b,0,-39,0 +69, da:a1:19:30:32:b9,0,-55,0 +70, 02:ec:f1:a1:c8:29,0,-49,0 +71, 02:e6:ac:b3:6e:40,0,-43,0 +72, da:a1:19:70:fc:f2,0,-28,0 +73, 88:e9:fe:6b:ec:1e, MAC Luc,0,0 + diff --git a/WIFI_sniffer/tst_sort.lua b/WIFI_sniffer/tst_sort.lua new file mode 100644 index 0000000..b469fce --- /dev/null +++ b/WIFI_sniffer/tst_sort.lua @@ -0,0 +1,88 @@ +-- Scripts pour tester le tri (sort) d'un tableau d'adresse MAC en fonction du signal de réception +-- pour les tests on charge un fichier CSV de d'adresse MAC sniffées précédemment +-- source: https://wxlua.developpez.com/tutoriels/lua/general/cours-complet/#L6-f +-- source: https://wxlua.developpez.com/tutoriels/lua/general/cours-complet/#L13-g + +print("\n tst_sort.lua zf190202.1400 \n") + + + +-- send a file from memory to the client; max. line length = 1024 bytes! +function send_file(client, filename) + if file.open(filename, "r") then + repeat + local line=file.read('\n') + if line then + client:send(line) + end + until not line + file.close() + end +end + + + + + +--f= "set_time.lua" if file.exists(f) then dofile(f) end + +-- apzuzu6 38:2c:4a:4e:d3:d8 + +zmac_adrs={} +zmac_adrs["b8:d7:af:a6:bd:86"]={["zname"]="S7 zf"} +zmac_adrs["cc:c0:79:7d:f5:d5"]={["zname"]="S7 Mélanie"} +zmac_adrs["5c:f9:38:a1:f7:f0"]={["zname"]="MAC zf"} +zmac_adrs["d8:30:62:5a:d6:3a"]={["zname"]="IMAC Maman"} +zmac_adrs["88:e9:fe:6b:ec:1e"]={["zname"]="MAC Luc"} +zmac_adrs["0c:2c:54:b3:c5:1a"]={["zname"]="HU Nicolas"} +zmac_adrs["c0:a6:00:bf:4e:43"]={["zname"]="IPHONE Maeva"} + + + + + + +function zshow() + i=1 + for k, v in pairs(zmac_adrs) do + print(i..", ", k..", ", zmac_adrs[k]["zname"], zmac_adrs[k]["zrssi"], zmac_adrs[k]["ztime"]) + i=i+1 + end +end +--[[ +zshow() +]] + +function zround(num, dec) + local mult = 10^(dec or 0) + return math.floor(num * mult + 0.5) / mult +end + +function zsniff(T) + + if T.RSSI > -60 then +-- print("\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI) +-- ztime() + if zmac_adrs[T.MAC] == nil then + print("Oh une inconnue !") + zmac_adrs[T.MAC]={} + end + -- zmac_adrs[T.MAC]["ztime"]=string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]) + if zmac_adrs[T.MAC]["zrssi"] == nil then + zmac_adrs[T.MAC]["zrssi"]=T.RSSI + else + zmac_adrs[T.MAC]["zrssi"]=zround((4*zmac_adrs[T.MAC]["zrssi"]+T.RSSI)/5, 0) + end + if zmac_adrs[T.MAC]["zname"] ~= nil then + print("Bonjour "..zmac_adrs[T.MAC]["zname"].." !") + end + end +end + +wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff) +--[[ +wifi.eventmon.unregister(wifi.eventmon.AP_PROBEREQRECVED) +zshow() +]] + +