Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Last login: Sun Nov 5 13:22:50 on ttys001
- cs-wall-02:~ cswall2$ pwd
- /Users/cswall2
- cs-wall-02:~ cswall2$ ls -la
- total 72
- drwxr-xr-x+ 20 cswall2 staff 680 Nov 5 21:40 .
- drwxr-xr-x 5 root admin 170 Nov 25 2015 ..
- -r-------- 1 cswall2 staff 7 Nov 25 2015 .CFUserTextEncoding
- -rw-r--r--@ 1 cswall2 staff 8196 Oct 28 2016 .DS_Store
- drwx------ 2 cswall2 staff 68 Nov 1 14:28 .Trash
- -rw-r--r-- 1 cswall2 staff 2353 Nov 5 21:42 .bash_history
- drwxr-xr-x 25 cswall2 staff 850 Nov 5 21:42 .bash_sessions
- -rw-r--r-- 1 cswall2 staff 59 Nov 5 21:40 .extrahop
- -rw------- 1 cswall2 staff 3751 Nov 5 21:40 .viminfo
- drwx------ 4 cswall2 staff 136 Jan 4 2016 Applications
- drwx------+ 4 cswall2 staff 136 Jan 27 2017 Desktop
- drwx------+ 4 cswall2 staff 136 Nov 3 19:00 Documents
- drwx------+ 6 cswall2 staff 204 Jan 27 2017 Downloads
- drwx------@ 50 cswall2 staff 1700 May 14 10:21 Library
- drwx------+ 3 cswall2 staff 102 Nov 25 2015 Movies
- drwx------+ 3 cswall2 staff 102 Nov 25 2015 Music
- drwx------+ 4 cswall2 staff 136 Oct 28 2016 Pictures
- drwxr-xr-x+ 5 cswall2 staff 170 Nov 25 2015 Public
- -rw-r--r-- 1 cswall2 staff 281 Jun 26 10:09 install.sh
- -rw-r--r-- 1 cswall2 staff 1556 Nov 5 21:37 refresh.py
- cs-wall-02:~ cswall2$ echo $EXTRAHOP_USER
- cs-wall-02:~ cswall2$ vim .extrahop
- cs-wall-02:~ cswall2$ source .extrahop
- cs-wall-02:~ cswall2$ echo $EXTRAHOP_USER
- cswall
- cs-wall-02:~ cswall2$ echo $EXTRAHOP_PASS
- cswall123
- cs-wall-02:~ cswall2$ python /Users/cswall2/refresh.py 'https://extrahop.apple.com/extrahop/#/Dashboard/cas7/?from=1&interval_type=DAY&until=0'
- cs-wall-02:~ cswall2$ python /Users/cswall2/refresh.py 'https://extrahop.apple.com/extrahop/#/Dashboard/cas7/?from=1&interval_type=DAY&until=0'
- cs-wall-02:~ cswall2$ vim refresh.py
- cs-wall-02:~ cswall2$ vim refresh.py
- cs-wall-02:~ cswall2$ vim refresh.py
- import os, time
- import sys
- import selenium
- from selenium.webdriver.chrome.options import Options
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.common.action_chains import ActionChains
- if len(sys.argv) != 2 or not os.path.exists("/Applications/chromedriver"):
- print "python refresh.py [url]"
- else:
- chromedriver = "/Applications/chromedriver"
- os.environ["webdriver.chrome.driver"] = chromedriver
- _chrome_options = Options()
- _chrome_options.add_argument('--disable-infobars')
- _chrome_options.add_argument("--window-position=0,-300")
- _chrome_options.add_argument('--kiosk')
- _chrome_options.add_argument('--start-fullscreen')
- _chrome_options.add_experimental_option('prefs', {
- 'credentials_enable_service': False,
- 'profile': {
- 'password_manager_enabled': False
- "refresh.py" 42L, 1557C
- 'password_manager_enabled': False
- }
- })
- driver = selenium.webdriver.Chrome(chromedriver, chrome_options=_chrome_options)
- login_url = "https://extrahop.apple.com/extrahop/?local"
- url = sys.argv[1]
- driver.get(login_url)
- wait = WebDriverWait(driver, 20)
- wait.until(lambda driver: driver.current_url == login_url and driver.find_element_by_id("id_loginButton"))
- username = driver.find_element_by_id("id_username")
- password = driver.find_element_by_id("id_password")
- username.send_keys(os.environ['EXTRAHOP_USER'])
- password.send_keys(os.environ['EXTRAHOP_PASS'])
- # driver.find_element_by_id("id_loginButton").click()
- driver.get(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement