Skip to content

Instantly share code, notes, and snippets.

@Zinkuth
Created April 14, 2021 10:00
Show Gist options
  • Save Zinkuth/17699967ce50f0042ba81ae2f3133056 to your computer and use it in GitHub Desktop.
Save Zinkuth/17699967ce50f0042ba81ae2f3133056 to your computer and use it in GitHub Desktop.
This python program (used Selenium) tries to submit a random string into the input field of given website in a faster way.
import time
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
# Configure the browser
options = Options()
options.set_headless()
assert options.headless
my_browser = Firefox(options=options)
my_browser.get("<-[Enter URL here]->")
# Get the random string
the_key = my_browser.find_element_by_id("rndstring")
the_key = the_key.text
# Submit the random string
submission = my_browser.find_element_by_id("inputfield") #The element "inputfield" might differ.
submission.send_keys(the_key)
submission.send_keys(Keys.ENTER)
time.sleep(0.5)
# Display the flag
src = my_browser.page_source
flag = src[src.find("{") + 1 : src.find("}")]
print("+ flag +")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment