Voilà, c'est bien nettoyé et le reverse telnet fonctionne bien
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 zf200219.1616 \n")
|
print("\n 0_tst3_socat.lua zf200219.1621 \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
|
||||||
@@ -103,23 +103,16 @@ 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")
|
print("Telnet server running...\nUsage: telnet -rN ip\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function rt_connect()
|
function rt_connect()
|
||||||
print("on connecte le bidule...")
|
|
||||||
srv_rt = net.createConnection(net.TCP, 0)
|
srv_rt = net.createConnection(net.TCP, 0)
|
||||||
srv_rt:on("connection", function(sck)
|
srv_rt:on("connection", function(sck)
|
||||||
if verbose then print("connected zzz on "..console_host..":"..console_port+yellow_tag) end
|
if verbose then print("connected on "..console_host..":"..console_port+yellow_tag) end
|
||||||
telnet_listener(sck)
|
telnet_listener(sck)
|
||||||
print("Welcome to NodeMCU world.")
|
print("Welcome to NodeMCU world.")
|
||||||
end)
|
end)
|
||||||
srv_rt:connect(console_port+yellow_tag,console_host)
|
srv_rt:connect(console_port+yellow_tag,console_host)
|
||||||
--srv_rt:connect(23047,console_host)
|
|
||||||
end
|
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
|
||||||
@@ -134,8 +127,6 @@ tmr_socat1:alarm(3*1000, tmr.ALARM_AUTO , function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rt_connect()
|
rt_connect()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
27
rtelnet.sh
Executable file
27
rtelnet.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# petit script provisoire pour se connecter sur les NodeMCU en reverse telnet
|
||||||
|
# zf200219.1710
|
||||||
|
|
||||||
|
|
||||||
|
#test si l'argument est vide
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo -e "\nUsage:
|
||||||
|
|
||||||
|
./rtelnet.sh socket
|
||||||
|
./rtelnet.sh 23047
|
||||||
|
|
||||||
|
"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# on établit le serveur reverse telnet
|
||||||
|
ssh ubuntu@www.zuzutest.ml socat TCP-LISTEN:$1,reuseaddr,fork TCP-LISTEN:24047,reuseaddr,bind=127.0.0.1 &
|
||||||
|
|
||||||
|
read -p "On attend un certain temps que le NodeMCU se connecte ;-)"
|
||||||
|
|
||||||
|
# on se connecte en telnet sur le NodeMCU
|
||||||
|
ssh ubuntu@www.zuzutest.ml telnet -r localhost 24047
|
||||||
|
|
||||||
|
# on tue le serveur reverse telnet
|
||||||
|
ssh ubuntu@www.zuzutest.ml killall -9 socat
|
||||||
Reference in New Issue
Block a user