Botting
Botting¶
https://github.com/Skyvern-AI/skyvern AI automation
https://github.com/mherrmann/helium simple automation
Selenium¶
Example¶
Selenium Autoing:
from selenium import webdriver
from selenium.webdriver.common.by import By
# Initialize chrome webdriver
driver = webdriver.Chrome()
# Load page
driver.get("https://example.com")
# Wait for title to load from dynamic JS execution
driver.implicitly_wait(10)
# Selenium can extract dynamically loaded elements
print(driver.title)
# Selenium allows clicking buttons triggering JS events
driver.find_element(By.ID, "dynamicBtn").click()
# Inputs can be handled as well
search = driver.find_element(By.NAME, 'search')
search.send_keys('Automate using Selenium')
search.submit()
# Teardown browser after done
driver.quit()
JS Automation¶
https://github.com/pyppeteer/pyppeteer
IP Rotating¶
https://github.com/PortSwigger/ip-rotate
Capcha¶
Bypass Techniques:
- Omit the Captcha Parameter
- Send Empty Captcha
- Reuse a Captcha
- Try across different sessions
- Test Ratelimits, IP rotation, Useragent and Header Manipulation
Re-Riding Attack¶
- Use single solution to generate mutable operations using the same capcha solution
Auto Solver¶
- Using Optical Character Recognition
http://deathbycaptcha.com/
http://www.de-captcher.com/
Impersonating CAPTCHA Providers¶
- Send the Capcha solution to another server
https://github.com/OpenSecurityResearch/clipcaptcha
Cloudflare Bypass¶
https://www.zenrows.com/blog/bypass-cloudflare#what-is-cloudflare-bot-management
Bypass Cloudflare:
import undetected_chromedriver as uc
import time
@staticmethod
def _setDriver(proxy=None, headless=False):
chrome_options = uc.ChromeOptions()
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0'
chrome_options.add_argument(f'--user-agent={ua}')
chrome_options.headless = headless
chrome_options.add_argument("--no-first-run")
chrome_options.add_argument("--no-service-autorun")
chrome_options.add_argument("--password-store=basic")
chrome_options.add_argument("--lang=en")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--disable-infobars")
chrome_options.add_experimental_option("prefs",{
"credentials_enable_service": False,
"profile.password_manager_enabled": False,
"password_manager_enabled": False,
})
if proxy:
proxy_options = {
'proxy': {
'http': proxy,
'https': proxy,
'no_proxy': 'localhost:127.0.0.1'
}
}
else:
proxy_options = None
driver = uc.Chrome(options=chrome_options, selenium_options=proxy_options)
return driver
busstopnum = 20000
URL = f"https://mybusnow.njtransit.com/predictions/bystop/bustime:{busstopnum}"
driver = _setDriver(headless=True)
driver.get(f'https://mybusnow.njtransit.com/predictions/bystop/bustime:{busstopnum}')
driver.execute_script(f"window.open('{URL}', '_blank');")
time.sleep(3)
driver.switch_to.window(driver.window_handles[1])
driver.save_screenshot('f_njtransit.png')
#driver.implicitly_wait(2)