def overwriteDdEnt(self): command = "jtool --sign --inplace --ent ~/ent.xml /bin/dd" self.logging.debug("Inserting entitlements to dd now") stdin, stdout, stderr = self.ssh_client.exec_command(command) error = stderr.read().decode("utf-8") if len(error) > 0: self.logging.error("Error inserting entitlements to dd. Error was: " + error) self.closeSsh() self.closeTcpRelay() system.exitProgram()
def stealEntitlements(self): jtool_command = "jtool --ent /System/Library/Filesystems/apfs.fs/apfs.util > ~/ent.xml" self.logging.debug("Copying entitlements from apfs.util now") stdin, stdout, stderr = self.ssh_client.exec_command(jtool_command) error = stderr.read().decode("utf-8") if len(error) > 0: self.logging.error("Error copying entitlements from apfs.util. Error was: " + error) self.closeSsh() self.closeTcpRelay() system.exitProgram()
def checkRequirements(self): '''Gets all commands redy to find the neccessary binaries''' self.logging.debug( "Starting to check binary requirements on the iOS device now") apfs_check = "ls /System/Library/Filesystems/apfs.fs/apfs.util" dd_check = "ls /bin/dd" jtool_check = "ls /usr/bin/jtool" '''Checks for apfs.util existence''' self.logging.debug( "Checking for apfs.util existence. This should be here on every device" ) stdin, stdout, stderr = self.ssh_client.exec_command(apfs_check) apfs_exist = stdout.read() apfs_exist = apfs_exist.decode("utf-8") if apfs_exist != "/System/Library/Filesystems/apfs.fs/apfs.util\n": self.logging.error( "Could not find apfs.util in /System/Library/Filesystems/apfs.fs/" ) self.closeSsh() self.closeTcpRelay() system.exitProgram() '''Checks for dd existence''' self.logging.debug("Checking for dd existence in /bin/dd") stdin, stdout, stderr = self.ssh_client.exec_command(dd_check) dd_exist = stdout.read() dd_exist = dd_exist.decode("utf-8") if dd_exist != "/bin/dd\n": self.logging.error("Could not find dd in /bin/") self.closeSsh() self.closeTcpRelay() system.exitProgram() '''Checks for jtool existence''' self.logging.debug("Checking for jtool existence in /usr/bin/") stdin, stdout, stderr = self.ssh_client.exec_command(jtool_check) jtool_exist = stdout.read() jtool_exist = jtool_exist.decode("utf-8") if jtool_exist != "/usr/bin/jtool\n": self.logging.error("Could not find dd in /usr/bin/") self.closeSsh() self.closeTcpRelay() system.exitProgram()