Skip to content

Instantly share code, notes, and snippets.

@sakajunquality
Created February 16, 2016 03:00
Show Gist options
  • Save sakajunquality/9a3f4c5b5a8a98ca26bc to your computer and use it in GitHub Desktop.
Save sakajunquality/9a3f4c5b5a8a98ca26bc to your computer and use it in GitHub Desktop.
某無線APを自動でリスタート
## telnetもsshもできない、
## Webインターフェイスでクリックポチポチめんどくさいので、
## CasperJSで自動化!
## こんなインターフェイス: https://gyazo.com/8c9c532333a644d22d7e5b03638d5f40
## 無線AP
aps = [
'10.10.0.1',
'10.10.0.2',
'10.10.0.3',
'10.10.0.4',
'10.10.0.5'
]
restart_path = '/cgi-bin/APMainte'
casper = require('casper').create()
casper.start()
## Basic認証を突破
casper.setHttpAuth 'username', 'password'
casper.each aps, (self, ap) ->
url = 'http://' + ap + 'restart_path'
self.thenOpen url, ->
@echo("Restart: " + ap)
@wait 100
@click 'input[type="submit"]'
self.then ->
## pingが返って来るまで待ったほうがいいけどめんどいから適当に数分待つ
@wait 3000
casper.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment