Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obfuscating Source Code 1

Status
Not open for further replies.

AdmanOK

MIS
Joined
Mar 5, 2001
Messages
412
Several years ago I used a utility, which I believe was provided by Microsoft, to obfuscate the VBScript portions of my ASP files. While I know that it is a very poor method of securing an application it does provide some low level of defense against people snooping around the source code. I tried searching for something like this on Google this evening, however everything I found was a commercial product with a price tag involved. Is there anything available today for free to do this?
 
To further muddy your code you could try using conditional statments to do includes where possible.

For example, in an If Then depending on the result of the evaluation then you could use an include for the code that handles that statement.

I have not tested this but I think it would work.
The result is that no viewing of your code would show ALL of the code, only the code that was dynamically loaded at that time based on the codes evaluation. It would make it difficult as hell to get anything working by doing a View/Source.

Remember though, all of this makes working on and supporting your code much more difficult down the road.
 
Since includes are handled server side, and View/Source is done client side after all the ASP scripting is processed, that wouldn't accomplish anything that AdmanOK wants.

Lee
 
If you do something like this:
<%
If MyVal = 3 Then
%> <!--#include file="myfile.inc"--> <%
Else
%> <!--#include file="myotherfile.inc"--> <%
End If
%>

Now suppose the value of MyVal was other than 3, would the script load the content of myfile.inc anyway? Or would it only load the content of myotherfile.inc?

If it only processes one include statement as a result of the If Then statement then a View/Source will only show code relevant to how the script executed and not the entire application.

In a relatively sophisticated application you would not be able to figure out much of anything based on the results of View/Source with this method especially if you used that code obfuscator as well. All you would get was the basic logic tests and the code that responded in that situation.
Embed that within your HTML and the amount of effort required by anyone to put together a full copy of your code would be tremendous.

 
I think AdmanOK is trying to make the source difficult to copy for someone that has direct access to the server console... not so much from the user's View Source side.




would the script load the content of myfile.inc anyway? Or would it only load the content of myotherfile.inc?

The ASP processor does the includes before it does the actual code logic... you can see this if you put any raw HTML into the include files.
 
Oh, right.
I have used Javascript for doing conditional includes but I guess that would make sense because of the order the code is processed.

Well, time to compile your code in a DLL. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top