Example #1
0
    def downloadBuildManifest(self):
        shit = APIParser(self.device, self.version)
        buildid = shit.iOSToBuildid()
        shit.linksForDevice('ipsw')

        with open(f'{self.device}.json', 'r') as file:
            data = json.load(file)
            i = 0
            buildidFromJsonFile = data['firmwares'][i]['buildid']
            while buildidFromJsonFile != buildid:
                i += 1
                buildidFromJsonFile = data['firmwares'][i]['buildid']

            url = data['firmwares'][i]['url']
            manifest = 'BuildManifest.plist'

            # Start the process of reading and extracting a file from a url

            #print(f'Downloading manifest for {self.version}, {buildid}')
            zip = RemoteZip(url)
            zip.extract(manifest)
            # This can be done better
            os.rename(manifest, f'BuildManifest_{self.device}_{self.version}_{buildid}.plist')
            #print('Done downloading!')
            zip.close()

        file.close()
Example #2
0
    def downloadFileFromArchive(self, path, output):
        buildid = self.iOSToBuildid()
        self.linksForDevice('ipsw')
        with open(f'{self.device}.json', 'r') as file:
            data = json.load(file)
            i = 0
            buildidFromJsonFile = data['firmwares'][i]['buildid']
            while buildidFromJsonFile != buildid:
                i += 1
                buildidFromJsonFile = data['firmwares'][i]['buildid']

            url = data['firmwares'][i]['url']
            filename = splitToFileName(url)
            zip = RemoteZip(url)
            print(f"Extracting: {path}, from {filename}")
            zip.extract(path)
            zip.close()

            if output:

                shutil.move(path, output)

        file.close()
Example #3
0
        results = re.findall(regex, email_content)[0]
        url = ''.join(results)
        fd_exports.append(url)

download_dir = 'input/exports'
login_url = 'https://www.flowdock.com/login'
fd_username = config['flowdock_user']
fd_password = config['flowdock_password']

# To download the zip files we need to authenticate
browser = mechanicalsoup.StatefulBrowser()

browser.open(login_url)
login_form = browser.select_form()

browser['user_session[email]'] = fd_username
browser['user_session[password]'] = fd_password

login_response = browser.submit_selected()
request_headers = login_response.request.headers

flow_name_regex = r"/([a-zA-Z-]+)-2020-"

for fd_export in fd_exports:
    print(fd_export)
    flow_name = re.findall(flow_name_regex, fd_export)[0]
    zip = RemoteZip(fd_export, headers=request_headers)
    messages_file = zip.getinfo('messages.json')
    output_dir = '%s/%s/' % (download_dir, flow_name)
    zip.extract(messages_file, output_dir)