diff --git a/autotss.py b/autotss.py index 6822be0..bc91dae 100755 --- a/autotss.py +++ b/autotss.py @@ -45,13 +45,23 @@ def importNewDevices(self): if not boardconfig: boardconfig = self.getBoardConfig(identifier) - newDevices.append({'deviceName': name, 'deviceID': identifier, 'boardConfig': boardconfig, 'deviceECID': ecid, 'blobsSaved': '[]'}) + try: + apnonces = json.loads(config.get(section, 'apnonces')) + except: + apnonces = '' + + if apnonces != '': + for apnonce in apnonces: + newDevices.append({'deviceName': name, 'deviceID': identifier, 'boardConfig': boardconfig, 'deviceECID': ecid, 'apnonce': apnonce, 'blobsSaved': '[]'}) + else: + newDevices.append({'deviceName': name, 'deviceID': identifier, 'boardConfig': boardconfig, 'deviceECID': ecid, 'apnonce': apnonces, 'blobsSaved': '[]'}) else: print('Unable to find devices.ini') # Add only new devices to database for newDevice in newDevices: - if not db.find_one(deviceECID=newDevice['deviceECID']): + print(newDevice) + if not db.find_one(deviceECID=newDevice['deviceECID'], apnonce = newDevice['apnonce']): print('Device: [{deviceName}] ECID: [{deviceECID}] Board Config: [{boardConfig}]'.format(**newDevice)) numNew += 1 db.insert(newDevice) @@ -145,8 +155,13 @@ def saveBlobs(self, device, buildID, versionNumber): '--boardconfig', device['boardConfig'], '--buildid', buildID, '--save-path', savePath, + '--apnonce', device['apnonce'], '-s'] + if device['apnonce'] == '': + del scriptArguments[-3] + del scriptArguments[-2] + tssCall = subprocess.Popen(scriptArguments, stdout=subprocess.PIPE) tssOutput = [] @@ -200,7 +215,7 @@ def pushToDatabase(self): print('\nUpdating database with newly saved blobs...') for device in self.devices: - self.database['devices'].update(device, ['deviceECID']) + self.database['devices'].update(device, ['deviceECID', 'apnonce']) print('Done updating database') return diff --git a/devices_example.ini b/devices_example.ini index 8d057dd..bc58e93 100755 --- a/devices_example.ini +++ b/devices_example.ini @@ -5,4 +5,12 @@ ecid = 1438617935153 [codsane's iPhone SE] identifier = iPhone8,4 ecid = A1032047B013A -boardconfig = n69uap \ No newline at end of file +boardconfig = n69uap +apnonces = [ + "", + "603be133ff0bdfa0f83f21e74191cf6770ea43bb", + "352dfad1713834f4f94c5ff3c3e5e99477347b95", + "42c88f5a7b75bc944c288a7215391dc9c73b6e9f", + "0dc448240696866b0cc1b2ac3eca4ce22af11cb3", + "9804d99e85bbafd4bb1135a1044773b4df9f1ba3" + ] \ No newline at end of file