[Tutor] Saving read-only or encoded text files?
waynejwerner at gmail.com
Fri Nov 18 18:16:07 CET 2011
On Fri, Nov 18, 2011 at 11:17 AM, Max gmail <maxskywalker1 at gmail.com> wrote:
> Thank you. This will work perfectly.
> On Nov 18, 2011, at 11:58 AM, Prasad, Ramit wrote:
> > Any file will eventually be able to be reverse engineered, but it
> matters how much effort you care to obfuscate it. The way you can do it
> will vary based on your OS.
> > For Windows, you can change the file extension to something that is not
> read by most text editors '.zxy'. It will still be able to be read if they
> try and open it with a text editor, but double clicking will not work by
> default. You can also try setting the file attribute directly:
> > For *nix/OS X, you can prepend the file with "." as those files are
> hidden by default on most *nix systems I have used. You can also try to use
> os.chmod(0###, 'filename').
> > Keep in mind that all of these solutions are probably user reversible
> since the application will have the permissions of the user account it is
> run as; in most cases this is the same as the logged in user.
As an addition, you can also create the file using the zipfile module (
http://docs.python.org/library/zipfile.html). This adds another layer of
obfuscation and has the added benefit of making your files smaller. Of
course, the savvy user won't have any issue getting past this (Office files
are just archive files). On Ubuntu at least, if you just remove the
extension then it will attempt to discover what the filetype, and can
usually guess archive types.
It's security through obscurity, of course, so it all depends on who you're
worried about accessing this data.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor