|
|
@@ -0,0 +1,72 @@ |
|
|
import sys |
|
|
from time import sleep |
|
|
from selenium import webdriver |
|
|
from selenium.common.exceptions import TimeoutException |
|
|
from selenium.common.exceptions import WebDriverException |
|
|
from selenium.webdriver.common.keys import Keys |
|
|
from eliot import start_action, to_file, log_call |
|
|
# from selenium.webdriver.common.desired_capabilities import DesiredCapabilities |
|
|
# from selenium.webdriver.common.by import By |
|
|
# from selenium.webdriver.support import expected_conditions as EC |
|
|
# from selenium.webdriver.support.ui import WebDriverWait |
|
|
to_file(open("debug.log", "w")) # Eliot logs |
|
|
|
|
|
|
|
|
options = webdriver.ChromeOptions() |
|
|
# options.add_argument('--headless') |
|
|
options.add_argument('--disable-gpu') |
|
|
options.add_argument('--mute-audio') |
|
|
options.add_argument('--ignore-certificate-errors') |
|
|
options.add_argument('--ignore-ssl-errors') |
|
|
options.add_argument('--disable-infobars') |
|
|
options.add_argument('--ignore-certificate-errors-spki-list') |
|
|
options.add_argument('--no-sandbox') |
|
|
options.add_argument('--no-zygote') |
|
|
options.add_argument('--log-level=3') |
|
|
options.add_argument('--allow-running-insecure-content') |
|
|
options.add_argument('--disable-web-security') |
|
|
options.add_argument('--disable-features=VizDisplayCompositor') |
|
|
options.add_argument('--disable-breakpad') |
|
|
options.add_argument('--acceptInsecureCerts=true') |
|
|
# Set desired capabilities to ignore SSL stuffs |
|
|
desired_capabilities = options.to_capabilities() |
|
|
# desired_capabilities['acceptSslCerts'] = True |
|
|
desired_capabilities['acceptInsecureCerts'] = True |
|
|
|
|
|
driver = webdriver.Chrome( |
|
|
options=options, |
|
|
service_args=["--verbose", "--log-path=chromerun.log"], |
|
|
desired_capabilities=desired_capabilities) |
|
|
|
|
|
driver.implicitly_wait(10) |
|
|
driver.set_page_load_timeout(5) |
|
|
|
|
|
|
|
|
@log_call |
|
|
def ignore_insecure_certs(): |
|
|
ips = ['http://10.255.255.1', 'http://wikisecure.net/', |
|
|
'https://self-signed.badssl.com/', 'https://revoked.badssl.com/'] |
|
|
for eachHost in ips: |
|
|
try: |
|
|
with start_action(action_type="urlOpen", |
|
|
domain=eachHost, |
|
|
drv_desired_caps=driver.desired_capabilities): |
|
|
try: |
|
|
print('\nURL:\t{}'.format(eachHost)) |
|
|
driver.get(eachHost) |
|
|
sleep(3) |
|
|
if driver.title: |
|
|
print("Title:\t{}".format(driver.title)) |
|
|
except TimeoutException as pyexp: |
|
|
print(pyexp) |
|
|
pass |
|
|
except WebDriverException as webdrvexcp: |
|
|
print(webdrvexcp) |
|
|
pass |
|
|
except Exception as excp: |
|
|
print(excp) |
|
|
pass |
|
|
|
|
|
|
|
|
ignore_insecure_certs() |
|
|
driver.quit() |