Example #1
0
 def __init__(self,
              driver,
              base_url,
              pin="",
              description="Selenium enrolled"):
     Token.__init__(self, driver=driver, base_url=base_url)
     select_tag = driver.find_element_by_id("tokentype")
     select(driver,
            select_element=select_tag,
            option_text="Simple Pass Token")
     driver.find_element_by_id("spass_pin1").clear()
     driver.find_element_by_id("spass_pin1").send_keys(pin)
     driver.find_element_by_id("spass_pin2").clear()
     driver.find_element_by_id("spass_pin2").send_keys(pin)
     driver.find_element_by_id("enroll_spass_desc").clear()
     driver.find_element_by_id("enroll_spass_desc").send_keys(description)
     driver.find_element_by_id("button_enroll_enroll").click()
     time.sleep(1)
     info_boxes = driver.find_elements_by_css_selector(
         "#info_box > .info_box > span")
     for box in info_boxes:
         if box.text.startswith("created token with serial"):
             self.serial = box.find_element_by_tag_name("span").text
     if not self.serial or not self.serial.startswith("LSSP"):
         raise Exception("Simple pass token was not enrolled correctly.")
Example #2
0
 def __init__(self,
              driver,
              base_url,
              pin="",
              hmac_key="",
              generate_key=False,
              otp_length=6,
              hash_algorithm="sha1",
              description="Selenium enrolled"):
     """
     """
     assert bool(hmac_key) ^ bool(generate_key)  # xor
     Token.__init__(self, driver=driver, base_url=base_url)
     select_tag = driver.find_element_by_id("tokentype")
     select(driver,
            select_element=select_tag,
            option_text="HMAC eventbased")
     wel_hmac_key_cb = driver.find_element_by_id("hmac_key_cb")
     wel_hmac_key = driver.find_element_by_id("hmac_key")
     wel_hmac_otplen = driver.find_element_by_id("hmac_otplen")
     wel_hmac_algorithm = driver.find_element_by_id("hmac_algorithm")
     wel_enroll_hmac_desc = driver.find_element_by_id("enroll_hmac_desc")
     if wel_hmac_key_cb.is_selected():
         wel_hmac_key_cb.click()  # unselect checkbox
     if hmac_key:
         wel_hmac_key.clear()
         wel_hmac_key.send_keys(hmac_key)
     elif generate_key:
         wel_hmac_key_cb.click()
     select(driver,
            select_element=wel_hmac_otplen,
            option_text=str(otp_length))
     select(driver,
            select_element=wel_hmac_algorithm,
            option_text=hash_algorithm)
     wel_enroll_hmac_desc.send_keys(description)
     driver.find_element_by_id("button_enroll_enroll").click()
     time.sleep(1)
     driver.find_element_by_id("pin1").clear()
     driver.find_element_by_id("pin1").send_keys(pin)
     driver.find_element_by_id("pin2").clear()
     driver.find_element_by_id("pin2").send_keys(pin)
     driver.find_element_by_id("button_setpin_setpin").click()
     time.sleep(1)
     info_boxes = driver.find_elements_by_css_selector(
         "#info_box > .info_box > span")
     for box in info_boxes:
         if box.text.startswith("created token with serial"):
             self.serial = box.find_element_by_tag_name("span").text
     if not self.serial or not self.serial.startswith("OATH"):
         raise Exception("HMAC/HOTP token was not enrolled correctly.")
Example #3
0
    def __init__(self,
                 driver,
                 base_url,
                 pin="",
                 hmac_key="",
                 generate_key=False,
                 otp_length=6,
                 hash_algorithm="sha1",
                 description="Selenium enrolled"):
        """
        """
        assert bool(hmac_key) ^ bool(generate_key) # xor
        Token.__init__(self, driver=driver, base_url=base_url)
        select_tag = driver.find_element_by_id("tokentype")
        select(driver, select_element=select_tag, option_text="HMAC eventbased")
        wel_hmac_key_rb_gen = driver.find_element_by_id("hmac_key_rb_gen")
        wel_hmac_key_rb_no = driver.find_element_by_id("hmac_key_rb_no")
        wel_hmac_key = driver.find_element_by_id("hmac_key")
        wel_hmac_otplen = driver.find_element_by_id("hmac_otplen")
        wel_hmac_algorithm = driver.find_element_by_id("hmac_algorithm")
        wel_enroll_hmac_desc = driver.find_element_by_id("enroll_hmac_desc")

        if hmac_key:
            wel_hmac_key_rb_no.click()  # select: seed input - no random see
            wel_hmac_key.clear()
            wel_hmac_key.send_keys(hmac_key)
        elif generate_key:
            wel_hmac_key_rb_gen.click()  # select: random seed

        select(driver, select_element=wel_hmac_otplen, option_text=str(otp_length))
        select(driver, select_element=wel_hmac_algorithm, option_text=hash_algorithm)
        driver.find_element_by_id("hmac_pin1").clear()
        driver.find_element_by_id("hmac_pin1").send_keys(pin)
        driver.find_element_by_id("hmac_pin2").clear()
        driver.find_element_by_id("hmac_pin2").send_keys(pin)
        wel_enroll_hmac_desc.send_keys(description)
        driver.find_element_by_id("button_enroll_enroll").click()
        time.sleep(1)
        info_boxes = driver.find_elements_by_css_selector("#info_box > .info_box > span")
        for box in info_boxes:
            if box.text.startswith("created token with serial"):
                self.serial = box.find_element_by_tag_name("span").text
        if not self.serial or not self.serial.startswith("OATH"):
            raise Exception("HMAC/HOTP token was not enrolled correctly.")
Example #4
0
 def __init__(self,
              driver,
              base_url,
              pin="",
              description="Selenium enrolled"):
     Token.__init__(self, driver=driver, base_url=base_url)
     select_tag = driver.find_element_by_id("tokentype")
     select(driver, select_element=select_tag, option_text="Simple Pass Token")
     driver.find_element_by_id("spass_pin1").clear()
     driver.find_element_by_id("spass_pin1").send_keys(pin)
     driver.find_element_by_id("spass_pin2").clear()
     driver.find_element_by_id("spass_pin2").send_keys(pin)
     driver.find_element_by_id("enroll_spass_desc").clear()
     driver.find_element_by_id("enroll_spass_desc").send_keys(description)
     driver.find_element_by_id("button_enroll_enroll").click()
     time.sleep(1)
     info_boxes = driver.find_elements_by_css_selector("#info_box > .info_box > span")
     for box in info_boxes:
         if box.text.startswith("created token with serial"):
             self.serial = box.find_element_by_tag_name("span").text
     if not self.serial or not self.serial.startswith("LSSP"):
         raise Exception("Simple pass token was not enrolled correctly.")
Example #5
0
 def __init__(
     self,
     driver,
     base_url,
     pin="",
     hmac_key="",
     generate_key=False,
     otp_length=6,
     hash_algorithm="sha1",
     description="Selenium enrolled",
 ):
     """
     """
     assert bool(hmac_key) ^ bool(generate_key)  # xor
     Token.__init__(self, driver=driver, base_url=base_url)
     select_tag = driver.find_element_by_id("tokentype")
     select(driver, select_element=select_tag, option_text="HMAC eventbased")
     wel_hmac_key_cb = driver.find_element_by_id("hmac_key_cb")
     wel_hmac_key = driver.find_element_by_id("hmac_key")
     wel_hmac_otplen = driver.find_element_by_id("hmac_otplen")
     wel_hmac_algorithm = driver.find_element_by_id("hmac_algorithm")
     wel_enroll_hmac_desc = driver.find_element_by_id("enroll_hmac_desc")
     if wel_hmac_key_cb.is_selected():
         wel_hmac_key_cb.click()  # unselect checkbox
     if hmac_key:
         wel_hmac_key.clear()
         wel_hmac_key.send_keys(hmac_key)
     elif generate_key:
         wel_hmac_key_cb.click()
     select(driver, select_element=wel_hmac_otplen, option_text=str(otp_length))
     select(driver, select_element=wel_hmac_algorithm, option_text=hash_algorithm)
     wel_enroll_hmac_desc.send_keys(description)
     driver.find_element_by_id("button_enroll_enroll").click()
     time.sleep(1)
     driver.find_element_by_id("pin1").clear()
     driver.find_element_by_id("pin1").send_keys(pin)
     driver.find_element_by_id("pin2").clear()
     driver.find_element_by_id("pin2").send_keys(pin)
     driver.find_element_by_id("button_setpin_setpin").click()