Exemplo n.º 1
0
    def test_signer_class(self):

        lib_dir_path = join(dirname(realpath(__file__)), 'TestPythonLibDir')
        log.debug("library directory: {}".format(lib_dir_path))

        calls = [
        ]  # Py2 won't allow to refer to outer scope by assignment, e.g. isCalled = True

        # To let the outer scope know a thing happened, must alter a mutable object - like an array!
        def callback(x):
            log.debug("The callback was fired")
            calls.append(x)

        output_path = self.get_temp_file()

        try:
            sys.path.append(lib_dir_path)

            from CallbackSigner import CallbackSigner

            isign.resign(
                IsignBaseTest.TEST_IPA,
                certificate=IsignBaseTest.CERTIFICATE,
                provisioning_profile=IsignBaseTest.PROVISIONING_PROFILE,
                output_path=output_path,
                signer_class=FooSigner,
                signer_arguments={'callback': callback})
            assert len(calls) > 0
        finally:
            sys.path.remove(lib_dir_path)
Exemplo n.º 2
0
    def test_remote_signer(self):

        output_path = self.get_temp_file()

        httpd_process = None

        try:
            httpd_process = self.start_httpd()

            isign.resign(
                IsignBaseTest.TEST_IPA,
                key=
                None,  # ugh this is so ugly, we should introduce defaults in command line processing,
                # not later
                certificate=IsignBaseTest.CERTIFICATE,
                provisioning_profile=IsignBaseTest.PROVISIONING_PROFILE,
                output_path=output_path,
                signer_class=
                RemotePkcs1Signer,  # This is also ugly. Perhaps there should be a different interface
                signer_arguments={
                    'host': CONFIG.host,
                    'port': CONFIG.port,
                    'key': CONFIG.cert_hash_to_key_file.keys()[0]
                })
            # test the output path for correctness
        finally:
            if httpd_process is not None:
                httpd_process.kill()
Exemplo n.º 3
0
def ipa_install(ipa):
    """
    Resign & install iOS apps.
    """
    ipa = os.path.abspath(ipa)
    print('Resigning ipa: {}'.format(ipa))
    isign.resign(ipa, output_path=ipa)
    cmd = 'ideviceinstaller -i {}'.format(ipa)
    subprocess.check_output(cmd.split())
Exemplo n.º 4
0
def glt_resign(file, **args):

    if wt_directory != '':
        try:

            isign.resign_with_creds_dir(file, wt_directory)
            print('success')
            os.remove(wt_input)
        except Exception as e:
            print(type(e))
            print(e.args)
            # re-raise the exception without exposing internal
            # details of how it happened
            print(e)

        # isign.resign(wt_input, output_path=wt_output)

    else:
        if wt_key:
            args.update({"key": wt_key})
        if wt_apple_cert:
            args.update({"apple_cert": wt_apple_cert})
        if wt_certificate:
            args.update({"certificate": wt_certificate})
        if wt_provisioning_profile:
            args.update({"provisioning_profile": wt_provisioning_profile})
        if wt_output:
            args.update({"output_path": wt_output})
        if wt_info:
            args.update({"info_props": wt_info})
        # args.update({
        #     "apple_cert":wt_apple_cert,
        #     "key": wt_key,
        #     "certificate": wt_certificate,
        #     "provisioning_profile": wt_provisioning_profile,
        #     "output_path":wt_output,
        #     "info_props":wt_info
        # })
        try:

            isign.resign(file, **args)
            print('success')
            os.remove(wt_input)
        except Exception as e:
            print(type(e))
            print(e.args)

            # re-raise the exception without exposing internal
            # details of how it happened
            print(e)
