sauce-archives / isign

Code sign iOS applications, without proprietary Apple software or hardware
Other
756 stars 316 forks source link

Running in Windows #65

Open ncn32 opened 8 years ago

ncn32 commented 8 years ago

Any suggestions in running in Windows environment? All the scripts are in shell script... Any other limitations? I already got python with all modules needed. The only way I saw in do it is in python script calling isign as show in description.

mkayswork commented 8 years ago

By 'running in windows' do you mean to run 'isign signed.ipa unsigned.ipa' on your shell? If you specify the question a bit I am sure I or somene else can help you.

ncn32 commented 8 years ago

OK. Let´s go code. Following:

`import os.path os.environ["HOME"] = "c:\iOSpub" os.environ["OPENSSL"] = "C:\OpenSSL-Win32\bin\openssl.exe"

sPathOutput = "Payload/SinapseMobile.app" sFileIPA = "sinapsemobile.ipa"

from isign import isign

if isign.view("SinapseMobile"): print("OK") else: os.environ["HOME"] = sHome print("ERROR")

isign.resign("SinapseMobile", output_path = sPathOutput)

import os import zipfile from shutil import rmtree

if os.path.exists(sFileIPA): print("Removing file " + sFileIPA); os.remove(sFileIPA) print("Zipping " + sFileIPA + "..."); zf = zipfile.ZipFile(sFileIPA, "w") for dirname, subdirs, files in os.walk("Payload"): zf.write(dirname) for filename in files: zf.write(os.path.join(dirname, filename)) zf.close()

print("---Finish---") This is producing the following error: OK Traceback (most recent call last): File "signsinapse.py", line 21, in isign.resign("SinapseMobile", output_path = sPathOutput) File "C:\Python27\lib\site-packages\isign\isign.py", line 49, in resign info_props) File "C:\Python27\lib\site-packages\isign\archive.py", line 264, in resign apple_cert_file=apple_cert) File "C:\Python27\lib\site-packages\isign\signer.py", line 88, in init team_id = self._get_team_id() File "C:\Python27\lib\site-packages\isign\signer.py", line 143, in _get_team_id certificate_info = openssl_command(cmd) File "C:\Python27\lib\site-packages\isign\signer.py", line 34, in openssl_command stdout=subprocess.PIPE) File "C:\Python27\lib\subprocess.py", line 711, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 959, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified`

I´m not trying to rewrite the shell code. I´m trying to use the iSign python by itself.

mkayswork commented 8 years ago

The problem you have is related to the fact that isign refers to the openssl installed on the machine. As windows has no pre compiled openssl, isign is not executable on windows, only on unix systems. @saucelabs-user, please correct me if I'm wrong. If I am right, I would please you to add this information onto the project information. In my opinion, this information is crucial for people who are interested in iSign.

ncn32 commented 8 years ago

O yeah! I noticed it... Well, for while, it´s a good thing put the warning "Only Unix Systems". But if isn't a problem for you guys, I´d like to contribute to port the code to run in Windows environments. I need it! ;-) Every company I go here in Brazil is Windows systems network and other solutions by Microsoft. In the code, we can make changes using the function platform.system() == "Windows". I can see that the problem is chars like "/" instead of "\" and other things like the OpenSSL for Windows sintaxes.

mkayswork commented 8 years ago

Is there any reliable port of openssl that could be used for this project? How do you intend to replace openssl used by unix systems?

ncn32 commented 8 years ago

Of course pal! By themselves... [https://wiki.openssl.org/index.php/Binaries] It´s possible. Let´s keep contact. I will need some support in revising the code to not make anything "strange" for you.

mkayswork commented 8 years ago

I've seen this binaries too, but they are 3rd party... means there might be slight differences which can break the signing process. I don't know if it's worth investigating on that, but do as you want ;)

neilk commented 8 years ago

Well, right now it's somewhat embarassing that we have to use an external openssl at all. In theory we could use python bindings to appropriate libraries, but I think we're missing one particular binding that we need (or, I could never find it documented).

I could track down what the issue was, and maybe we can fix it that way.

ncn32 commented 8 years ago

Wow! This could save a lot of work... I was thinking about it too. The suggestion checking out the platform is not so good. We can try something wrote in Python or we can add a layer to do this job and so we will have a dynamic code to port and isolated module. I didn´t study your code properly yet. But correct me if I doing redundants suggestions.

DanTheMan827 commented 8 years ago

Another thing for Windows... would it also perhaps be possible to compile a exe (a C++ library would be amazing but...) that doesn't require a full python install?

There are a couple different python compilers that output a exe, Nuitka is one of them

darmie commented 6 years ago

Install pyOpenssl by running pip install pyOpenSSL so iSign should use that instead.