View Single Post
Old 05-23-2024, 09:10 PM   #1326
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,583
Karma: 79436940
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Quote:
Originally Posted by shyhermit View Post
Thanks, both DNSB and Aleron Ives. Not knowing how to code at all, I would not even know how to mod the above code to make a toggle for FTP.

I guess the simplest and safest way is to just use the NickelMenu "switch" to reboot the device each time I finished using FTP (which I intend to use only infrequently).

Per DNSB, as Telnet and FTP effects do not persist after reboot, the device remains secure after reboot even if I need to use WiFi when I am outside, correct?
FYI:

I've cone up with a modified FTP and Telnet definition for NickelMenu that is a true toggle of either one; ie if not running it will enable it; if running it will disable it.

Code:
menu_item :main :IP Address :cmd_output :500:/sbin/ifconfig | /usr/bin/awk '/inet addr/{print substr($2,6)}'

menu_item :main :Telnet (status) :cmd_output :500:quiet: /usr/bin/pgrep -f "^/usr/bin/tcpsvd -E 0.0.0.0 2023"  
  chain_success :dbg_toast  :Telnet active on port 2023
  chain_failure :dbg_toast  :Telnet inactive on port 2023

menu_item :main :Telnet (toggle) :cmd_output :500:quiet: /usr/bin/pgrep -f "^/usr/bin/tcpsvd -E 0.0.0.0 2023"
  chain_success:skip:5
    chain_failure :cmd_spawn :quiet :/bin/mount -t devpts | /bin/grep -q /dev/pts || { /bin/mkdir -p /dev/pts && /bin/mount -t devpts devpts /dev/pts; }
    chain_success :cmd_spawn :quiet :exec /usr/bin/tcpsvd -E 0.0.0.0 2023 /usr/sbin/telnetd -i -l /bin/login
    chain_success :dbg_toast :Started Telnet server on port 2023
    chain_failure  :dbg_toast :Error starting Telnet server on port 2023
    chain_always:skip:-1
  chain_success :cmd_spawn :quiet :/usr/bin/pkill -f "^/usr/bin/tcpsvd -E 0.0.0.0 2023"                  
  chain_always :dbg_toast  :Stopped Telnet server on port 2023

menu_item :main :FTP (status) :cmd_output :500:quiet: /usr/bin/pgrep -f "^/usr/bin/tcpsvd -E 0.0.0.0 1021"  
  chain_success :dbg_toast  :FTP active on port 1021
  chain_failure :dbg_toast  :FTP inactive on port 1021

menu_item :main :FTP (toggle) :cmd_output :500:quiet: /usr/bin/pgrep -f "^/usr/bin/tcpsvd -E 0.0.0.0 1021"
  chain_success:skip:4
    chain_failure :cmd_spawn :quiet :exec /usr/bin/tcpsvd -E 0.0.0.0 1021 /usr/sbin/ftpd -w -t 30 /mnt/onboard
    chain_success :dbg_toast :Started FTP server for KOBOeReader partition on port 1021
    chain_failure :dbg_toast :Error starting FTP server on port 1021
    chain_always:skip:-1
  chain_success :cmd_spawn :quiet :/usr/bin/pkill -f "^/usr/bin/tcpsvd -E 0.0.0.0 1021"                  
  chain_always :dbg_toast :Stopped FTP server on port 1021
PeterT is offline   Reply With Quote