I create disk encrypt in mac OS X ML 10.8 (use Disk utiliti or use command hdiutil ). I want read file in that disk, but I can't mount it. Because when I mount it, another app can read it before I unmount. Please help me.(hdiutil command here http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/hdiutil.1.htm
To do this you would have to read and decrypt the dmg file yourself and then interpret the HFS file system inside the disk image to get at your file. It's not easy but certainly possible. Take a look at the HFSExplorer source code.
But I wouldn't put too much energy into this. Either use a different file format that is easier to read to store your encrypted data, or go with pajps solution. And remember, no matter what you do, once you decrypt your file the user will be able to get to the decrypted data. You can make this harder, but you can't prevent it.
I think the only reasonable way would be to mount the disk image. To do it securely, you can use the -mountrandom and -nobrowse options to hdiutil attach. This will mount the disk image in a randomized path name, and prevent it from being visible in the UI.
hdiutil attach -mountrandom /tmp -nobrowse /tmp/secret_image.dmg
Assuming the disk image has one and exactly one HFS partition, you can parse the randomized mount path like this:
hdiutil attach -mountrandom /tmp -nobrowse /tmp/secret.dmg | awk '$2 = /Apple_HFS/ { print $3 }'
Or you can use the -plist option to get the output in plist XML format that can be parsed using XML tools or converted to json using plutil -convert json.
Of course, an attacker that has root access can still monitor for new mounts and intercept your disk image before you have the chance to unmount it, but if your attacker has root than pretty much all bets are off.
Related
I have a function that generates a PDF file and i want to get the Uri's of the file to stoke it locally and then send it as an attachment with MailComposer. I want to know what's the difference between readAsStringAsync() and writeAsStringAsync() in FileSystem?
Both readAsStringAsync() and writeAsStringAsync() are functions of Expo FileSystem.
But the difference is readAsStringAsync() used to read a local files of the device. While writeAsStringAsync() is used to write onto a local file or create a file (if the named file does not exist on the location)
According to Expo Documentation documentation
FileSystem.writeAsStringAsync:
"Write the entire contents of a file as a string."
FileSystem.readAsStringAsync:
"Read the entire contents of a file as a string. Binary will be returned in raw format, you will need to append data:image/png;base64, to use it as Base64."
The sequence of events that I'm trying to make happen in Meteor is:
On the client browser, upload a zip file and send it to the server
On the server, receive the zip file and hold it in a memory object
Unzip the memory object into individual objects representing the contents
Process the individual files one at a time
Return success/failure status to the client
I have steps 1 and 2 working, using EJSON to stringify the contents of the zip file on the client and again to convert it back to its original form on the server. The problem I'm encountering is when I try to unzip the object on the server. It seems that every unzip library available wants to operate directly on a file or stream, not on a memory object.
I suppose I could write the object to disk and read it back again, but that seems like an unnecessary step. Is there a library available to unzip a memory object? Alternatively, is there a way to create a stream directly from the object that I can then feed to the unzip routine?
Any advice would be greatly appreciated.
You could use the unzip module from npm. It accepts streaming input and allows you to process output without saving to disk.
It will take some work to wrap it to work with meteor. Your two options are the meteorhacks:npm package or upgrading to the Meteor 1.3 beta.
Trying to set up a simple backup solution for my wife's computer. Have a volume on my server upstairs mounted locally using OSX automount, so it should just be a simple
rsync -a sourceDir targetDir
When I look at the files it syncs over though, all metadata is lost on jpg files. The created date is preserved on the file and the modified date ends up being the timestamp when the rsync runs, but I can't imagine why EXIF data (Device, exposure etc) would disappear when it should just be a straight file copy. Hoping someone has run into this before and can shed some light on it.
This can't be a rsync problem, there should be something else going on. rsync just does a binary copy from source to destination, the most probable explanation is a simple user error (e.g. you copied from the wrong source directory, source files where already without EXIF data, and so on).
For normal copies on reliable hardware, rsync is without doubt the best tool for the job, especially considering the huge amount of filesystems it has to cope with.
There are some corner cases where rsync may not behave as it should, at least with default parameters. For example, right now I'm investigating on an issue where, copying to a "not-so-reliable" USB drive, rsync continued to copy happily even when the drive disconnected from USB and the device disappeared.
I have a script file. Unfortunately I've overridden it with some other data. I need the old data. crtl+Z is not working.
How do I recover it?
unfortunately some editors are not supporting of crtl + Z so only not able to recover the data..
are you using file versioning? what OS, what version?
What is the File structure? NTFS?
if you overwrite a file in NTFS it tends to delete the first file and put in the second, not systematically destroy the file (so you can recover the file with an undelete utility.
first, rename the current file, then open an undelete utility (you don't want to download anything to this computer as you may overwrite the file.)
run it from a memory stick.
the safest thing to do if it's critical is to image the device off to a donor scratch media and work from there.
I'm working with a GPS module that is transferring data to my mac over a serial RS232-to-USB interface. I've written a objC program that takes the raw data and converts it into meaningful information.
Using a program called goSerial, I'm able to log all incoming data into a text file. I have been able to make my program read the text file and process data line by line.
I would like this procedure to happen in real time i.e. as soon as the data is received, it gets logged into the text file and my program reads it. The first part of this happens automatically that is the text file is being constantly appended (when not open). Is it possible to monitor a text file for appended data and only read new lines? Also, will doing this affect the ability of new incoming data to be saved?
Thanks!!!
(Also, if anyone knows how I may send serial data directly to Xcode, please let me know!)
I'm not sure how the serial-to-USB affects things but traditionally, unix accesses serial devices using the Device-File Mechanism which treats the input from the device as a file to be read. You would use NSFileHandle to read the file from Cocoa/Foundation. You probably want to checkout the IORegistryExplorer app to see how your device shows up.
You can use a kqueue (perhaps with a wrapper such as UKKQueue) to watch the file for changes.
You should be able to create a unix domain socket, which you can then have your goSerial application open (as it looks like a normal file on the fs)
And then read from the other end, linewise in your application. This is probably the easiest way, or alternately have a look at the source of tail in GNU's coreutils, specifically it's -f function (although thinking more you'll probably want to look at how the FreeBSD implementation works, as I believe that the GNU version uses some linux specific callback)