From ef2662c5455ec981c44d15b42770a7f26b6a8a52 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sat, 19 Jan 2019 17:13:17 +0100 Subject: [PATCH] =?UTF-8?q?Commenc=C3=A9=20=C3=A0=20travailler=20sur=20mon?= =?UTF-8?q?=20sniffer=20wifi=20qui=20=C3=A9coute=20les=20probes=20request?= =?UTF-8?q?=20des=20devices=20autour=20de=20lui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeepSleep/ESP-M3/b.lua | 55 +++++++++++++++++++++++++++++++++++++++ Tests/a_test_tableaux.lua | 45 ++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 DeepSleep/ESP-M3/b.lua create mode 100644 Tests/a_test_tableaux.lua diff --git a/DeepSleep/ESP-M3/b.lua b/DeepSleep/ESP-M3/b.lua new file mode 100644 index 0000000..1531627 --- /dev/null +++ b/DeepSleep/ESP-M3/b.lua @@ -0,0 +1,55 @@ +-- 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.1710 \n") + +--f= "wifi_ap_stop.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_srv.lua" if file.exists(f) then dofile(f) end +--f= "web_ide2.lua" if file.exists(f) then dofile(f) end +--f= "dsleep.lua" if file.exists(f) then dofile(f) end + +-- apzuzu6 38:2c:4a:4e:d3:d8 +-- S7 b8:d7:af:a6:bd:86 +-- maczf 11 5c:f9:38:a1:f7:f0 + +zmac_adrs={} +zmac_adrs["b8:d7:af:a6:bd:86"]={["zname"]="S7"} +zmac_adrs["5c:f9:38:a1:f7:f0"]={["zname"]="maczf"} + +function zdisp_table() + for k, v in pairs(zmac_adrs) do + print(k,zmac_adrs[k]["zname"],zmac_adrs[k]["zrssi"]) + end +end + +--[[ +zdisp_table() +]] + +function zsniff(T) +-- print("\n\tAP - PROBE REQUEST RECEIVED".."\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI) + print("\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI) + + if zmac_adrs[T.MAC] == nil then + print("Oh une inconnue !") + zmac_adrs[T.MAC]={} + end + if zmac_adrs[T.MAC]["zrssi"] == nil then + zmac_adrs[T.MAC]["zrssi"]=T.RSSI + else + zmac_adrs[T.MAC]["zrssi"]=(4*zmac_adrs[T.MAC]["zrssi"]+T.RSSI)/5 + end + if zmac_adrs[T.MAC]["zname"] ~= nil then + print("Bonjour "..zmac_adrs[T.MAC]["zname"].." !") + end + +end + +--[[ +wifi.eventmon.unregister(wifi.eventmon.AP_PROBEREQRECVED) +]] +wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff) + + diff --git a/Tests/a_test_tableaux.lua b/Tests/a_test_tableaux.lua new file mode 100644 index 0000000..fb43c15 --- /dev/null +++ b/Tests/a_test_tableaux.lua @@ -0,0 +1,45 @@ +-- Tests de tableaux +-- source: + +print("\n a_test_tableaux.lua zf190119.1538 \n") + + +ztableau={} +ztableau["toto"]=12 +print(ztableau["toto"]) +print(ztableau.toto) + +zmac_adrs={} +zmac_adrs["38:2c:4a:4e:d3:d8"]={} +zmac_adrs["38:2c:4a:4e:d3:d8"]["zname"]="apzuzu6" +zmac_adrs["38:2c:4a:4e:d3:d8"]["ztime_first"]=12 +zmac_adrs["38:2c:4a:4e:d3:d8"]["ztime_last"]=34 + +zt="38:2c:4a:4e:d3:d8" +print("MAC: "..zt..", "..zmac_adrs[zt]["zname"]) +print("Time_first: "..zmac_adrs[zt]["ztime_first"]) +print("Time_last: "..zmac_adrs[zt]["ztime_last"]) + + + + + + + + +--[[ +function toto() + print("toto") +end + +function tutu(f) + f() +end + +print("fonction dans une fonction") +tutu(toto) + +print("fonction dans une variable") +titi=toto +titi() +]]