forked from esecuritylab/kostebek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_yahoo.py
executable file
·69 lines (58 loc) · 1.82 KB
/
test_yahoo.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import gevent
from gevent import monkey, pool
monkey.patch_all()
from gevent import ssl
import os, sys, time
import requests
from bs4 import BeautifulSoup
import urllib3
import re
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.common.exceptions import NoSuchElementException
from random import randint
import argparse
import tldextract
def getYahoo(dork):
chrome_options = Options()
chrome_options.add_argument("--window-size=1920x1080")
chrome_options.add_argument("--disable-infobars")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("disable-infobars")
chrome_options.add_argument("--no-sandbox")
chrome_driver = "/usr/local/bin/chromedriver"
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=chrome_driver)
driver.get('https://www.yahoo.com')
driver.implicitly_wait(20)
# bypass = driver.find_element_by_xpath("/html/body/div/div/div/form/div/button[2]")
# bypass.click()
# time.sleep(2)
search = driver.find_element_by_name('p')
dork2 = 'intext:"'+dork+'"'
time.sleep(3)
search.send_keys(dork2)
search.submit();
try:
i=1
while i < 11:
time.sleep(3)
links = driver.find_elements_by_css_selector('div.dd.algo.algo-sr.Sr > div > h3 > a')
for url in links:
print(url.get_attribute("href"))
time.sleep(5)
map = driver.find_element_by_xpath("//*[contains(@title, '"+str(i)+"1')]")
map.click()
time.sleep(2)
i += 1
except NoSuchElementException as e:
print("No Such Element")
driver.quit()
sys.exit(0)
driver.quit()
sys.exit(0)
getYahoo("© Company 2019")
sys.exit(0)