Commencé mes tests de telnet reverse, cela commence à super bien avancer

This commit is contained in:
Christian Zufferey
2020-02-03 18:44:44 +01:00
parent b13a10c5ce
commit fd43d0c64f
5 changed files with 91 additions and 9 deletions

View File

@@ -1,13 +1,13 @@
-- programme pour faire clignoter une LED version simplifiée
print("\n blink_led2.lua zf181015.1138 \n")
print("\n blink_led2.lua zf200203.1823 \n")
zLED=0
gpio.mode(zLED, gpio.OUTPUT)
ztmr_LED = tmr.create()
value = true
tmr.alarm(ztmr_LED, 100, tmr.ALARM_AUTO, function ()
ztmr_LED:alarm(100, tmr.ALARM_AUTO, function ()
if value then
gpio.write(zLED, gpio.HIGH)
else

View File

@@ -0,0 +1,23 @@
-- a simple telnet server
print("\n 0_tst_socat.lua zf200203.1701 \n")
s=net.createServer(net.TCP,180)
s:listen(2323,function(c)
function s_output(str)
if(c~=nil)
then c:send(str)
end
end
node.output(s_output, 0)
-- re-direct output to function s_ouput.
c:on("receive",function(c,l)
node.input(l)
--like pcall(loadstring(l)), support multiple separate lines
end)
c:on("disconnection",function(c)
node.output(nil)
--unregist redirect output function, output goes to serial
end)
print("Welcome to NodeMcu world.")
end)

View File

@@ -0,0 +1,59 @@
-- tests connection reverse telnet
-- commande à faire tourner sur le serveur
-- socat TCP-LISTEN:4444,fork,reuseaddr STDIO
print("\n 0_tst2_socat.lua zf200203.1734 \n")
srv = net.createConnection(net.TCP, 0)
srv:connect(4444,"192.168.0.184")
srv:on("connection", function(sck)
function s_output(str)
if(sck~=nil)
then sck:send(str)
end
end
node.output(s_output, 0)
-- re-direct output to function s_ouput.
sck:on("receive",function(c,l)
node.input(l)
--like pcall(loadstring(l)), support multiple separate lines
end)
sck:on("disconnection",function(c)
node.output(nil)
--unregist redirect output function, output goes to serial
end)
print("Welcome to NodeMcu world.")
end)
--[[
s=net.createServer(net.TCP,180)
s:listen(2323,function(c)
function s_output(str)
if(c~=nil)
then c:send(str)
end
end
node.output(s_output, 0)
-- re-direct output to function s_ouput.
c:on("receive",function(c,l)
node.input(l)
--like pcall(loadstring(l)), support multiple separate lines
end)
c:on("disconnection",function(c)
node.output(nil)
--unregist redirect output function, output goes to serial
end)
print("Welcome to NodeMcu world.")
end)
]]

View File

@@ -1,16 +1,16 @@
-- Scripts à charger après le boot pour démarrer son projet
print("\n boot.lua zf20019.1438 \n")
print("\n boot.lua zf200203.1423 \n")
function boot()
verbose = true
print("booooooooooot...")
print(node.heap()) collectgarbage() print(node.heap())
f="0_htu21d.lua" if file.exists(f) then dofile(f) end
zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1)
f="0_send_data.lua" if file.exists(f) then dofile(f) end
f="0_cron.lua" if file.exists(f) then dofile(f) end
--f="0_htu21d.lua" if file.exists(f) then dofile(f) end
--zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1)
--f="0_send_data.lua" if file.exists(f) then dofile(f) end
--f="0_cron.lua" if file.exists(f) then dofile(f) end
f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end

View File

@@ -1,7 +1,7 @@
-- Petit script pour initaliser la couche WIFI
function wifi_init()
print("\n wifi_init.lua zf200111.1219 \n")
print("\n wifi_init.lua zf200203.1414 \n")
function wifi_init_end()
wifi_init1:unregister() i=nil
@@ -9,7 +9,7 @@ function wifi_init()
f=nil secrets_wifi=nil cli_pwd=nil cli_ssid=nil
wifi_init1=nil wifi_init=nil
print(node.heap()) collectgarbage() print(node.heap())
f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end
-- f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end
f= "web_srv2.lua" if file.exists(f) then dofile(f) end
print(node.heap()) collectgarbage() print(node.heap())
zdelay=1 if reset_reason=="seconde_chance" then zdelay=20 end