How to hide the code of firefox extension - firefox

I made an IE toolbar by BHO with C#. And now I want to make a firefox version.
I planned to use xul but it will show the source code to the user.
Seems DLL is not a good way in firefox.
I tried some toolbar like yahoo, google which will not create files in extension folder.
How can I make something like that?

(please see my note about obfuscation below)
It might not be the optimal way to develop a Firefox extension, but you can absolutely build them using an external DLL.
Before Gecko 2.0 you had to use the rather esoteric Mozilla build toolchain to include compiled code in your extensions.
js-ctypes to the rescue:
https://developer.mozilla.org/en/js-ctypes/Using_js-ctypes
https://developer.mozilla.org/en/js-ctypes/js-ctypes_reference
js-ctypes makes very easy work of loading external DLLs and binding their APIs to JavaScript functions.
You'll need to compile a few different versions of your DLL, and have your JavaScript correctly detect the platform and load the appropriate DLL, but it basically works the same for all platforms once you're back in JavaScript land.
ctypes.libraryName helps you determine the extension the DLL has on the current platform (e.g: .dll for windows, .so for Unix).
You can use other information (e.g: navigator.userAgent) to more concretely determine which sub-platform (e.g: Windows 7 64bit, or Vista 32bit).
Update:
There are a whole bunch of good reasons to included compiled DLLs in your extensions/applications (e.g: speed, special capabilities, 3rd party libraries), but if your sole purpose is obfuscation (hiding source code), then...
I wouldn't worry about it were I you. Technological means of anti-piracy won't get you very far in this modern world - if your software is good enough to get attention, someone will crack it.
I'd simply forget about it, and spend a little money on lawyers instead. (Copyright: yay! Patents: nay!)

Related

Firefox add-on in C++

Firefox provides XPCOM API interface for writing add-on classes in C++ and allow third-party web applications to access them. I'm wondering - is there any other way of achieving these benefits (i.e. write an add-on in C++ and provide a JavaScript interface, so any JavaScript app can use this interface and eventually C++ class functionality)?
Yes, it is possible to write XPCOM components in C++ (or Javascript for that matter) and expose them to websites. You would register them in the JavaScript-global-property, JavaScript-global-constructor, etc. category or categories.
This stuff is generally not documented very well, if at all. If you'd like to know more about it, then read the code (e.g. on mxr).
But doing so is strongly discouraged for a lot of reasons:
It is very hard to ensure such things are actually secure and make it work reliable.
It is hard to control what website may actually use the new API. JavaScript-global-property and friends will be available to all websites!
Your add-on would be introducing new names into the global javascript namespace, which might clash with web site code. (Because of this, many new WebAPIs aren't introduced directly into the global namespace, but are made a property of navigator).
Due to these reasons, the addons.mozilla.org site will only accept add-ons using this mechanism as an exception to the rule and only when the author demonstrates that the use is required and without real alternatives.
MDN has a couple of articles regarding webpage-to-extension communication and vice versa you could use instead, e.g. "Interaction between privileged and non-privileged pages".
Also, it is discouraged to ship binary XPCOM components within extensions:
You'd need to re-compile your binaries against each Gecko version (every six weeks), because binary components are version tagged since Firefox 4.
Binary APIs/ABIs between (point) releases are not as stable as you would hope. Actually APIs/ABIs where inadvertently broken late in the game quite often, causing lots of unnecessary crashes for a lot of users, e.g. bug 828296.
The platform developers officially said binary components in extensions are a hassle.
Instead, you should try to use Javascript where possible, and/or create a normal binary library (.so, .dll, .dylib) with a C-API/ABI and use js-ctypes. You could implement your XPCOM components in javascript, which would then call into your library with js-ctypes.
AFAIK most add-ons switched to js-ctypes by now.

Winsock LSP vs API hooking

I need your advices what to use - Layered Service Provider or just load mine DLL in all
process and hook necessary functions using, NCodeHook or EasyHook library.
This is needed for inspection of HTTP traffic.
P.S. This need to be done for commercial application
Thanks!
Before making a decision you need to consider the following:
Code hooking:
AV doesn't like code hooking, if you're using a library that has external DLLs, run a check with AV total before committing to it.
Make sure the library's license works for you, for example, for LGPL you won't be able to embed the library as static without becoming GPL yourself.
I heard people managed to hook Metro apps, it's something to investigate.
If you have another code hooking app, it may conflict.
LSP:
The default MS sample/installer is broken.
You may get something working on a VM or fresh install, but to get LSP working properly across all OS and browsers, will take 6-12 months.
Will not work with Metro apps.
In Komodia we use a combo of LSP/WFP for our SDK, knowing what I know now, if I'd go back 4 years, I'd use LSP all over again.
Good luck.
Using Easyhook will be a nice way to do it check the following http://www.sghaida.com/easyhook-for-systemcall-hooking/

Quick and simple programming language

Is there someone that can suggest me a programming language that allows you to write quickly GUI programs (on windows platform)?
P.S. I am interested on only languages that do not rely on virtual machines and then have a compiler that produces executable code directly on the machine
I would go with AutoIT, it's a very easy to learn windows scripting language with tons of functionalities: http://www.autoitscript.com/autoit3/index.shtml
I'm using it to automate some tasks, but it can do way more than that.
EDIT
Just to make things a little bit clearer for everybody:
You can create new applications using AutoIT and the Aut2Exe compiler provided. The .exe files created are stand-alone, thus require no other files but the files that you might need in your app. Everything is free and the AutoIT scripting language has a BASIC-like syntax.
The GUI that you'll use are standard Windows controls. Among the functionalities you have the possibility to automate keystrokes/mouse movements, call the Windows API and external .dlls, manipulate windows and processes and through user created libraries (called UDFs) you can even acces local databases, manage networking tasks, encryption, archiving and many more.
All I can say is that it's worth take a look and the first app I built with AutoIT was done in roughly 8 hours since I started learning. It took a folder as the source and copied everything in a chosen directory, copying files in folders named as the date when the files were created. So the destination directory would have a series of subfolders like:
11.11.2010
whatever.txt
whatever.png
12.11.2010
archive.zip
and so on. Just 8 hours and got me rid of a lot of effort ordering the files myself.
Any .NET will probably be what you're after.
Start with VB.NET which is now called Visual Basic CCYY eg (Visual Basic 2005, Visual Basic 2008, Visual Basic 2010).
If you want something not using .NET framework, you might as well go back to older version of VB and if you want something compilable that'd be like C++ with their MFC (Microsoft Foundation Class).
You need to give more info on the type of gui and what you're using it for. This could be accomplished with Microsoft Access forms and VBA, or you could make an HTML Application (.hta).
I'll put in a vote for Delphi. You can easily write applications by dragging and dropping components on to a form and doing minimal coding in Pascal, which isn't hard to learn. Later, if you decide to go deeper, you can do pretty much whatever you want. And it compiles to native executable code.
Is an executable bundler, that combines the script with the framework/interpreter, good enough?
If so, you might look at Tcl/Tk or Lua.
http://www.powerbasic.com/
http://www.powerbasic.com/aboutpb.asp
Seems like it has a RAD GUI and of course it's BASIC, plus it compiles down to .exe (as I understand it.) Might be worth checking out.
A 'quick and simple' language will only allow you to do 'quick and simple' things - and for those, having a VM or not wont make much of a difference to you.
For quick and simple & native code, about all I can think of is RealBasic. Its cross platform Windows/Mac/Linux. I find their IDE to be difficult to work with due to its inflexibility and the help system last I looked wasnt that great, but the underlying language isnt bad and does compile to native code. So it might do the trick for you.

How to determine development tools used to make a Windows application?

I've got a working proprietary application (windows exe) and would like to know which particular toolkit was used to make it. The reason is that I like the widgets it uses and seek to use same library in my project (to buy it if it's proprietary as well).
Just use Process Explorer to see what DLLs the application has loaded. That will be your widget set. Sort the results by folder to roughly group them by manufacturer. You may need to examine the properties of the DLLs for more detailed info as well.
If the library is statically linked you may have to do some deep looking around, maybe you'll get lucky and find a string saying the name of the library or a class/function in it. You can use OllyDbg for this to view strings loaded at runtime, or something like the linux command strings to look through statically, although that wont work if the program decodes itself at startup. If that doesn't work, you'd have to come up with a list of libraries that do what the one you are looking at does, and find some artifacts in the binary that are common between the two. Anyways, better to check the dlls first like Paul Sasik said.
You can use PEiD to identify the compiler, which can be a hint aswel. PEiD also has a nice process explorer.
For instance, Google Chrome uses C:\WINDOWS\SYSTEM32\IEFRAME.DLL :-) Nice isn't it?
(Don't trust it 100%. For instance, my own compiler has the "Morphine 1.2 - 1.3 -> rootkit" description, which I find quite awkward: that's a packer/compiler trace obfuscator.)

