Refactorisé un peu le script reverse telnet
This commit is contained in:
@@ -10,7 +10,7 @@ socat TCP-LISTEN:23047,reuseaddr,fork TCP-LISTEN:24047,reuseaddr,bind=127.0.0.1
|
|||||||
telnet -r localhost 24047
|
telnet -r localhost 24047
|
||||||
]]
|
]]
|
||||||
|
|
||||||
print("\n 0_tst3_socat.lua zf200216.1653 \n")
|
print("\n 0_tst3_socat.lua zf200217.0423 \n")
|
||||||
|
|
||||||
local node, table, tmr, wifi, uwrite, tostring =
|
local node, table, tmr, wifi, uwrite, tostring =
|
||||||
node, table, tmr, wifi, uart.write, tostring
|
node, table, tmr, wifi, uart.write, tostring
|
||||||
@@ -100,22 +100,21 @@ local function telnet_listener(socket)
|
|||||||
node.output(queueLine, 0)
|
node.output(queueLine, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--net.createServer(net.TCP, 180):listen(23, telnet_listener)
|
--net.createServer(net.TCP, 180):listen(23, telnet_listener)
|
||||||
--print("Telnet server running...\nUsage: telnet -rN ip\n")
|
|
||||||
|
|
||||||
|
|
||||||
srv_rt = net.createConnection(net.TCP, 0)
|
|
||||||
srv_rt:on("connection", function(sck)
|
|
||||||
print("connected...")
|
|
||||||
telnet_listener(sck)
|
|
||||||
end)
|
|
||||||
srv_rt:connect(console_port,console_host)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("Telnet server running...\nUsage: telnet -rN ip\n")
|
print("Telnet server running...\nUsage: telnet -rN ip\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function rt_connect()
|
||||||
|
srv_rt = net.createConnection(net.TCP, 0)
|
||||||
|
srv_rt:on("connection", function(sck)
|
||||||
|
if verbose then print("connected on "..console_host..":"..console_port) end
|
||||||
|
telnet_listener(sck)
|
||||||
|
print("Welcome to NodeMCU world.")
|
||||||
|
end)
|
||||||
|
srv_rt:connect(console_port,console_host)
|
||||||
|
end
|
||||||
|
|
||||||
tmr_socat1=tmr.create()
|
tmr_socat1=tmr.create()
|
||||||
tmr_socat1:alarm(3*1000, tmr.ALARM_AUTO , function()
|
tmr_socat1:alarm(3*1000, tmr.ALARM_AUTO , function()
|
||||||
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
|
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
|
||||||
@@ -124,18 +123,13 @@ tmr_socat1:alarm(3*1000, tmr.ALARM_AUTO , function()
|
|||||||
else
|
else
|
||||||
if verbose then
|
if verbose then
|
||||||
gpio.write(zLED, gpio.HIGH)
|
gpio.write(zLED, gpio.HIGH)
|
||||||
print("trying connect "..console_host..":"..console_port)
|
print("trying connect to "..console_host..":"..console_port)
|
||||||
end
|
end
|
||||||
srv_rt = net.createConnection(net.TCP, 0)
|
rt_connect()
|
||||||
srv_rt:on("connection", function(sck)
|
|
||||||
if verbose then print("connected on "..console_host..":"..console_port) end
|
|
||||||
telnet_listener(sck)
|
|
||||||
end)
|
|
||||||
srv_rt:connect(console_port,console_host)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
rt_connect()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom
|
# Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom
|
||||||
# zf200216.1702
|
# zf200217.0429
|
||||||
|
|
||||||
|
|
||||||
Todo à faire pour ce projet !
|
Todo à faire pour ce projet !
|
||||||
|
|
||||||
|
- ajouter la variable yellow_tag avec le numéro de l'étiquette jaune du NodeMCU
|
||||||
- regarder pour mettre "Welcome to NodeMCU world." quand connected, en fait quand on arrive dans le telnet_listener après la redirection du port série !
|
- regarder pour mettre "Welcome to NodeMCU world." quand connected, en fait quand on arrive dans le telnet_listener après la redirection du port série !
|
||||||
- ajouter l'adresse du zdyndns dans les secrets projets
|
- ajouter l'adresse du zdyndns dans les secrets projets
|
||||||
- se connecter sur le zdyndns avec le numéro du port du telnet reverse utilisé
|
- se connecter sur le zdyndns avec le numéro du port du telnet reverse utilisé
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- Scripts à charger après le boot pour démarrer son projet
|
-- Scripts à charger après le boot pour démarrer son projet
|
||||||
|
|
||||||
print("\n boot.lua zf200216.1757 \n")
|
print("\n boot.lua zf200217.0423 \n")
|
||||||
|
|
||||||
function boot()
|
function boot()
|
||||||
verbose = true
|
verbose = true
|
||||||
@@ -13,7 +13,7 @@ function boot()
|
|||||||
--f="0_cron.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="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
|
||||||
--f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
||||||
|
|
||||||
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
|
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
|
||||||
print("verbose:",verbose)
|
print("verbose:",verbose)
|
||||||
|
|||||||
Reference in New Issue
Block a user