Created
February 16, 2016 03:00
-
-
Save sakajunquality/9a3f4c5b5a8a98ca26bc to your computer and use it in GitHub Desktop.
某無線APを自動でリスタート
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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