kstamand
Occasional Visitor
Is it possible to issue cli command from the router WebUI and return the results?
Background - I often ssh to the router to issue some quick status commands (brctl show, ethctl phy-map, iptables -vnl CHAIN). I'm familiar with Asuswrt user scripts and third party add-on API (I have a working model for adding a new user tab but I'm stuck there on how to proceed with .asp / .js code, hence my question). I've also successfully modified Main_LogStatus_Content.asp previously to allow for filtering returned syslog records >> https://www.snbforums.com/threads/c...abilities-working-prototype.87357/post-936846
Goal - from the Router WebUI, have a new Userx tab that allows for entering a CLI command with an "execute" button, which is then executed in background and then results returned to WebUI.
Edit: @jacklul - I was concerned that it may be a security concern, so thanks for that feedback and I definitely want to avoid those kind of issues.
@thelonelycoder - I look forward to your thoughtful feedback. FWIW, I only have a handful of commands I’m interested in. So I’m rethinking of a fixed list of command “names” that could be selected from the WebUI that I could then call a corresponding sh script might avoid the security concerns JackLul pointed out.
Thank you both for the feedback.
If yes, is there a script available where this is done already?
If not, any advice and pointers of where I might start to learn how to do this (I've been looking at existing scripts like YazFi, scMerlin, and others for ideas but no luck finding one yet)?
Background - I often ssh to the router to issue some quick status commands (brctl show, ethctl phy-map, iptables -vnl CHAIN). I'm familiar with Asuswrt user scripts and third party add-on API (I have a working model for adding a new user tab but I'm stuck there on how to proceed with .asp / .js code, hence my question). I've also successfully modified Main_LogStatus_Content.asp previously to allow for filtering returned syslog records >> https://www.snbforums.com/threads/c...abilities-working-prototype.87357/post-936846
Goal - from the Router WebUI, have a new Userx tab that allows for entering a CLI command with an "execute" button, which is then executed in background and then results returned to WebUI.
Edit: @jacklul - I was concerned that it may be a security concern, so thanks for that feedback and I definitely want to avoid those kind of issues.
@thelonelycoder - I look forward to your thoughtful feedback. FWIW, I only have a handful of commands I’m interested in. So I’m rethinking of a fixed list of command “names” that could be selected from the WebUI that I could then call a corresponding sh script might avoid the security concerns JackLul pointed out.
Thank you both for the feedback.
Last edited: