예제 #1
0
    def setUp(self):
        self.bytes = b64decode('TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5')
        self.key_iteration_count = 500
        self.username = '******'
        self.password = '******'
        self.encryption_key = b64decode(
            'OfOUvVnQzB4v49sNh4+PdwIFb9Fr5+jVfWRTf+E2Ghg=')

        self.blob = Blob(self.bytes, self.key_iteration_count)
예제 #2
0
    def setUp(self):
        self.username = '******'
        self.password = '******'
        self.key_iteration_count = 5000
        self.hash = b'7880a04588cfab954aa1a2da98fd9c0d2c6eba4c53e36a94510e6dbf30759256'
        self.session_id = '53ru,Hb713QnEVM5zWZ16jMvxS0'
        self.session = Session(self.session_id, self.key_iteration_count)
        self.blob_response = 'TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5'
        self.blob_bytes = b64decode(self.blob_response)
        self.blob = Blob(self.blob_bytes, self.key_iteration_count)

        self.login_post_data = {
            'method': 'mobile',
            'web': 1,
            'xml': 1,
            'username': self.username,
            'hash': self.hash,
            'iterations': self.key_iteration_count
        }

        self.google_authenticator_code = '12345'
        self.yubikey_password = '******'

        self.login_post_data_with_google_authenticator_code = self.login_post_data.copy(
        )
        self.login_post_data_with_google_authenticator_code[
            'otp'] = self.google_authenticator_code

        self.login_post_data_with_yubikey_password = self.login_post_data.copy(
        )
        self.login_post_data_with_yubikey_password[
            'otp'] = self.yubikey_password
예제 #3
0
    def setUp(self):
        self.bytes = b64decode('TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5')
        self.key_iteration_count = 500
        self.username = '******'
        self.password = '******'
        self.encryption_key = b64decode('OfOUvVnQzB4v49sNh4+PdwIFb9Fr5+jVfWRTf+E2Ghg=')

        self.blob = Blob(self.bytes, self.key_iteration_count)
예제 #4
0
    def test_init_raises_an_exception_on_truncated_blob(self):
        for i in [1, 2, 3, 4, 5, 10, 100, 1000]:
            blob = Blob(TEST_BLOB[:-i], TEST_KEY_ITERATION_COUNT)
            with self.assertRaises(Exception) as context:
                Vault(blob, TEST_ENCRYPTION_KEY)

            self.assertIn(type(context.exception),
                          [InvalidResponseError, struct.error])
예제 #5
0
    def setUp(self):
        self.username = '******'
        self.password = '******'
        self.key_iteration_count = 5000

        self.hash = b'7880a04588cfab954aa1a2da98fd9c0d2c6eba4c53e36a94510e6dbf30759256'
        self.session_id = '53ru,Hb713QnEVM5zWZ16jMvxS0'
        self.token = '54aa1a2da98fd9c0d2c6eba4c5'
        self.session = Session(self.session_id,
                               self.key_iteration_count,
                               token=self.token)

        self.blob_response = 'TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5'
        self.blob_bytes = b64decode(self.blob_response)
        self.blob = Blob(self.blob_bytes, self.key_iteration_count)

        self.login_post_data = {
            'method': 'cli',
            'xml': 2,
            'outofbandsupported': 1,
            'includeprivatekeyenc': 1,
            'username': self.username,
            'hash': self.hash,
            'iterations': self.key_iteration_count
        }

        self.device_id = '492378378052455'
        self.login_post_data_with_device_id = self.login_post_data.copy()
        self.login_post_data_with_device_id.update(
            {'trustlabel': self.device_id})
        self.login_post_data_with_device_id.update({'uuid': self.device_id})

        self.trust_id = '@2ykJ0Tp#dVi06qh6g6kvzOqjQGAWfKv'

        self.request_trust_data = {
            'token': self.token,
            'trustlabel': self.device_id,
            'uuid': self.trust_id
        }

        self.request_trust_cookies = {'PHPSESSID': self.session_id}

        self.google_authenticator_code = '12345'
        self.yubikey_password = '******'

        self.login_post_data_with_google_authenticator_code = self.login_post_data.copy(
        )
        self.login_post_data_with_google_authenticator_code[
            'otp'] = self.google_authenticator_code

        self.login_post_data_with_yubikey_password = self.login_post_data.copy(
        )
        self.login_post_data_with_yubikey_password[
            'otp'] = self.yubikey_password
