Obfuscating c# code not the assembly [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Is there a way to obfuscate c# code (visual studio solution ) so that if soem one even get the project could not understand it ?
note: I'm not talking bout obfuscating assembly/Executable here..

I've not seen anything commercially, but you could probably write your own application to do this. I actually know someone once did this for some ASPX pages that were being deployed.
You'd have to take similar steps:
Rename all local variables to very similar names B___0, B_0 etc.
Rename all internal and private methods/classes and all their references.
Encode all your strings.
Insert random code/calls that don't do anything.
Consider why you want this though... It means:
You can't ever view your own code. You'll have the original somewhere - why not just password protect it?
You're going to screw with any source control you're running.
You're going to have some crazy "process my entire solution" everytime you save/publish it?
In short it's probably not a good idea, which is why you probably can't find a commercial solution.

Close the door and windows tight.
Disconnect your computer from Internet during the developement.
Obfuscate your assemblies when your done.
Save them a a disk.
Burn down your computer.
Keep hitting your head onto a wall until you fergot why you're doing it.
There, you're safe, nobody will ever have the same exact source.
I hope your application has no bug, though.

A more sensible alternative might be to just encrypt your hard drive using something like
BitLocker or
TrueCrypt.

Obfuscate the dll
Use a decompiler like ILSpy and decompile the dll
This way you get obfuscated C# code.

Related

How do C# Programmers effectively use "using ___;"? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm a beginner C# developer and I'm branching out into looking at certain parts of what some more advanced bits of code. However, I cannot wrap my head around how developers and programmers use the "using" commands effectively. I understand how they work, and if they are a public class file they can have their methods accessed, but how do programmers know from picking up an API how to use it?
Sorry if this question seems like a total breeze and as though I've misunderstood the concept entirely (maybe I have, haha) but it seems like something where without extensively going through the API and it's documentation, most people can chew through these things quite easily.
First of all, not sure if you are aware of not, but the using directive does not actually "import" or start "using" anything. using System; merely tells the compiler that whenever you use something like DateTime, it will check System.DateTime and try to look for the type there. In fact, you can write in C# without using the using directive at all (unless you need to resolve a naming conflict), but of course the program will become unnecessarily "wordy".
As for the other part of your question, you don't begin writing a C# program starting with using. You first have to find the proper "tools" (classes) for the problem you are trying to solve by the program, and only then add using so that you can work with them efficiently without typing the namespace over and over. Moreover, most modern IDEs will add the directive automatically, either when you create a new file (adding some common namespaces), or when you use a class in a namespace that you forgot to import with using.

How can I obfuscate my c# code, so it can't be deobfuscated so easily? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I release a bunch of tools for free, but recently I have began to sell an application, that has private research, and people have been able to get my source code, and one person publically released my entire source. I spent a lot of time on this program, just to have someone crack it, and release my entire source.
How can I go about protecting my program? I have tried HWID, but people are still able to crack it. I know I am limited by C#, but it the most convenient to use. I just need a way to protect my programs from people trying to do this.
You could have a look at the many obfuscation tools that are out there, for example these:
http://gapotchenko.com/eazfuscator.net
http://orangeheap.blogspot.nl
http://confuser.codeplex.com (succeeded by https://yck1509.github.io/ConfuserEx/ and then again by https://github.com/XenocodeRCE/neo-ConfuserEx)
http://ntoolbox.com)
Well, the problem with languages like C#/Java is that they are generally much easier to de-obfuscate. The way to secure this is generally to put this stuff into a webservice, but you said you couldn't really do that. What about porting specific non-trivial functions over to a language like C, and obfuscate that. Your C# program could then use reflection to make calls to this external/unmanaged dll. It would increase the difficulty for de-obfuscating, but the problem is that if someone wants it bad enough, they can figure it out as it is client-side.
It may be that legal action is the only real solution here, but this is not a site for legal advice, and I am not qualified to give it if it were.
Additionally, this could be a business decision. Consider Making your software open-source and post a donation link. I am also not qualified to give business advice, but this is worth considering. It may actually increase your revenue, not to mention the other benefits that come with releasing open-source software.
There's Dotfuscator (http://www.preemptive.com/products/dotfuscator/overview). But the best solution in some cases is to offer what you do as a web site (Software as a Service).
Consider this tool for example to convert VB to C#: http://converter.telerik.com/
Or this tool to format JSON: http://jsonformatter.curiousconcept.com/
This may or may not work for you. I don't know what the nature of the software you're trying to protect is.
No, your code needs to contain the information needed to decrypt itself, its an impossible problem to solve.
Your best solution is to put your intellectual property on a server in the cloud that only you have access to. Give your customers a unique login, audit their access to check for abuse, off load as much grunt work onto your customers machines, but keep your algorithms locked into the cloud.

Protect ASP.NET application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Imagine, I create an application ASP.NET MVC for a customer. This application is running an a local server of my customer (I call it customer1). Is there a way to make this application impossible to run foranother customer if customer1 give application to customer2 ?
Thanks,
Why are you bothering and wasting your time with things like this? Make sure you license your code, probably obfuscate it, and sell it to a customer. If he violates the license agreement and gives it to someone else that's his problem. Sue their asses and that's it, end of the story. But remember that no matter what you do they will find a way :-)
So focus on delivering a good product and customers will come by themselves to you asking you to buy it.
You could hardcode in a check for the domain it's running on perhaps. Simple but crude.
I think adding some checking to application start is not a bad idea. checking Computer name and Mac address doesn't seem bad.
1- check in your code for a value placed in a file has an encrypted data.
this file generated on windows root or some root the customer1 not know it.
this file will generate in activating through online connection or by yourself.
in runtime read file and decrypt, you may read values for expired date, some configuration you want.
you may check for as friends said for computer name, ip address anything difference customer1 from customer2
2- also you need to protect dll files from decompilation methods
My Regards
It's a Web Application -- the easiest way is to host the application for your customer, that way they won't be able to get the source for it.
Most applications use business rules, naming conventions, assets, etc. that are unique to their business. Hard code those values into your app so that a shared app just doesn't apply to another customer.
Beyond that, you can look into a real copy-protection package like DeployLX, Infralution or Desaware.
Take a look at Rhino Licensing.
James Gregory wrote a nice post on how to get started with it.
Also the link to a post by Balsamiq in James' article is well worth a read.

How to convert AVI to 3gp in C#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Is it possible to convert an AVI file to 3gp in C# ? If so how could I do this? Any ideas will be appreciated, thanks in advance.
It depends what you mean by "convert". Both 3GP and AVI are wrapper formats, so are you merely trying to change the container format, or do you want to re-encode the streams as well?
Either way, you should probably take a look at ffmpeg (Windows info). For simple cases (i.e. you have the file, want a single output file), you should probably consider it invoking it on the command-line (i.e. System.Diagnostics.Process), which is much easier (and doesn't involve any licensing issues). If you want to access libavcodec/libavormat programatically, I highly recommend skipping any .NET wrapper libs (they all are in different states of sucking; Tao being the best but that's not saying much) and instead writing a C++/CLI wrapper. I started doing this, and once I got my head around data marshalling, etc., and figured out how to build it (Part 1, Part 2), it wasn't too hard.
There is no really easy way to do it; my advice is to use ffmpeg, either through the use of a C# wrapper of by calling it externally. There seem to be several C# wrappers for ffmpeg (like this one) but they all seem to be in various stages of development and not really usable. Your only option is likely going to be by calling it externally.

Get source from pre-compiled ASP.NET website? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Long story short, VSS decided I wasn't allowed to have some code changes. I am missing a decent sized feature that I don't want to have to re-write (gave to a co-op as work this past summer). It works great and does what the client wants. However... I don't have the machine and the machine it was developed on has since been paved low!
Do'h!
We published the site into a test environment straight from visual studio and then we copied the files into production. So I have the "compiled" files from the VS publish.
How can I go about getting that back into code? I am sure I can figure out which DLL it is in and I would assume that something like reflector is going to be my best bet? Are the original variable names retained?
I would use .NET reflector. Your original variable names will be preserved (providing you did not run any kind of obfuscator) if you have the PDB files as well as the DLLs.
I would suggest trying to reflect your compiled code and see how readable it comes out.
http://www.red-gate.com/products/reflector/
Reflector all the way. You can't rely on local variable names since they don't really exist (only fields retain their names), but having the matching pdb would go a long way to helping. If you use the pro/EAP version of reflector it will do must of the work for you (generating the full C# disassembly etc, so you don't have to go method-by-method or use a plugin).
You may still need to look at each directory separately, of course.
Best you are going to get is with a decompiler like this http://www.red-gate.com/products/reflector/. You are going to lose variable names and comments, but what you get will compile.
Sucks, but probably a lot better then starting from scratch.
I used Telerik's JustDecompile to get the source code back from a precompiled site. It's free and has done everything I've needed.
http://www.telerik.com/products/decompiler.aspx
Salamander - a .NET decompiler
http://www.remotesoft.com/salamander/index.html
I've never used this tool, but they talked about it on .NET rocks! a while back. http://www.dotnetrocks.com/default.aspx?showNum=194
I had the similar issue and used Reflector to Decompile it. I got the source code, then changed the bit I wanted, and rebuild it. Then I copied that dll again to Production site. It started to reflect my changes. It was very easy and not at all difficult, maybe because Precompiled site had dlls for every page, and was updatable , so had only code-behind file in dll.
For reference: http://www.reflector.net/

Categories