From a8f2632eeabd69062f16b61ae273eb81f399411f Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sat, 9 Nov 2019 18:22:32 +0100 Subject: [PATCH] =?UTF-8?q?Commenc=C3=A9=20=C3=A0=20calculer=20le=20hash?= =?UTF-8?q?=20d'un=20fichier=20dans=20la=20fonction=20dir(),=20ne=20foncti?= =?UTF-8?q?onne=20pas=20encore=20:-(?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WIFI_sniffer/cret_project/_zremote_cmd.txt | 3 ++- WIFI_sniffer/cret_project/dir.lua | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/WIFI_sniffer/cret_project/_zremote_cmd.txt b/WIFI_sniffer/cret_project/_zremote_cmd.txt index b89f8ec..370a91c 100644 --- a/WIFI_sniffer/cret_project/_zremote_cmd.txt +++ b/WIFI_sniffer/cret_project/_zremote_cmd.txt @@ -134,6 +134,7 @@ telnet -rN $zIP $zport =node.heap() - +status, err = pcall(function () fonction_a_tester() end) if status==false then print("Error: ",err) end +status, err = pcall(function () toto() end) if status==false then print("Error: ",err) end . diff --git a/WIFI_sniffer/cret_project/dir.lua b/WIFI_sniffer/cret_project/dir.lua index 8bf9414..1cd94bd 100644 --- a/WIFI_sniffer/cret_project/dir.lua +++ b/WIFI_sniffer/cret_project/dir.lua @@ -1,15 +1,28 @@ -- fonction dir() pour afficher les fichiers dans la flash -print("\n dir.lua zf180826.1019 \n") +print("\n dir.lua zf191109.1719 \n") + +hash=nil +function zhash(zstring) + local zhash_v = 0 + for i = 1, string.len(zstring) do + zhash_v = zhash_v + string.byte(zstring, i) * i + end + return zhash_v +end +status, err = pcall(function () print(zhash("il était une fois trois petits cochons roses...")) end) if status==false then print("Error: ",err) end + + function dir() print("\n-------------------------------") l=file.list() i=0 for k,v in pairs(l) do i=i+v - print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + print(k..string.rep(" ",24-string.len(k)).." : "..v.." bytes") end print("-------------------------------") print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') end +status, err = pcall(function () dir() end) if status==false then print("Error: ",err) end dir()