I decompiled the dll that my app creates for publishing it and found out, that everything is easy to read. The app is not rocket science but I'd like to hide some things, e. g. there are constants that are called productionHourlyRate what no one should know.
I know, there are obfuscation softwares but they are expensive.
An easy way would be to rename all variables and methods before publication, e. g. productionHourlyRate -> v1. Is there a built in possibility to do (and undo) this in Visual Studio 2022. Of course, I could rename them one by one but this is not very comfortable.
Or: Is there a free obfuscator that makes dlls undecompilable? No matter which tool I read about, I always find comments like "I decompiled the obfuscated dll with xyz and received the whole source code.".
Many thanks, Philipp
Edit: It is a C#/.Net app (Blazor WebAssembly)
Since there was no answer to this question, there is probably no Visual Studio built in solution.
So, I created an Excel tool that renames alle class, method and variable names in the specified files. Please find it here.
Important:
Make sure, you run this obuscator only when using a version control tool. You CANNOT undo the obfuscation with this Excel tool.
Usage
Add file paths in worksheet "files".
Run macro "Obfuscate" to obfuscate class, method and variable names with "v1", "v2"…
Publish your app.
Undo the changes with your version control tool.
Once all files are manually listed, the obfuscation should only take a few seconds.
Related
Is there anyway within Visual Studio / TFS to identify which project produces which dll?
I'm aware you can look under a particular project's properties and see what the name of the dll is, but in the circumstance where you have loads and loads of projects this doesn't seem very efficient.
I've got the situation where I've got a project that references a dll, which includes a method I want to examine, but I don't know what project produces this dll.
Unfortunately, no. The only way I know is that you may could use a decompile extension. (Strongly not recommend to use) Through the source code after decompile, you can view namespace and judge which project produces the dll. (Under normal circumstances)
And you may also have to face some problems such as:
Legal issues
Need to pay for the extension
Only work for C#/.Net
The source code may be confusion and not standard
This should be a one time activity, you can go ahead and take a look into the project file, in case of C# project the csproj file.
If you do not want to do it opening each file, then i would say write a small tool to read all the project files and look for the name.
BTW, this will be different for different projects, and you need to find out the proper location to look.
I'm currently trying to make a download/install file for a CD, and I've never done this or written any type of coding before so I'm somewhat at a loss. When we last created an installer package (I wasn't employed yet) we used InstalShield, but that was decades ago, and we can't afford the 500$+ price to get it again.
Currently I'm trying to work off the old download package we have. There is the Windows Installer Package (made by InstalShield) called CD Cat v6.msi, and then another file called CDcatv6.exe (which launches a window for the customer to browse options) and then a file called Data.cab which has all the files for the entire catalog in it.
I was thinking perhaps I can just replace a lot of those files with the current information. Replace the CDcatv6.exe file with my v7.exe file (but change the name so its CDcatv6.exe) and then replace all the files in the Data.cab file with the current ones. But that's turning out to be a huge issue.
I did a bit of searching to learn what a .cab file was, and downloaded the Cab File Maker 2.0 (after quite a bit of searching!). I'm having a difficult time using it though, as it wants all the files that I put in it to make the .cab to be in .ddf format. I have no idea what that is, much less how to make it. I tried using 'save as' to do it, but since all the files I need are PDF's there's no option for it and I cant export the files to it either.
I tried looking at other ways that people made Cab files, but I don't know many of the file types or programs their talking about. I'm not a programmer by any means, but I have to learn quick I guess, so any information on how to do this will help greatly. Is it even possible to replace all the files seamlessly and have it work properly? Or is there an easier way to create a fill that the customer can click on and have it download to their desktop?
I don't think simple editing of Data.cab will work. There is installer logic stored in other InstallShield files. It could work if and only if the file set is the same, I mean no files changed its names, no new files added, no new registry entries required etc.
To create a CAB file, use cabarc.exe from Microsoft Windows SDK.
Creating a brand new installer may be a better option. Look at this tools for creating installers:
Advanced Installer
NSIS
WiX toolset (with tutorial)
You best solution is to use dark.exe (part of the WiX toolset).
This will enable to you decompile the MSI and CAB files, edit the installer source as XML and then recompile this into a new executable. Unfortunately this route is not for the faint of heart and what you save on price will cost you in time.
I'm curious how your company created an MSI decades ago, but Sasha is right about time and money trade-offs. However if you're working with Visual Studio, you might try the InstallShield Limited Edition for Visual Studio. It may have enough capabilities to suit your needs.
Thanks for pointing to CABARC, that looks exactly what i was looking for, due to information on:
https://learn.microsoft.com/en-us/previous-versions/bb417343(v=msdn.10)?redirectedfrom=MSDN#top
That make me look how to download it, but i found this post:
Where can I get the cabarc utility?
Where it explains CABARC may be obsolete and there is another utility called MAKECAB that cames with Windows 11, i had try it at command line and it is there.
Thanks a lot.
In most .NET project I can use folder to organise the code files. In C++, I can't, but filters end up playing the same role. However, in F# with Visual Studio 2010, I can't. Every code file is shown directly in the project dir. Why is this feature not available?
And what is the optimal strategy for organizing a project with a lot of files?
Actually, you can add folders to F# projects but it's not supported directly through Visual Studio (you have to edit the project file yourself): http://fsprojectextender.codeplex.com/ (edit: old link was broken, updated to F# Project Extender home page which has links to the original blog posts which were moved) (which I found in this answer).
I do this myself, but it is cumbersome and you end up avoiding it until keeping sanity really demands it. I think the feature simply slipped, or perhaps there wasn't as much a culture for folder organization with the F# designers in the first place. You can see in the F# source code that they favor huge source files with no directories, with separate projects as an organization boundary.
I imagine the F# project template could be modified to support this, and it is certainly something I'd like to see happen. At the same time the linear compilation order F# enforces causes your code to be somewhat self-organized, and so folder grouping plays a less significant role.
Manually editing the .fsproj file as described in Stephen's answer is one option (and I used it when I wanted to organize one larger project).
However, you have to be a bit careful and I think you cannot add new files to the folders (creating a file by hand and then adding an existing file works). However, if you like to keep things organized (like I do), then it should work for you.
Additionally, there is also a tool called F# Project Extender that should make things a bit easier for you . I have not tried it yet, but it looks like it supports adding folders (and perhaps other useful things). See for example this blog post by the project author.
I've been looking into obfuscation software, but wondered if one could do it easily with a macro.
If you go into the class diagram in visual studio 2010, you can easily click on class names, properties, fields, etc, and rename them from something meaningful to a, aa, aaa, abc, whatever.
In a really small project, this would be really easy, but not so in larger projects. Could one just write a macro that looped through the set of classes, field, properties, etc. in the class diagram, and renamed them.
I couldn't immediately figure out how (given I haven't written any macros in studio).
Any direction would be helpful. I'm happy to post the final macro code.
Thanks!
Wayne.
Doing this via a macro does not guarantee correctness - many times, VS fails to rename a class/method- what would happen in that case?
Also, "writing" a macro" sounds simple to the ears, but you are essential writing a complete obfuscator - you must decide what you must rename classes/methods to, avoid conflicts, take care of special cases like virtual methods, exclude some classes/methods, and countless other rules.
You are much better off using an obfuscator. Try Crypto Obfuscator.
Any reason why you'd go with a macro instead of Dotfuscator? It's free in VS2010, and has more features with a commercial license.
If you wanted simply to push a button and have your sourcecode obfuscated on-the-fly, you could write a macro. Dotfuscator commercial does boast "Visual Studio Integration".
Suppose you release the next version of your software, you will have to manually update your WIX files to remove obsolete files and add new files, etc.
My use case is as simple as "recursively add the files under /sample/path in the user target C:\Program Files\MyApp".
Is there a program that does this sort of automation?
For WiX v3 (and a free solution), look at heat.exe. If you have more advanced harvesting needs, there is a commercial option from FireGiant**.
** Disclaimer: I am the benevolent dictator of the WiX Toolset and CEO of FireGiant. We contribute to the open source project and provide commercial solutions around the project. Pick what works best for you.
If Heat doesn't meet your needs, you may want to look at Paraffin by John Robbins.
For Wix 2 there was a tool called Mallow that did this. It was freeware and I got the source somewhere. This functionality may also be available in Heat.exe at this point, but I am not sure.
It also seems some guys in the Wix community are experimenting with a sort of automatic scanner feature where you can put files in a pre-defined release location and new msi files are continually created - ala "continuous integration".
Are you looking to do this for a lot of packages, or just for one or a few ones? Let me know the scope and I can send you the Mallow code, or dig up links for the "continuous integration" oriented solutions.
You can use heat.exe as Rob stated already (i think he knows since he is the man behind), or you can write a simple harvester script, that evaluate the wix-script as pre-compile action of the wix-project. We used a vbscript for that since heat did not suit our problems, cause of different files, different directories, etc.
WixEdit has an import folder function that can grab the entire contents of a folder and turn it into Directory/Component/File nodes.