Advertisement
Combreal

autoLoginJoomla.ps1

Feb 20th, 2022
1,442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #This script logs into joomla local website and displays the greeting message
  2. #It must be ran with Administrator rights
  3. #Next time with HttpWebRequest calls
  4.  
  5. $username = "user"
  6. $password = "pass"
  7. If($ie) { Remove-Variable ie }
  8. $ie = New-Object -com InternetExplorer.Application
  9. $ie.visible=$true
  10. $ie.navigate("http://localhost/joomla/index.php")
  11. while($ie.ReadyState -ne 4) {start-sleep -m 100}
  12. $form = $ie.document.forms[0]
  13. $inputs = $form.GetElementsByTagName("input")
  14. ($inputs | where {$_.Name -eq "username"}).Value = "$username"
  15. ($inputs | where {$_.Name -eq "password"}).Value = "$password"
  16. Start-Sleep -Second 1
  17. ($ie.Document.IHTMLDocument3_getElementsByTagName('button') | where-object {$_.classname -eq "btn btn-primary"}).click()
  18. Start-Sleep -Second 1
  19. ($ie.Document.body.getElementsByTagName('div') | Where {$_.getAttributeNode('class').Value -eq 'mod-login-logout__login-greeting login-greeting'}).textContent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement