Advertisement
Guest User

Untitled

a guest
Nov 6th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. Last login: Sun Nov 5 13:22:50 on ttys001
  2. cs-wall-02:~ cswall2$ pwd
  3. /Users/cswall2
  4. cs-wall-02:~ cswall2$ ls -la
  5. total 72
  6. drwxr-xr-x+ 20 cswall2 staff 680 Nov 5 21:40 .
  7. drwxr-xr-x 5 root admin 170 Nov 25 2015 ..
  8. -r-------- 1 cswall2 staff 7 Nov 25 2015 .CFUserTextEncoding
  9. -rw-r--r--@ 1 cswall2 staff 8196 Oct 28 2016 .DS_Store
  10. drwx------ 2 cswall2 staff 68 Nov 1 14:28 .Trash
  11. -rw-r--r-- 1 cswall2 staff 2353 Nov 5 21:42 .bash_history
  12. drwxr-xr-x 25 cswall2 staff 850 Nov 5 21:42 .bash_sessions
  13. -rw-r--r-- 1 cswall2 staff 59 Nov 5 21:40 .extrahop
  14. -rw------- 1 cswall2 staff 3751 Nov 5 21:40 .viminfo
  15. drwx------ 4 cswall2 staff 136 Jan 4 2016 Applications
  16. drwx------+ 4 cswall2 staff 136 Jan 27 2017 Desktop
  17. drwx------+ 4 cswall2 staff 136 Nov 3 19:00 Documents
  18. drwx------+ 6 cswall2 staff 204 Jan 27 2017 Downloads
  19. drwx------@ 50 cswall2 staff 1700 May 14 10:21 Library
  20. drwx------+ 3 cswall2 staff 102 Nov 25 2015 Movies
  21. drwx------+ 3 cswall2 staff 102 Nov 25 2015 Music
  22. drwx------+ 4 cswall2 staff 136 Oct 28 2016 Pictures
  23. drwxr-xr-x+ 5 cswall2 staff 170 Nov 25 2015 Public
  24. -rw-r--r-- 1 cswall2 staff 281 Jun 26 10:09 install.sh
  25. -rw-r--r-- 1 cswall2 staff 1556 Nov 5 21:37 refresh.py
  26. cs-wall-02:~ cswall2$ echo $EXTRAHOP_USER
  27.  
  28. cs-wall-02:~ cswall2$ vim .extrahop
  29. cs-wall-02:~ cswall2$ source .extrahop
  30. cs-wall-02:~ cswall2$ echo $EXTRAHOP_USER
  31. cswall
  32. cs-wall-02:~ cswall2$ echo $EXTRAHOP_PASS
  33. cswall123
  34. cs-wall-02:~ cswall2$ python /Users/cswall2/refresh.py 'https://extrahop.apple.com/extrahop/#/Dashboard/cas7/?from=1&interval_type=DAY&until=0'
  35. cs-wall-02:~ cswall2$ python /Users/cswall2/refresh.py 'https://extrahop.apple.com/extrahop/#/Dashboard/cas7/?from=1&interval_type=DAY&until=0'
  36. cs-wall-02:~ cswall2$ vim refresh.py
  37. cs-wall-02:~ cswall2$ vim refresh.py
  38. cs-wall-02:~ cswall2$ vim refresh.py
  39.  
  40. import os, time
  41. import sys
  42. import selenium
  43. from selenium.webdriver.chrome.options import Options
  44. from selenium.webdriver.common.by import By
  45. from selenium.webdriver.support.ui import WebDriverWait
  46. from selenium.webdriver.common.action_chains import ActionChains
  47.  
  48.  
  49. if len(sys.argv) != 2 or not os.path.exists("/Applications/chromedriver"):
  50. print "python refresh.py [url]"
  51. else:
  52. chromedriver = "/Applications/chromedriver"
  53. os.environ["webdriver.chrome.driver"] = chromedriver
  54. _chrome_options = Options()
  55. _chrome_options.add_argument('--disable-infobars')
  56. _chrome_options.add_argument("--window-position=0,-300")
  57. _chrome_options.add_argument('--kiosk')
  58. _chrome_options.add_argument('--start-fullscreen')
  59. _chrome_options.add_experimental_option('prefs', {
  60. 'credentials_enable_service': False,
  61. 'profile': {
  62. 'password_manager_enabled': False
  63. "refresh.py" 42L, 1557C
  64. 'password_manager_enabled': False
  65. }
  66. })
  67. driver = selenium.webdriver.Chrome(chromedriver, chrome_options=_chrome_options)
  68.  
  69. login_url = "https://extrahop.apple.com/extrahop/?local"
  70. url = sys.argv[1]
  71. driver.get(login_url)
  72.  
  73. wait = WebDriverWait(driver, 20)
  74. wait.until(lambda driver: driver.current_url == login_url and driver.find_element_by_id("id_loginButton"))
  75.  
  76. username = driver.find_element_by_id("id_username")
  77. password = driver.find_element_by_id("id_password")
  78.  
  79. username.send_keys(os.environ['EXTRAHOP_USER'])
  80. password.send_keys(os.environ['EXTRAHOP_PASS'])
  81. # driver.find_element_by_id("id_loginButton").click()
  82.  
  83. driver.get(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement