Shell server
Start a web server to execute templated shell command directly.
###Usage
Install
npm i shrvr -g
Writing the shell template.
alias iptable_path = /iptables/:source_ip/:port/:destination
alias delete_rule = iptables -D PREROUTING -p tcp -s #source_ip --dport #port -j DNAT --to-destination #destination
alias add_rule = iptables -A PREROUTING -p tcp -s #source_ip --dport #port -j DNAT --to-destination #destination
POST iptable_path delete_rule && add_rule && echo "delete_rule" | at now + 48hour
DELETE iptable_path delete_rule
The command on this template will forward requests from :port of :source_ip to :destination. And automatic revoke this
rule after 48 hours. A valid command is:
iptable -A PREROUTING -p tcp -s 1.2.3.4 --dport 21135 -j DNAT --to-destination 192.168.2.1:8080
Start shrvr:
shrvr -t example-routes/iptable.route -p 6333 -b 192.168.1.10
Add an iptable rule via shrvr
curl -X POST http://192.168.1.10:6333/1.2.3.4/21135/192.168.2.1:8080