예제 #6
0
class BlobTestCase(unittest.TestCase):
    def setUp(self):
        self.bytes = b64decode('TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5')
        self.key_iteration_count = 500
        self.username = '******'
        self.password = '******'
        self.encryption_key = b64decode('OfOUvVnQzB4v49sNh4+PdwIFb9Fr5+jVfWRTf+E2Ghg=')

        self.blob = Blob(self.bytes, self.key_iteration_count)

    def test_bytes_returns_the_correct_value(self):
        self.assertEqual(self.blob.bytes, self.bytes)

    def test_key_iteration_count_returns_the_correct_value(self):
        self.assertEqual(self.blob.key_iteration_count, self.key_iteration_count)

    def test_encryption_key_returns_the_correct_value(self):
        self.assertEqual(self.blob.encryption_key(self.username, self.password), self.encryption_key)
예제 #7
0
class BlobTestCase(unittest.TestCase):
    def setUp(self):
        self.bytes = b64decode('TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5')
        self.key_iteration_count = 500
        self.username = '******'
        self.password = '******'
        self.encryption_key = b64decode(
            'OfOUvVnQzB4v49sNh4+PdwIFb9Fr5+jVfWRTf+E2Ghg=')

        self.blob = Blob(self.bytes, self.key_iteration_count)

    def test_bytes_returns_the_correct_value(self):
        self.assertEqual(self.blob.bytes, self.bytes)

    def test_key_iteration_count_returns_the_correct_value(self):
        self.assertEqual(self.blob.key_iteration_count,
                         self.key_iteration_count)

    def test_encryption_key_returns_the_correct_value(self):
        self.assertEqual(
            self.blob.encryption_key(self.username, self.password),
            self.encryption_key)
예제 #8
0
 def setUp(self):
     self.vault = Vault(Blob(TEST_BLOB, TEST_KEY_ITERATION_COUNT), TEST_ENCRYPTION_KEY)
예제 #9
0
    def setUp(self):
        self.key_iteration_count = 5000
        self.blob = Blob(TEST_BLOB, self.key_iteration_count)
        self.padding = 'BEEFFACE'
        self.encryption_key = b64decode(
            'OfOUvVnQzB4v49sNh4+PdwIFb9Fr5+jVfWRTf+E2Ghg=')
        self.encoded_rsa_key = (
            "98F3F5518AE7C03EBBF195A616361619033509FB1FFA0408E883B7C5E80381F8"
            +
            "C8A343925DDA78FB06A14324BEC77EAF63290D381F54763A2793FE25C3247FC0"
            +
            "29022687F453426DE96A9FB34CEB55C02764FB41E5E1619226FE47FA7EA40B41"
            +
            "0973132F7AB2DE2D7F08C181C7D56BBF92CD4D44BC7DEE4253DEC36C77D28E30"
            +
            "6F41B8BB26B0EDB97BADCEE912D3671C22339036FC064F5AF60D3545D47B8263"
            +
            "6BBA1896ECDCF5EBE99A1061EFB8FBBD6C3500EA06A28BB8863F413702D9C05B"
            +
            "9A54120F1BEFA0D98A48E82622A36DBD79772B5E4AD957045DC2B97311983592"
            +
            "A357037DDA172C284B4FEC7DF8962A11B42079D6F943C8F9C0FEDFEA0C43A362"
            +
            "B550E217715FD82D9F3BB168A006B0880B1F3660076158FE8CF6B706CF2FEAA1"
            +
            "A731D1F68B1BC20E7ADE15097D2CD84606B4B0756DFE25DAF110D62841F44265"
            +
            "73A676B904972B31AD7B02093C536341E1DA943F1AFF88DF2005BD04C6897FB6"
            +
            "F9E307DA1C2BD219AB39F911FF90C6B1EA658C72C67C1EADC36CD5202654B4E1"
            +
            "99A88F13DCE1148CC04F81485896627BB1DB5C73969520CC66652492383930E3"
            +
            "3AFD57BE171F4BA25016EC9C3662F5B054101E381565433E46CB9FD517B59AE8"
            +
            "A5CE7D11005282E551E9DCAA1996763E41B49677F906F122AAB76E852F35B31F"
            +
            "397B70949D5F6C8DAA244AF16E9D48E0801E5C6D3FCEAFD2C3E157968B3E796C"
            +
            "87E1F3FFF86B62FE5263D1A597E3906BF697C019F1F543D7BB1E11B08837B47F"
            +
            "4528E4B47EB77508CFC0581B2A005383D0A238EA5BDE2E2602E0D2408B139735"
            +
            "F4BAF8D6CF260BBC81833A85F14C5746AC6081B878486F5A4BD23B821F3F5F6B"
            +
            "DAC8A9B57E25E24EDB8D701F01AE142D63A8A7D0F1CC8FAFF5F0320551CEB29B"
            +
            "DB6907C57E38602927AD7240003FEB238AC5437FE4BAD11BB5038CA74D539523"
            +
            "A167B8EBB1210608EB7DA53B4155D05B87D21848E58905EFA550EA5A51E0A68D"
            +
            "5FF0F9E0CC0D5105DD98BE9E2C41362794A71A573CCA87B57147115B86FC8A6B"
            +
            "B1778CED1920787271C75D69C5D63CD798915BF8F9877808F841F9269B2EA809"
            +
            "0E11F6C89FDB537F341142CA29BAC761E1CF9D58FFB0C44A26E5EF7FA14142C8"
            +
            "A84BC9304A221D5F961DB41B5925B06823A12A6F8950E47325021A747A02A28F"
            +
            "DAE65997EBDF5D2BDBCA7C8D689AE186A9FE85A170B76EE92595C9E33639C993"
            +
            "07C377FA4DA975E191810E993CDC0A33EE494B0EE8A1B6A9408285012967C17A"
            +
            "8CB5EE8E7973CF9186A98000FE00F1CC76420089C6BDCE9E39D403C320DF1135"
            +
            "1597FF8B231689389CCE12844289FEFE468BFCAEE9A2CFB1A8DD066AEC974DA9"
            +
            "C8530C9A17593E25DC89934E056B178329C4BBF7113657677AB25EE66A1E1D92"
            +
            "F62154B2451B37727F05B3AC0F2501F7A95845C9BE210D411028C27A9AD4B0E8"
            +
            "31A6C46D26883A8AA2D1E2BD3E8E122A6FC21CECB7AE2B91C6FCFA793C5CAFF6"
            +
            "53C6670D914A29EAD81CD5C29FFB048C81CC80EDD693B4D8091B2D5DE88EA042"
            +
            "11AC551F406B713278BD14667E437C610953D6186C2986BA60361C2013395E8E"
            +
            "A9D14CD00EC5C61147BE03D8965B5376DF32E2C3740128398E0D47900C888FD0"
            +
            "D1F7D583808AFBC0712806E11462B37815C20692FB38E61CC0B1AAF66A854982"
            +
            "6A1F5FFFF2436B0B9F9EDFF4F5B59B362AA1D25A4E3C398EB18445483F8419BD"
            +
            "1511A5177E9C4B7034375A2D91B95153535E6CD5F023F4EED0E15B5415A3B7A7"
            +
            "7E390AA698DF00F4FD897B0454C00959AF0CB54B272DE63968815B971C44B273"
            +
            "6AC737FAE6A19F544907833F13C6F424D30E3B85054A4402EC94079C1473C20B"
            +
            "E4C1B33525486BB098EF960082DB4DF5FE9CAF71681B03CB2D4BE7382FF0C03F"
            +
            "18144DE554256591773DC3F381116955233FDA7223D71C402E558783F221E25A"
            +
            "94FECD350654A9CD8EE8C39E4B1CFBA0D5FD46891527F2D0FC9EA61584A76D59"
            +
            "99719811B2BAFC99769E6911733ED389A731C327CB5D7BB6D79CE030D3285586"
            +
            "C6681FC8C110EFE30CEE883FFEF5FB511B4421863E2A15F8CDCFA7B84B931121"
            +
            "5B23093DE3B5E7F4CFCCE60BE7857B7442B8FCC3E43C46C4BFA3E9ABD2F479F6"
            +
            "BD8D3F3D36C0FAC1F4D72FBE96C644AB56F73CAF956D5544B2EB9C589ED30FF3"
            +
            "0BB03D09DB455764EF4A33C24F93170A98A21455826390B13A8F338A820EC08D"
            +
            "6E9F562282C2F815BB57CE511AB6B0DE75EFA63F28C6D0B25298CDAAC76742D5"
            +
            "353B26B77C1533B4DFE2D95F3E89315C0D806A90FCDFDC31CE04A9E29937680D"
            +
            "32D8B503352388109C1F5F41E8496302E13A61917F70A9AA3C5ECDBD88163E3C"
            +
            "F0580C5EB1382BB66194AC0983BAA16B4D220756F4B7E3DDFFC5BF343FA7E31D"
            +
            "14FED4409AD0FE9BBE01AF79DA4852253CBF166FDCA90E894B5267A502F73347"
            +
            "06F8C767EC861324CC7734352D76DB007E25105E7994CF91D79532221316F4DE"
            +
            "56BAE4351D3E3C6549FBFEF13BBE2636071794AD9EC3787B4A71E5438B86C358"
            +
            "65ECF2EA5980318F82D8B113C0EC8FEE41C243E0A1A09F373A0CF546FA18E1EC"
            +
            "7DB4842A6B8B03D115654222B87DA6034EFDE2224DBD23AB104BF3723856C03D"
            +
            "B639BA073F2CC8E4AB05BAADDB5DEACC1874F4D6F86B95710019114DACBFE48F"
            +
            "EF2AE2DF27356B5C17948B26A41FD1A8F07E8068E176F995910C373886DB47D2"
            +
            "6C2FE5CD97AAF1829EBC1EEBA4D88343A322E810385138F51F0E5149183699C4"
            +
            "05E49ED13C2889A22742893A52567B0F7D4A3BC9F4DC6D29F713AA7FB4EF6B13"
            +
            "5F92F598404A80E7D6515CE234AFA68A4B562AF203162C60D578F0D00E302958"
            +
            "174E1A712FD449D257C6AA5F56E4DBD0363573931463BC910858AF1EC40C1F4A"
            +
            "7BE27DE8E170D4AACF6C34B0CDE15190FD81FA5676136A4D73E2AA4BBFBB8E7C"
            +
            "1178EF47362188D9288E822B10BBF2C8BE075A5BD1D3E1F08108BA8C4E6FB173"
            +
            "DCECB5771E9D8AE4CD776EA3409DF30FA2252D3C3769AF12177F4A1929DC8E74"
            +
            "D5AEAC94CF94EEBA0E9AC012C57B40A8BB57530C25846B841005767B9AABE436"
            +
            "D4590977FDDA519B9B284CF8B8922A0E8B659ECE3745A95800EE1B3DDD33E0FF"
            +
            "230C0528BC7A4CB80604411E59E08775A42C634E93BA9C77D015659AC912F436"
            +
            "94F774E94050E4B3BF84290368D5AFD7F043BDCA3BD0CC8C0E267069B6F1386A"
            +
            "E1D9C8B5512AAAA292FDA9CA07E27BAF983E1E25A11732797425F2BB396B302E"
            +
            "0782BA183D4BC1F682365774520EAC8A321C7A0BD08027021EA0063D471E0AD1"
            +
            "E1469AD803C311D3FBF50B5538265D4262B6716D90E89A8C906D08533D650000"
            +
            "6BF1B8ABAAFE1CA3AFDD1A19ACABE5B86A804D36AE27163CAF390FD266D5FFEF"
            +
            "FC7CE6FEF9458E4AF0C4108E32EFD11C19751B1D9883E803F7C2E1A5786F3385"
            +
            "1A7CA3772ECD7CB0E9782A7D30E0A9FD09EED361B774A277C618C995FD7F7634"
            + "E7DB3834690B58DDFF6B721157D0EC02")
        self.rsa_key_encryption_key = b64decode(
            'v4uHomAR0tAXC3fA5Nfq7DjyJxuvYErMSCcZIWZKjpM=')

        self.chunks = parser.extract_chunks(self.blob)
        self.accounts = [
            parser.parse_ACCT(i, TEST_ENCRYPTION_KEY) for i in self.chunks
            if i.id == b'ACCT'
        ]