User:Pepsimax2k

From DD-WRT Wiki

Revision as of 10:58, 20 October 2007 by Pepsimax2k (Talk | contribs)
Jump to: navigation, search

Random bash code...

Telnet to router from router, save output to file, grep file for term

sh /tmp/yourscript | tee /tmp/ipinfo

  1. !/bin/sh

myuser=root mypass=password myhost="192.168.1.2 23" mycmd="uptime" (echo -e "$myuser\r"; sleep 1; echo -e "$mypass\r"; sleep 1; sleep 1; echo -e "$mycmd\r"; sleep 5; ) | telnet $myhost echo -e "exit\r"

if [ "`cat ipinfo | grep " 12 days"`" != "" ]; then echo "woohoo"; fi;