diff --git a/WIFI_sniffer/cret_project/boot.lua b/WIFI_sniffer/cret_project/boot.lua index 3ded0b5..109c0a4 100644 --- a/WIFI_sniffer/cret_project/boot.lua +++ b/WIFI_sniffer/cret_project/boot.lua @@ -1,13 +1,13 @@ -- Scripts à charger après le boot pour démarrer le core system -print("\n boot.lua zf191030.2012 \n") +print("\n boot.lua zf191124.1920 \n") function boot() --f= "led_rgb.lua" if file.exists(f) then dofile(f) end f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end f= "wifi_init.lua" if file.exists(f) then dofile(f) end --f= "web_ide2.lua" if file.exists(f) then dofile(f) end - --ff= "web_srv2.lua" if file.exists(f) then dofile(f) end + --f= "web_srv2.lua" if file.exists(f) then dofile(f) end end boot() diff --git a/WIFI_sniffer/cret_project/boot2.lua b/WIFI_sniffer/cret_project/boot2.lua index 2ccc65b..4a581b3 100644 --- a/WIFI_sniffer/cret_project/boot2.lua +++ b/WIFI_sniffer/cret_project/boot2.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son projet -print("\n boot2.lua zf191030.2038 \n") +print("\n boot2.lua zf191124.1922 \n") function boot2() second_chance=nil initz=nil boot=nil @@ -27,7 +27,8 @@ function boot2() f= "secrets_project.lua" if file.exists(f) then dofile(f) end f= "set_time.lua" if file.exists(f) then dofile(f) end collectgarbage() - f= "b.lua" if file.exists(f) then dofile(f) end + --- f= "b.lua" if file.exists(f) then dofile(f) end + f= "web_srv2.lua" if file.exists(f) then dofile(f) end f=nil diff --git a/WIFI_sniffer/cret_project/cat.lua b/WIFI_sniffer/cret_project/cat.lua index 856a52d..8a2e29c 100644 --- a/WIFI_sniffer/cret_project/cat.lua +++ b/WIFI_sniffer/cret_project/cat.lua @@ -1,18 +1,22 @@ -- fonction cat() pour afficher le contenu d'un fichier dans la flash -print("\n cat.lua zf192026.0858 \n") +print("\n cat.lua zf191124.2204 \n") + +function zread_line() + local zline = "" + while true do + local t = zf:read(1) if t == nil then return end + zline = zline..t + if t == "\n" then return string.sub(zline,1,string.len(zline)-1) end + end +end function cat(zfile) print("\n"..zfile.."\n-------------------------------") - - zfilei = file.open(zfile, "r") - i=1 - zline=file.readline() - repeat --- print(i..": "..string.sub(zline,1,string.len(zline)-1)) - print(string.sub(zline,1,string.len(zline)-1)) - i=i+1 zline=file.readline() - until zline== nil - file.close(zfilei) - + zf = file.open(zfile, "r") + while true do + zline = zread_line() if zline == nil then break end + print(zline) + end + zf:close() print("-------------------------------") end diff --git a/WIFI_sniffer/cret_project/web_srv2.lua b/WIFI_sniffer/cret_project/web_srv2.lua index 2389b01..2384e89 100644 --- a/WIFI_sniffer/cret_project/web_srv2.lua +++ b/WIFI_sniffer/cret_project/web_srv2.lua @@ -15,7 +15,7 @@ function send_file(zclient, zfilename) zclient:send("HTTP/1.1 200 OK\n") zclient:send("Content-Type: text/html\n\n") zzclient = zclient -- export le port sur l'environnement global ! - if zfilename == "" then zfilename = "z_index.html" end + if zfilename == "" then zfilename = "z_index.html" end file_web = file.open(zfilename, "r") if file_web then repeat @@ -34,10 +34,11 @@ function send_file(zclient, zfilename) -- print(line) lua_code = lua_code..line -- récupère le code lua inline else + print(line) zclient:send(line) -- envoie le code HTML end end - until not line + until not line file_web:close() file_web = nil else zclient:send("