checkout OpenWrt, you have a posix compliant ash shell from busybox and lot's of shellmagic in the base. You can parse json from bash and interact with the router via an system-bus where you can write plugins in posix-sh that can be called via json-rpc from the browser. https://openwrt.org/docs/guide-developer/ubus - example script: https://wiki.openwrt.org/doc/techref/rpcd