Exemplo n.º 5
0
    def test_adhoc_signing(self):
        """
        Ad-hoc signing is "identityless" signing. We indicate this by simply not providing the key.

        These options were added by Facebook. It's not obvious if they still work.
        This test looks like it should work, but doesn't because other parts of the code still want an
        Entitlements file?
        """
        output_path = self.get_temp_file()
        isign.resign(self.TEST_IPA,
                     key=None,
                     provisioning_profile=IsignBaseTest.PROVISIONING_PROFILE,
                     output_path=output_path)
        assert exists(output_path)
        assert os.path.getsize(output_path) > 0
        self.unlink(output_path)
Exemplo n.º 6
0
 def resign(self, filename, **args):
     """ resign with test credentials """
     args.update({
         "key": self.KEY,
         "certificate": self.CERTIFICATE,
         "provisioning_profile": self.PROVISIONING_PROFILE
     })
     return isign.resign(filename, **args)
Exemplo n.º 7
0
 def resign(self, filename, **args):
     """ resign with test credentials """
     args.update({
         "key": self.KEY,
         "certificate": self.CERTIFICATE,
         "provisioning_profile": self.PROVISIONING_PROFILE
     })
     return isign.resign(filename, **args)
Exemplo n.º 8
0
    def test_signer_class(self):
        calls = [
        ]  # Py2 won't allow to refer to outer scope by assignment, e.g. isCalled = True

        # To let the outer scope know a thing happened, must alter a mutable object - like an array!
        def callback(x):
            log.debug("The callback was fired")
            calls.append(x)

        output_path = self.get_temp_file()

        isign.resign(
            IsignBaseTest.TEST_IPA_XCODE7,
            key=None,
            certificate=IsignBaseTest.CERTIFICATE,
            provisioning_profiles=[IsignBaseTest.PROVISIONING_PROFILE],
            output_path=output_path,
            signer_class=CallbackSigner,
            signer_arguments={
                'callback': callback,
                'keyfile': IsignBaseTest.KEY
            })
        assert len(calls) > 0
Exemplo n.º 9
0
    def test_remote_signer(self):

        output_path = self.get_temp_file()

        httpd_process = None

        try:
            httpd_process = self.start_httpd()

            isign.resign(
                IsignBaseTest.TEST_IPA_XCODE7,
                certificate=IsignBaseTest.CERTIFICATE,
                provisioning_profiles=[IsignBaseTest.PROVISIONING_PROFILE],
                output_path=output_path,
                signer_class=RemotePkcs1Signer,
                signer_arguments={
                    'host': CONFIG.host,
                    'port': CONFIG.port,
                    'key': CONFIG.cert_hash_to_key_file.keys()[0]
                })
            # test the output path for correctness
        finally:
            if httpd_process is not None:
                httpd_process.terminate()
Exemplo n.º 10
0
def ipa_install(ipa):
    ipa = abspath(ipa)
    logger.info('Resigning ipa: {}'.format(ipa))
    isign.resign(ipa, output_path=ipa)
    cmd = 'ideviceinstaller -i {}'.format(ipa)
    u.run_shell_command(cmd)
Exemplo n.º 11
0
def resign():
    print('Resign IPA')
    isign.resign("AgileBase.ipa", output_path="AgilePromoter.ipa")
Exemplo n.º 12
0
    # There's only one output path, so it doesn't make sense
    # to have multiple input paths
    app_path = args.app_paths[0]

    # Convert the Info.plist property pairs to a dict format
    if args.info_props:
        info_props = {}
        for arg in args.info_props.split(','):
            i = arg.find('=')
            if i < 0:
                raise Exception('Invalid Info.plist argument: ' + arg)
            info_props[arg[0:i]] = arg[i + 1:]
        if info_props:
            kwargs['info_props'] = info_props


    # Handle standard resign. User may have specified all, some
    # or none of the credential files, in which case we rely on
    # isign.resign() to supply defaults.
    # Massage args into method arguments
    resign_args = ['certificate',
                   'key',
                   'apple_cert',
                   'provisioning_profile',
                   'output_path',
                   'alternate_entitlements_path']
    kwargs.update(filter_args(args, resign_args))
    
    isign.resign(app_path, **kwargs)