gabefromsimplebit commited on
Commit
7943970
·
verified ·
1 Parent(s): 4895a73

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +7 -0
  2. README.md +1 -8
  3. app.py +38 -0
Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+ RUN apt-get update && apt-get install -y g++ libssl-dev git zip && rm -rf /var/lib/apt/lists/*
3
+ RUN git clone https://github.com/zhlynn/zsign.git /opt/zsign && cd /opt/zsign && g++ *.cpp -lcrypto -O3 -o zsign && cp zsign /usr/local/bin/zsign
4
+ WORKDIR /app
5
+ COPY . .
6
+ RUN pip install flask flask-cors gunicorn
7
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
README.md CHANGED
@@ -1,12 +1,5 @@
1
  ---
2
  title: SimpleBit Signer
3
- emoji: 📚
4
- colorFrom: yellow
5
- colorTo: purple
6
  sdk: docker
7
- pinned: false
8
- license: mit
9
- short_description: check out simplebit.duckdns.org
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: SimpleBit Signer
 
 
 
3
  sdk: docker
4
+ app_port: 7860
 
 
5
  ---
 
 
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, send_file
2
+ from flask_cors import CORS
3
+ import subprocess, os, uuid
4
+
5
+ app = Flask(__name__)
6
+ CORS(app)
7
+
8
+ @app.route('/')
9
+ def home():
10
+ return "SimpleBit Engine is Online!"
11
+
12
+ @app.route('/sign', methods=['POST'])
13
+ def sign():
14
+ job_id = str(uuid.uuid4())[:8]
15
+ os.makedirs(job_id, exist_ok=True)
16
+
17
+ ipa = request.files['ipa']
18
+ p12 = request.files['p12']
19
+ prov = request.files['mobileprovision']
20
+ password = request.form.get('password', '1234')
21
+
22
+ ipa_path = f"{job_id}/app.ipa"
23
+ ipa.save(ipa_path)
24
+ p12.save(f"{job_id}/cert.p12")
25
+ prov.save(f"{job_id}/prov.mobileprovision")
26
+
27
+ output_path = f"{job_id}/signed.ipa"
28
+ cmd = f"zsign -k {job_id}/cert.p12 -p {password} -m {job_id}/prov.mobileprovision -o {output_path} {ipa_path}"
29
+
30
+ result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
31
+
32
+ if os.path.exists(output_path):
33
+ return send_file(output_path, as_attachment=True)
34
+ else:
35
+ return f"Error signing: {result.stderr}", 500
36
+
37
+ if __name__ == "__main__":
38
+ app.run(host="0.0.0.0", port=7860)