-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
105 lines (88 loc) · 4.68 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import discord
import requests
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
# Replace these with your actual tokens
NABZLINKS_TOKEN = "Nabzlinks token here" # https://nabz.link/member/tools/api
API_ARIES_TOKEN = "API Aries token here" # https://dashboard.api-aries.online/
DISCORD_TOKEN = "discord token here"# https://discord.com/developers/applications
# URLs - ignore these
SHORTEN_API_URL = "https://nabz.link/api"
SIGNING_API_URL = "https://api.api-aries.online/v1/cococloud/app-signer"
CERT_STATUS_URL = "https://api.cococloud-signing.online/cert-status/api"
@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
@bot.command(name='sign')
async def sign_app(ctx):
if not ctx.message.attachments:
await ctx.send("Please attach an IPA file. - [YouTube Tutorial](https://m.youtube.com/watch?v=Tdt13UOX3xI&feature=youtu.be)")
return
process_embed = discord.Embed(title="Signing App", description="Signing the app. Please wait...")
process_message = await ctx.send(embed=process_embed)
attachment_url = ctx.message.attachments[0].url
# Shorten the URL
try:
params = {
"api": NABZLINKS_TOKEN,
"url": attachment_url,
"type": 0
}
shorten_response = requests.get(SHORTEN_API_URL, params=params)
shorten_response.raise_for_status()
shortened_url = shorten_response.json().get("shortenedUrl")
if not shortened_url:
await process_message.edit(content="Error shortening the URL. Please try again.")
return
api_url = f"{SIGNING_API_URL}?app={shortened_url}"
process_embed.title = "Shortened URL"
process_embed.description = "URL has been shortened successfully. Please wait..."
await process_message.edit(embed=process_embed)
except requests.exceptions.RequestException as e:
print(f"Error shortening URL: {e}")
await process_message.edit(content="Error shortening the URL. Please try again.")
return
headers = {"APITOKEN": API_ARIES_TOKEN}
# Request app signing
try:
response = requests.get(api_url, headers=headers)
response.raise_for_status()
json_response = response.json()
original_app_name = json_response.get("original_app_name", "N/A")
original_app_bundle_id = json_response.get("original_app_bundle_id", "N/A")
signed_ipa_file = json_response.get("signed_ipa_file", "N/A")
bundle_id = json_response.get("bundle_id", "N/A")
plist_url = json_response.get("plist_url", "N/A")
exp_time = json_response.get("exp-time", "N/A")
# Get certificate status
try:
cert_status_response = requests.get(CERT_STATUS_URL, headers=headers)
cert_status_response.raise_for_status()
cert_status_json = cert_status_response.json()
certificate_status = cert_status_json.get("CertificateStatus", "N/A")
certificate_name = cert_status_json.get("CertificateName", "N/A")
if certificate_status == 'Signed':
certificate_status = 'Signed 🟢'
elif certificate_status == 'Revoked':
certificate_status = 'Revoked 🔴'
except requests.exceptions.RequestException as e:
print(f"Error getting certificate status: {e}")
certificate_status = 'Unknown'
certificate_name = 'Unknown'
process_embed.title = "App Signing Information"
process_embed.description = "The app has been successfully signed:"
process_embed.add_field(name="Certificate Name:", value=certificate_name, inline=False)
process_embed.add_field(name="Status:", value=certificate_status, inline=False)
process_embed.add_field(name="App Name:", value=original_app_name, inline=False)
process_embed.add_field(name="Original Bundle ID:", value=original_app_bundle_id, inline=False)
process_embed.add_field(name="New Bundle ID:", value=bundle_id, inline=False)
process_embed.add_field(name="Signed IPA File:", value=f"[Download File]({signed_ipa_file})", inline=False)
process_embed.add_field(name="Install on device:", value=f"[Install](http://api.cococloud-signing.online/files/enterprise/install-plist.php?app={plist_url})", inline=False)
process_embed.set_footer(text=f"Expires in: {exp_time}")
await process_message.edit(embed=process_embed)
except requests.exceptions.RequestException as e:
print(f"Error making API request: {e}")
await process_message.edit(content="Error signing the app. Please try again.")
bot.run(DISCORD_TOKEN)