Programming language for GUI compilable to native binary

I need to write an app that reads a config file with info on the menu bars it needs to create.
Normally, I'd just use java, but I need the application to have the least run-time dependencies possible, this includes not forcing the user to download anything, even JRE, let alone something like NET Framework.
So I need something that can compile to an EXE (windows only for now), and that will allow me to CODE the GUI, so I can dynamically create it from my config.
BTW: something like C++ is a bit too low level, all I need is to create menus, and display HTMLs in a panel.
How about wxPython together with py2exe?
There is a nice tutorial on how to do it here.
If Java's too high-level and C++ too low-level, there ins't much in-between. Maybe Delphi?
I wouldn't totally write off using Java and/or Python for a few reasons.
1) py2exe can compile your Python code to an exe.
2) GCJ can compile your Java code to an exe.
Delphi is best chose for you. Because Delphi compile source code into native x86.
Unless you have serious reasons to avoid interpreted languages, I would suggest you better look into ways of packaging or compiling interpreted scripts because doing this will likely reduce your learning and development time.
I would write a simple GUI in Tcl/Tk, and then package it as a Starpack.
ActiveState provides a distribution (ActiveTCL) and a decent editor (Komodo Edit), and it is fairly easy to get simple GUIs going with Tk. Check out TkDocs for some hand holding.
Once you're done, you can package your code, a Tcl runtime, a database, and a virtual filesystem, all into a single executable that you can easily distribute.
Earwicker is right. You can use HTA:
http://www.interclasse.com/scripts/htanotepad.php
But if you know C++, then creating this type of an application is actually very easy with Visual C++. Use MFC, and statically link everything. You can draw the menu in the resource editor, and attach events to the menu items. I wouldn't use HTML if I were you. Just use regular Windows controls. But if you're really set on using HTML, you can embed a Browser control in the formview.
Have you considered D ? It has a syntax that is like a mixture of Java, C++ and Python with the ability to make native windows apps. The tutorials on dprogramming.com are great to get up and going with the language. For quick GUIs you'd be interested in The D Forms Library and the Entice Designer.
Here are some short video tutorials to get up and running with Entice.
Alternatively, have you tried Qt & Qt Creator? It takes a lot of the hair pulling out of C++ Programming and it's also cross-platform.
You say:
all I need is to create menus, and
display HTMLs in a panel.
A lot like a Web browser, then. If it's going to run on Windows, then the user has IE. Why not use IE to do all the work for you?
You can make something a lot like an .exe with IE, called an .hta:
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx

Resources