Sometimes it is enough to remove comments from your PHP code to make it not worth stealing, as a potential violator will spend more time figuring out what did you mean by all that, than writing his own version of the software to do the same job.
This very simple solution, based on an example in a forum here, does that for all files in the directory and its subdirectories.
find . -type f -name '*.php' | while read VAR; \
do mv $VAR "$VAR-old"; php -wq "$VAR-old" > $VAR ; \
unlink "$VAR-old"; done
Unlike obfuscators, it does not mess with your actual code.
The php options engaged here are:
-w Output source with stripped comments and whitespace
-q Quiet-mode. Suppress HTTP header output (CGI only).
So you write some software in PHP and are about to upload it to the server. But what if the server is not secure, what if it gets compromised, what if somebody steals your intellectual property? There may be situations where you are really concerned about it.
In most situations the best practical solution is to simply obfuscate your code, by making it unreadable to humans. It can still get stolen and used as it is, but it is very hard to practically impossible to restore the logic behind the code. And that is sufficient in most situations.
Quite good tool for that is YAK Pro. It works really well for small projects. As your project gets big and complicated, it begins to mess up the code, which makes the output unusable. But for small projects it is just fine. See for yourself, if you can make use of it.
The easiest way to install it is to use git.
1) Go to the directory where you want to have the obfuscator directory created, then type:
git clone https://github.com/pk-fr/yakpro-po.git
2) Change into the newly created directory and again type:
git clone –branch=1.x https://github.com/nikic/PHP-Parser.git
NOTE: It is “branch” with two dashes “-” before it, WordPress may mess up the text formatting.
Afterwards you may test it in action.
You may experience a weird problem, when you attempt to embed base64 encoded TTF font file in a Web page with CSS @font-face and the font just does not work. You try decompressing the base64 data, and get perfectly valid TTF file. Everything is fine, but nothing works.
Well, the problem is caused by line breaks in the base64 encoded data. It is said that those line breaks are there because once upon a time software could not handle long strings. Well, these days it is obviously the opposite. Web browsers seem unable to handle base64 data with line breaks SOMETIMES, because base64 encoded images work perfectly well even if there are the breaks. The fonts don’t though.
Whatever. Take your base64 encoded file and run this command on the command line:
tr -d "\n\r" < Font.base64 > Font-valid.base64
You can add album art images to your mp3 files. Use EasyTAG (GUI) or eyed3 (CLI) ID3 tag editors to accomplish that.
Example. Use eyed3 to remove any embedded images, then list options for embedded image file, then embed an image for an icon:
eyeD3 --remove-images test.mp3
eyeD3 --add-image=test.jpg:ICON test.mp3
You can copy symbolic links so that at the destination they show up as regular files. Just use -L option for the cp command.
This example copies all files from the current directory to directory ~/keys, and turns any symbolic links to regular files in the process (“dereferences” them):
cp -L * ~/keys
Use exiftran to losslessly rotate JPEG images. It preserves EXIF data while doing it. And it can even auto-rotate your images in accordance to the EXIF rotation data.
Example to losslessly autorotate all JPEG images in the current directory:
- exiftran -ai *.jpg*
Little known fact, that both .mht and .eml files are basically the same thing – plain text file, containing specially formatted HTML text with extra resources, e.g. images, added at the end of the file in base64 encoding.
You can freely change file extension from .mht to .eml and back, for it to be opened by default either by a web browser or an e-mail application.