Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #without comments
- $username = "admin"
- $password = "public"
- $ie = New-Object -com InternetExplorer.Application
- $ie.visible=$false
- $ie.navigate("http://192.168.1.1")
- while($ie.ReadyState -ne 4) {start-sleep -m 100}
- $ie.document.getElementById("username").value= "$username"
- $ie.document.getElementById("pass").value = "$password"
- $ie.document.getElementById("loginform").submit()
- start-sleep 20
- $ie.navigate("http://192.168.1.1/maintenance.html")
- $ie.document.getElementById("restartButton").click()
- # $links = $ie.Document.getElementsByTagName('A')
- # $restart = $links | where {$_.innerText -like 'Restart'}
- # $restart.click()
- #- - - - - - - - - - - - - - - - - - - - -
- #WITH COMMENTS
- # define username and password to login to airport
- $username = "admin"
- $password = "public"
- # initiate Internet explorer object (think of it as starting an invisible IE browser)
- $ie = New-Object -com InternetExplorer.Application
- $ie.visible=$false
- # use invisible browser and go to this URL
- $ie.navigate("http://192.168.1.1")
- # while readystate is not equal to 4, sleep this code 100 milliseconds so it doesnt move on without the page being loaded yet.
- # For Reference, here are the ReadyStates
- # READYSTATE_UNINITIALIZED = 0
- # READYSTATE_LOADING = 1
- # READYSTATE_LOADED = 2
- # READYSTATE_INTERACTIVE = 3
- # READYSTATE_COMPLETE = 4
- while($ie.ReadyState -ne 4) {start-sleep -m 100}
- # grab the element ID of the username box (this will depend on the airports login page.)
- # We will have to right click > inspect element in chrome on the login box to get the correct value
- $ie.document.getElementById("username").value= "$username"
- # same shit for password
- $ie.document.getElementById("pass").value = "$password"
- # clicks the login button
- $ie.document.getElementById("loginform").submit()
- # sleeps the code while the login process takes place
- start-sleep 20
- # navigates to the routers maintenance page where the restart button most likely takes place
- $ie.navigate("http://192.168.1.1/maintenance.html")
- # finds and clicks the reset button based on its html ID tag (theoretical that it is called restartButton)
- $ie.document.getElementById("restartButton").click()
- # the next 3 lines would be another way to grab the restart button
- # $links = $ie.Document.getElementsByTagName('A')
- # $restart = $links | where {$_.innerText -like 'Restart'}
- # $restart.click()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement