-
Notifications
You must be signed in to change notification settings - Fork 0
/
shmoocon_bot.py
39 lines (30 loc) · 961 Bytes
/
shmoocon_bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome()
driver.get("http://landing.shmoocon.org/")
known_links = [
]
tab_opened = False
while True:
driver.refresh()
try:
tbody = driver.find_element_by_id("main-section")
links = tbody.find_elements_by_tag_name("a")
except:
continue
for link in links:
if hasattr(link, "text"):
if link.text not in known_links and (link.is_displayed() is True):
tab_opened = True
actions = ActionChains(driver)
actions.move_to_element(link)
actions.send_keys(Keys.COMMAND)
actions.click(link)
actions.perform()
if tab_opened:
print("Opened tab. Sleeping 10 seconds")
time.sleep(10)
time.sleep(.1)