ActionScript how to compile .as to binary machine readable format - compilation

I am looking for an option for converting my .as ActionScript3 files to binary format before distribution. I tried mxmlc and compc but both are converting source to bytecode which is reversible. Is there any way to hide your source code completely?
thanks in advance
BB23850

As Flash Players can only read bytecodes, but not binary machine code, it is obvious you won't be able to do so. But there are other means of obfuscating your code from getting decoded easily.
If your target is to create stand-alone executable files, then consider SWFKit Pro or similar application. SWFKit store swf as encrypted file, only decrypt when required.

Related

Library to read, generate or validate protocol buffer spec?

What's a smart way to generate and validate a protocol buffer spec? Is there any library (binding?) for the protoc file format, maybe java or python?
Just to be clear, I know that after my code generates a protocol buffer specification it will be fed to protoc for generating language-specific binding code. It's straightforward for me to invoke protoc to validate a generated spec (just check exit code etc.), but I thought maybe there's a better way.
The only vaguely related thing I could find is Cannot parse a protocol buffers file in python when using the correct .proto file
Thanks in advance.
I would probably just invoke the protoc binary and check the exit code, because that command line interface is likely to be more stable across versions than a library interface.
However, all the relevant functionality is available in libprotoc.so. As a starting point, you can see the protoc main program here, which is beautifully short: https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/main.cc
I expect you could pretty much copy that to your own project and link against libprotoc.so.

Using rtags for indexing firefox source code

I am using rtags which is a C++ source code indexer based on clang. I have been able to play around with it and now I want to actually index the firefox source code. I am pretty new to this stuff and this tool uses cmake to generate a compile_commands.json file to pass over to the program that indexes code.
Is there a way I can generate a the compile_commands.json file for the firefox source code that provides the exact compilation line for each translation unit inside the firefox source?
You can generate compile_commands.json by
mozilla_cnetral/mach build-backend -b CompileDB
In my environment(Ubuntu 16.04), it was created at mozilla_cnetral/obj-x86_64-pc-linux-gnu/.
Reference:
https://developer.mozilla.org/en-US/docs/Developer_Guide/Editor_Configuration#rtags_(LLVMClang-based_Code_Indexing)
Not sure if I follow the part "Is there a way I can generate a the compile_commands.json file for the firefox source code that provides the exact compilation line for each translation unit inside the firefox source?". But I can offer simply that you can generate a compile_commands.json file from a make-based system using the bear utility (which I obtained from my package manager: brew). After a make clean, I do 'bear --append make' and it traces the make build process and produces the compile_commands.json. More can be learned here: https://vxlabs.com/2016/04/11/step-by-step-guide-to-c-navigation-and-completion-with-emacs-and-the-clang-based-rtags/
As the article referenced implies, my motivation was to be able to use the wonderful rtag system inside Emacs. Hope this helps a bit.

Python/C API: Statically-Linked Extensions?

I've been writing a Python extension use the Python/C API to read data out of a .ROOT file and store it in a list of custom objects. The extension itself works just fine, however when I tried to use it on a different machine I ran into some problems.
The code depends upon several libraries written for the ROOT data manipulation program. The compiler is linking these libraries dynamically, which means I cannot use my extension on a machine that does not have ROOT installed.
Is there a set of flags that I can add to my compilation commands to make these libraries statically linked? Obviously this would make the file size much larger but that isn't much of an issue providing that the code runs at the same speed.
I did think about collating all of the ROOT libraries that I need into an 'archive' file. I'm not too familiar with this so I don't know if that's a good idea or not.
Any advice would be great, I've never really dealt with the static/dynamic library issue before.
Thanks, Sean.

Creating smallest DLL file

I have created a DLL file (library) with one assembler function. This file is 75kB size. How to make this file smaller? Like I suspect, there is an automatically included System unit. Can I exclude this unit from my dll file?
I googled your Issue, as it came to my mind in Visual C++ there are Debug&Release Modes.
So maybe you can try creating a smaller Dll using the Release Mode. I found some settings for this: http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=18632
Maybe this helps you, but I'm not sure it will work because I didn't work with Pascal for like 2 years :)
Why? are you concerned about binary sizes on one hand, and have a 64-bit tag on the other?
Debug info, pass -Xs to strip debuginfo
Smartlinking, pass -XX (dead code elimination) 1+2 combines to -XXs
Avoid advanced functionality. Do NOT set any $Mode, the delphi compatible additions to system will bulk it up.
If you want to further reduce you will have to edit the RTL source and recompile it.
You can also try UPX to pack your DLL-s. I recently made a simple DLL in Delphi and here are some observations I made:
1) Delphi 7 made almost 2 times smaller file than Delphi XE3 (32bit, Release mode). Lazarus made the biggest file. So maybe older FPC can make smaller file?
2) I stripped all non-mine units from the library. I even replaced Math and Windows with my own, super-short versions. This reduced the file size about twice.
3) System unit is something you can't just remove, but there are ways to create your own, recompile and replace. I guess this is also possible with Lazarus/FPC.

In Ruby, what's the equivalent of Java's technique of limiting access to source in a cowork situation?

In Java when you compile a .java file which defines a class, it creates a .class file. If you provide these class files to your coworkers then they cannot modify your source. You can also bundle all of these class files into a jar file to package it up more neatly and distribute it as a single library.
Does Ruby have any features like these when you want to share your functionality with your coworkers but you don't want them to be able to modify the source (unless they ask you for the actual .rb source file and tell you that they want to change it)?
I believe the feature you are looking for is called "trust" (and a source code control repository). Ruby isn't compiled in the same way that Java is, so no you can't do this.
I have to say your are in a rough position, not wanting to share code with a coworker. However, given that this is an unassailable constraint perhaps you could change the nature of the problem.
If you have a coworker that needs access to some service provided by a library of yours, perhaps you could expose it by providing a web/rest service instead of as a .rb file.
This way you can hide your code behind a web server, and if there is a network architecture that allows for low latency making these service calls, you can effectively achive the same goal.
Trust is a lot easier though.
edit:
Just saw this on HN: http://blog.astrails.com/2009/5/12/ruby-http-require, allows a ruby file to include another file through http instead of the filesystem.
Ruby is
A dynamic, interpreted, open source programming language with a focus on simplicity and productivity.
So like all interpreted languages, you need to give the source code to anyone who want's to execute your program/script.
By the way searching "compiled ruby" on google returned quiet a few results.
I don't think there is one. Ruby is purely an interpreted language, which means ruby interprets your source code directly in order to run it. Java is compiled, so there's an intermediate bytecode (the .class). You can obfuscate your ruby if you really wish, but it's probably more trouble than it's worth.
Just to make sure you realize, however, upwards of 95% of Java can be decompiled back into source using various free utilities, so in reality, Java's compilation isn't much better than distributing Ruby source.
This is not a language specific problem and one that can be managed more effectively through source control software.
There is a library called ruby2c that compiles a subset of Ruby into C code (which you can then compile into native code, if you want).
It was actually originally written as a Ruby code obfuscator (but has since been used for lots of other stuff, including Ruby Arduino development).

Resources