Skip to content

Instantly share code, notes, and snippets.

@naelstrof
Created October 26, 2016 04:37
Show Gist options
  • Save naelstrof/fd58974658674fc05cc844ae99d9f0f8 to your computer and use it in GitHub Desktop.
Save naelstrof/fd58974658674fc05cc844ae99d9f0f8 to your computer and use it in GitHub Desktop.
Brute forces a simple test on catme.com.
##
# @file catme.py
# @brief Quickly bruteforces a mind-numbing test on catme.org,
# # Install
# Requires python-selenium and python.
# # To Use
# Simply run the file through a python interpreter with the first argument being your catme email,
# and the second argument being your catme password. (eg. `python catme.py [email protected] myPassword123`)
#
# @author Dalton "naelstrof" Nell
# @version 0.0.0
# @date 2016-10-25
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import random
import sys
if ( len(sys.argv) < 3 ):
print( "Usage: python catme.py [email] [password]" )
print( "Example: python catme.py [email protected] eek123" )
exit(1)
usernameText = sys.argv[1]
passwordText = sys.argv[2]
driver = webdriver.Chrome();
driver.get("https://www.catme.org/student/index")
email = driver.find_element_by_name("email")
password = driver.find_element_by_name("password")
email.clear()
email.send_keys(usernameText)
password.clear()
password.send_keys(passwordText)
password.send_keys(Keys.RETURN)
#Catme doesn't like us entering our info so fast... so we enter it twice.
time.sleep(1)
password = driver.find_element_by_name("password")
password.send_keys(passwordText)
password.send_keys(Keys.RETURN)
random.seed()
running = True
while( running ):
driver.get("https://www.catme.org/student/survey_instructions")
nxt = driver.find_element_by_name("actionf")
nxt.click()
nxt = driver.find_element_by_name("actionf")
nxt.click()
for x in range( 0, 5 ):
person0 = str(random.randint(1,5))
person1 = str(random.randint(1,5))
person2 = str(random.randint(1,5))
butt0 = driver.find_element_by_css_selector('input[name="person0"][value="'+person0+'"]')
butt1 = driver.find_element_by_css_selector('input[name="person1"][value="'+person1+'"]')
butt2 = driver.find_element_by_css_selector('input[name="person2"][value="'+person2+'"]')
butt0.click()
butt1.click()
butt2.click()
nxt = driver.find_element_by_name("actionf")
nxt.click()
header = driver.find_element_by_css_selector('h1')
score = header.text[24:][:2]
# Check if we've succeeded
try:
success = driver.find_element_by_class_name("trainingsuccess")
print("Success with score of " + score + "!")
running = False
except:
# If we didn't succeed, we print the score and try again.
print("Got a score of " + score + ", trying again...")
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment