diff --git a/WIFI_sniffer/b.lua b/WIFI_sniffer/b.lua index 0235126..a5cfc99 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 zf190210.1804 \n") +print("\n b.lua zf190215.1856 \n") --f= "set_time.lua" if file.exists(f) then dofile(f) end @@ -60,7 +60,7 @@ end function zsort_rssi() print("tri du tableau") table.sort(zmac_adrs, function(a,b) - return a:match("[^,]+,[^,]+,([^,]+),[^,]+,[^,]+") > b:match("[^,]+,[^,]+,([^,]+),[^,]+,[^,]+") + return a:match("[^,]+,[^,]+,([^,]+),[^,]+,[^,]+") < b:match("[^,]+,[^,]+,([^,]+),[^,]+,[^,]+") end) end @@ -149,9 +149,9 @@ d = 10 ^ ((TxPower - RSSI) / (10 * n)) -wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff) --[[ +wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff) wifi.eventmon.unregister(wifi.eventmon.AP_PROBEREQRECVED) zshow() zsort_rssi() diff --git a/WIFI_sniffer/boot.lua b/WIFI_sniffer/boot.lua index 6dd091a..30096c2 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 zf190215.1814 \n") +print("\n boot.lua zf190215.1844 \n") function heartbeat() f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end @@ -19,7 +19,7 @@ f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end f= "web_srv2.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 +f= "b.lua" if file.exists(f) then dofile(f) end diff --git a/WIFI_sniffer/restart.lua b/WIFI_sniffer/goodies/restart.lua similarity index 100% rename from WIFI_sniffer/restart.lua rename to WIFI_sniffer/goodies/restart.lua diff --git a/WIFI_sniffer/initz.lua b/WIFI_sniffer/initz.lua index 356caa1..49a45bb 100644 --- a/WIFI_sniffer/initz.lua +++ b/WIFI_sniffer/initz.lua @@ -3,13 +3,24 @@ -- le script repair.lua pendant xx secondes avant de continuer --Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason -print("\n init.lua zf181210.2358 \n") +print("\n init.lua zf190217.1231 \n") + +zswitch=3 --switch flash +gpio.mode(zswitch, gpio.INT, gpio.PULLUP) + +function hvbouton() +-- gpio.trig(zswitch, "none") + tmr.unregister(initalarme) + f= "boot.lua" if file.exists(f) then dofile(f) end +end + +gpio.trig(zswitch, "both", hvbouton) function second_chance() print("seconde chance...") f= "repair.lua" if file.exists(f) then dofile(f) end initalarme=tmr.create() - tmr.alarm(initalarme, 8*1000, tmr.ALARM_SINGLE, function() + tmr.alarm(initalarme, 4*1000, tmr.ALARM_SINGLE, function() f= "boot.lua" if file.exists(f) then dofile(f) end end) end @@ -27,7 +38,8 @@ elseif reset_reason == 5 then f= "boot.lua" if file.exists(f) then dofile(f) end elseif reset_reason == 6 then print("external reset") - f= "boot.lua" if file.exists(f) then dofile(f) end + second_chance() +-- f= "boot.lua" if file.exists(f) then dofile(f) end else print("autre raison") second_chance() diff --git a/WIFI_sniffer/a_tst_sort.lua b/WIFI_sniffer/oldies/a_tst_sort.lua similarity index 100% rename from WIFI_sniffer/a_tst_sort.lua rename to WIFI_sniffer/oldies/a_tst_sort.lua diff --git a/WIFI_sniffer/tst_sniffer_wifi1.csv b/WIFI_sniffer/oldies/tst_sniffer_wifi1.csv similarity index 100% rename from WIFI_sniffer/tst_sniffer_wifi1.csv rename to WIFI_sniffer/oldies/tst_sniffer_wifi1.csv diff --git a/WIFI_sniffer/page3.html b/WIFI_sniffer/page3.html index 91acfd7..ae96cf4 100644 --- a/WIFI_sniffer/page3.html +++ b/WIFI_sniffer/page3.html @@ -3,11 +3,11 @@
-| MAC | Name | RSSI | Time | +Index | MAC | Name | RSSI | Time0 | Time1 | Distance |
|---|---|---|---|---|---|---|---|---|---|---|
| " .. k .. " | \n") - zout("\t" .. tostring(zmac_adrs[k]["zname"]) .. " | \n") - zout("\t" .. tostring(zmac_adrs[k]["zrssi"]) .. " | \n") - zout("\t" .. tostring(zmac_adrs[k]["ztime"]) .. " | \n") - zout("" .. tostring(i) .. " | \n") + zout("\t" .. zadrs .. " | \n") + zout("\t" .. tostring(zname) .. " | \n") + zout("\t" .. tostring(zrssi) .. " | \n") + zout("\t" .. tostring(ztime0) .. " | \n") + zout("\t" .. tostring(ztime1) .. " | \n") + zout("\t" .. tostring(zround(zcalc_distance(zrssi),1)) .. "m" .. " | \n") + zout("\n") + end end %> -