pkpass: Unknown encoding of JSON format (iOS Wallet pass file) - ios

I am trying to open a .pkpass file (or merely the contained pass.json file) in an app I am developing, however, while I didn't have issues with 3 passes I tried, the 4th seems to have some kind of weird encoding and/or binary data within the JSON.
When I open the JSON file using e.g. less in the shell, I'll get this:
And while we can see mostly garbage, there is readable characters mixed into it. When I open it using XCode, this is what I get:
This leads me to believe its a character encoding issue. But I am not too good in text encoding, so I don't know how I can find out the correct encoding in order to be able to properly read this file with my app. file is giving me:
$ file -I pass.json
pass.json: application/octet-stream; charset=binary
I tried opening the file with BBedit over and over again with different encodings, none would open it in a readable format.
What kind of format is this, or how can I find out, so I can implement the correct method of opening/parsing this file?

I feel you're encondind the file pass.json charset as a binary, and this file must be a charset for text like this:
pass.json: application/json; charset=us-ascii
Check your how you are generating the package of .pkpass file because maybe you are zip or compress every file inside the package instead package all the required files.
Could you post more about code of how you are generating the .pkpass file?

Related

Identify old dos system file type and decode it into text file

I have pick up an old dos system from my friend, and I need to import the data into SQL, but before importing the data, i need to decode it into a readable text file, but I failed to do so. I have try several stuff:
file command in ubuntu terminal, it said "data"
Use online trid and it said macbin(MacBinary 1)
Tried bin2hex, but couldn't unhex it
Tried some online macbin to hex, no luck as well
Tried to open in macOS, but it keep extracting files
bin2hex said, nothing here
stuffitexpander.... Doesn't recognize...
This is the file that i need to decode
https://gofile.io/?c=wdbs6A
Please let me know if you need the original program.
I think they are just some database files.
Use this site for explanations. they even have a file analyzer - showing you the data inside.
You will need to rename the files to .db extension instead of .ocm.

How to read itunes backup file (Manifest.db)

I'm trying to read and analysis iPhone backup files in Library/Application Support/MobileSync/Backup folder.
I use SQLite DB viewer to view the manifest.db:
Files TABLE structure
Files TABLE content
The filename is encrypted. And the file is blob type which I can't decide it's an image or text or documents.
How can I get the details of these backup? (Using Javascript would be best, or Swift).
The numbers and letters under fileID are the file names in the backup as in the folders with the manifest.db, and they correspond to the domain and relative path (duh). In iOS versions newer than 9.3.5, you can find the file itself in the folder named with the 1st 2 characters of the fileID. At the end of the relative path in the database it should have an extension. Use that as a hint to what program to use to open the file. Xcode for .plist etc. Ultimately it depends what you're looking for...
The blob in the blob column is a binary plist. You can parse it using a plist parser e.g. Property List Parsing
The blob appears to be base64 encoded, but I cannot figure out the type of the resulting binary blob. I've checked to see if it can be decrypted with openssl enc -aes-256-cbc -d decoded-string-as-binary-blob.datafile but I get back "bad magic." I've also tries all of the other AES encryption ciphers and block cipher modes, but no change. It could always be XOR'd with a value, but I haven't found an easy to test that theory.

Swift - how do i convert a regular XML file to a .plist XML file

I searched the web for this one and mostly found Obj-C answers or outdated answers so ill simply post the question and hope for the best :)
Im working with a team of Android Developers while im working on IOS. they use XML files for a lot of data. since we want the data between us to stay consistent - we want to be able to have shared XML files to use in our projects.
I know .plist is basically a type of XML, but i want to be able to get the regular shared XML file and turn it into a .plist and then use it in my IOS project.
any known method of doing it at all? if so, is it possible to do it automatically somehow? (script or something of that sort. maybe even do it locally inside the application)
Thanks for the help
A .plist file is a very specific XML file with only a small set of keys allowed. A random XML file will not be convertible to a .plist file.
Try converting your file to JSON first. If you can convert it to JSON you will be able to automatically convert it to a .plist after that using the plutil command with the xml1 or binary1 format.
plutil -convert xml1 -o output.plist input.json
If you can't convert it to JSON, you can keep your XML file as is and parse it in your app using NSXMLParser. XML is harder to parse than .plist or JSON files, but aside from that the difference should be minimal.

MIME Type is changing my file extension

I'm working on an app that allows files to be opened from both the email application Apple provides, and the web. The problem is when I email myself a file, the extension clearly shows it's a .gfp file. But the minute I download it to my computer it turns into a .json file. The .gfp file is using JSON to organize the data, but it's not supposed to be a .json file. I understand that it's the MIME type screwing it up, but I can't leave the MIME type nil, meaning I'm stuck with a preexisting filetype. How do I keep it a .gfp file no matter where it goes?
Code:
[mailer addAttachmentData:jsonData mimeType:#"application/json" fileName:[NSString stringWithFormat:#"%#.gfp", objectName.stringThing]];
I've tried changing the application/json to something like a little more broad like text/plain but then it morphs into a .txt file when transferred to a computer.

Decrypting .plist file that was encrypted on device?

I am trying to diagnose a problem with an unsupported app. This app has encrypted it's .plist file (which hopefully contains the information that I need.) I have the file system of the device backed up and accessible but have not been able to gain access to this specific applications files. Does anyone have any tips on how I can try to go about this?
(Just to be clear, I do understand the difference between a binary and an xml .plist file. I suspect that this is a binary file that has been encrypted.)
If the file is truly encrypted, you will not decrypt is without finding the key.
Going off the assumption that the file is not actually encrypted, you should try to find what format and encoding it is. Do a hex dump of the file and look at the first few characters. Many file tropes have specific signatures there to identify their format and encoding.

Resources