Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have an app. i dont have source code, i want to add auth system for this app.
is it possibe?
i found auth.gg, im opening my app with button click after pass login. but user shouldnt see app in folder. can i merge these?

What I have tried:

im opening my app with this code.
Process p = new Process();
p.StartInfo.FileName = Path.Combine(Application.StartupPath, "example.png");
p.Start();
Posted
Updated 29-Oct-20 0:41am
v2

1 solution

If you want to hide the application before the user has authenticated then you may need to look at embedding it as a resource within your application. What should happen is the compiler will bundle the separate executable into your own application, and then later you can authenticate the user and then extract the executable for running.

It's worth noting that at some point you will need to extract the executable to the file system.

windows - Embedding an external executable inside a C# program - Stack Overflow[^]
 
Share this answer
 
Comments
helen thomas 29-Oct-20 8:00am    
is it possible to use this trick without extract?
if i understand wrong fix me but if i extract file user can access app without auth right?
Chris Copeland 29-Oct-20 11:05am    
Correct, if they can work out where the file was extracted to then it would be possible for them to access it. Similarly if another developer was interested in accessing it, it would be relatively simple for them to extract it from your application directly.

Your best bet would be to extract it to an obscure location, but even then it would take little effort to open Task Manager or Command Prompt to find where it's executing from. I saw some comments on some Stackoverflow questions which seemed to indicate it might be possible by effectively emulating a Windows loader, but I imagine the work involved in this could be quite large.
Chris Copeland 29-Oct-20 11:08am    
In addition to the above, after some more searching it might be possible to run an application directly from a byte[] array variable, this would mean loading the embedded resource directly into memory. See this response.

However this doesn't mitigate the fact that an embedded resource in a .NET application can be extracted regardless, so it wouldn't offer complete protection.
Dave Kreskowiak 29-Oct-20 11:16am    
No, you cannot run the executable without extracting it.

And, yes, the user will be able to see the executable and run it once extracted.

You really don't have any good solution to your problem if you don't have the source code. The reasons for this is any executable launched by the user RUNS AS THE USER. So, yeah, if your code is extracting a resource (or the user can just use a tool to do it) the entire operation is being done as the user, so they can do whatever they want with it after that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900