Sunday, April 29, 2007

Reboot Router from wget command line

ทดสอบใช้ได้กับ router Zyxel ส่วนยี่ห้ออื่นก็ไม่ต่างกัน

http://gnuwin32.sourceforge.net/packages/wget.htm
http://www.ieinspector.com/httpanalyzer/download.html
download version standalone มาจะดีกว่าเพราะสามารถดูผลได้จากการสั่งผ่าน IE หรือ Command line ก็ได้

วิธีที่ 1
wget --user=username --password=password --post-data IsReset=1 http://192.168.15.2/Forms/DiagGeneral_2
ข้อดีของการใช้ option --user ,--passwd ก็คือจะไม่มีปัญหากับ user หรือ password ที่มีตัวอักษรแปลกๆ

หรือ
wget --post-data IsReset=1 http://username:password@192.168.15.2/Forms/DiagGeneral_2

วิธีที่ 2 กรณีที่ไม่ต้องการให้รู้ว่า user/pass คืออะไรโดยทำการ encode user/pass ก่อน (แต่ก็มีวิธีการ decode ได้)
wget -E --header="Authorization: Basic ZnJlZDp0aGF0cyBtZQ==" --post-data IsReset=1 http://192.168.15.2/Forms/DiagGeneral_2

วิธีที่ 3 ใช้ autoit script

AutoItSetOption("WinTitleMatchMode",2)
AutoItSetOption("SendKeyDownDelay",50)

Run("cmd.exe","",@SW_MAXIMIZE)
sleep(1000)

WinActivate("cmd.exe")
WinWaitActive("cmd.exe")

Send("telnet 192.168.1.1{ENTER}")
Sleep(500)
Send("password{ENTER}")
Sleep(500)

Send("24{ENTER}")
Sleep(500)
Send("8{ENTER}")
Sleep(500)
Send("sys reboot{ENTER}")

Friday, April 27, 2007

ประโยชน์ของ IP Alias หรือ Secondary IP ของ Router

Example 1 Bypass Firewall (Basic) Example 2 Bypass Firewall + Separate Network (Complex)