@@ -0,0 +1,2887 @@
+#!/usr/bin/python%0A#%0A# FalconIteratorSuite%0A#%0A# Currently iterates through current customer instances within falconhost%0A%0Afrom selenium import webdriver%0Afrom selenium.webdriver.common.keys import Keys%0Aimport time%0Aimport getpass%0A#import ConfigParser%0A%0A# get inputs from the user%0Abrowser = webdriver.Firefox()%0AfhURL = %22https://falcon.crowdstrike.com/login/%22  # verify that url has not changed%0Abrowser.get(fhURL)%0AcustList = %5B%5D  # customer list as populated by falconHost%0A%0A'''%0Atry:%0A    # get the configuration from file%0A    config = ConfigParser.ConfigParser()%0A    config.readfp(open('albert.cfg'))%0A    albertChatUser = config.get('chat', 'user')%0A    albertChatPass = config.get(%22chat%22, %22pass%22)%0Aexcept:%0A    print %22Missing config file, section, or required key%22%0A    exit() '''%0A%0A# falconhost logon%0Adef falconHostLogon():%0A    # web elements for authenticating%0A    myname          = raw_input('Enter FalconHost UserName: ')%0A    mypass          = getpass.getpass(prompt='Enter FalconHost Password: ')          # FH pass%0A    mykey           = raw_input(%22Enter FalconHost 2FA Token: %22)                      # FH 2FA%0A    # start authentication process; enters uname & pw%0A    print %22Authenticating to FalconHost%22%0A    time.sleep(1)%0A    username        = browser.find_element_by_id(%22username%22)%0A    password        = browser.find_element_by_id(%22password%22)%0A    login_attempt   = browser.find_element_by_xpath(%22//*%5B@type='submit'%5D%22)%0A    username.send_keys(myname)%0A    password.send_keys(mypass)%0A    login_attempt.submit()%0A    # delay, then 2fa token submission%0A    time.sleep(3)%0A    token           = browser.find_element_by_id(%22token%22)%0A    keysubmit       = browser.find_element_by_xpath(%22//*%5B@type='submit'%5D%22)%0A    token.send_keys(mykey)%0A    print %22Token entered.%22%0A    keysubmit.submit()%0A    # add error handling%0A    print %22Login successful%22%0A%0A# gets list of current customer FH instances%0Adef getCustList():%0A    global custList  # customer list as populated by falconHost%0A    del custList%5B:%5D%0A    cid = browser.find_element_by_xpath(%22//*%5B@class='hide-wrapper'%5D%22)%0A    temp = cid.text.split('%5Cn')%0A    for i in temp:%0A        if i.find(%22Current%22) == -1:%0A            try:%0A                custList.append(str(i))%0A            except UnicodeEncodeError:%0A                print %22DEBUG: Encoding error, character %25s not ascii...skipping%22 %25 i%0A                continue%0A    print %22DEBUG: current list of customers:%22%0A    for i in custList:%0A        print i%0A%0A# rotates through customer instances%0Adef rotateFalconHost():%0A    print %22# of customers %25d%22 %25 len(custList)%0A    for i in custList:%0A        select = browser.find_element_by_xpath('/html/body/nav/ol%5B2%5D/li%5B1%5D/div/select')%0A        select.send_keys(i)%0A        select.send_keys(Keys.RETURN)%0A        print %22Currently in %25s environment%22 %25 i%0A        time.sleep(7)%0A%0AfalconHostLogon()%0Atime.sleep(2)%0Awhile True:%0A    getCustList()%0A    for i in xrange(5):%0A        rotateFalconHost()%0A

Create falcon_iterator.py