Skip to content

Instantly share code, notes, and snippets.

@synsa
Forked from javikalsan/execute_on_router.sh
Created February 2, 2021 18:23
Show Gist options
  • Save synsa/fc64d86565d2aa69968cccf372ea8441 to your computer and use it in GitHub Desktop.
Save synsa/fc64d86565d2aa69968cccf372ea8441 to your computer and use it in GitHub Desktop.
Simple Bash Script to execute a command on the router through telnet command
#!/bin/sh
# replace cmd1 for the command to execute
host=192.168.1.1
port=23
user=myuser
pass=mypass
cmd1='ifconfig wl0 down'
( echo open ${host}
sleep 1
echo ${user}
sleep 1
echo ${pass}
sleep 1
echo ${cmd1}
sleep 2
) | telnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment