UnamBinder icon indicating copy to clipboard operation
UnamBinder copied to clipboard

Execute in current folder

Open zaxinop opened this issue 3 years ago • 9 comments

Hello, is possible to somehow execute binded files in the current folder?

zaxinop avatar Nov 09 '21 09:11 zaxinop

Not currently no, since it requires some code that does make it more detected.

UnamSanctam avatar Nov 09 '21 11:11 UnamSanctam

And will you release that version with that feature?

zaxinop avatar Nov 09 '21 12:11 zaxinop

Maybe, I have to create some good method of adding that since it's not very easy to do in a good way. Usually you never want to use the current directory since then anyone that runs it will see the files being dropped.

UnamSanctam avatar Nov 09 '21 12:11 UnamSanctam

Unfortunately, my files won't run if there are not dropped in the current folder. I am currently using your amazing unam downloader but it's not very effective for bigger files since it takes too long until the file is executed.

zaxinop avatar Nov 09 '21 12:11 zaxinop

Maybe, I have to create some good method of adding that since it's not very easy to do in a good way. Usually you never want to use the current directory since then anyone that runs it will see the files being dropped.

Isn't it fairly easy to do with CreateProcessA in C? Even powershell has -WorkingDirectory option. I didn't have any problems with detection's when running powershell commands with WinExec. I made a similar program in C that just writes binary data from an array to files in %temp% and runs them with powershell.

csharp17 avatar Dec 16 '21 13:12 csharp17

Isn't it fairly easy to do with CreateProcessA in C? Even powershell has -WorkingDirectory option. I didn't have any problems with detection's when running powershell commands with WinExec. I made a similar program in C that just writes binary data from an array to files in %temp% and runs them with powershell.

To get the current directory you would use something like GetCurrentDirectory https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory and then you would have to create some dynamic code so that it only adds that part of the code to the program if it has to be used by any of the bound files. The biggest problem I have so far with GetCurrentDirectory is that it always adds up to 8 detections.

You have to store the current directory so that you can first use it when writing the file and then for when it will run it.

UnamSanctam avatar Dec 16 '21 13:12 UnamSanctam

Isn't it fairly easy to do with CreateProcessA in C? Even powershell has -WorkingDirectory option. I didn't have any problems with detection's when running powershell commands with WinExec. I made a similar program in C that just writes binary data from an array to files in %temp% and runs them with powershell.

To get the current directory you would use something like GetCurrentDirectory https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory and then you would have to create some dynamic code so that it only adds that part of the code to the program if it has to be used by any of the bound files. The biggest problem I have so far with GetCurrentDirectory is that it always adds up to 8 detections.

You have to store the current directory so that you can first use it when writing the file and then for when it will run it.

You don't need to add dynamic code to the binded executable you can set its current directory when starting it? I used this in C and had no increased detections:

  HMODULE hModule = GetModuleHandle(NULL);
  if (hModule != NULL)
     {

         GetModuleFileName(hModule, lists2, (sizeof(lists2)));

        char *pos = strrchr(lists2, '\\');
        if (pos != NULL) *pos = '\0';

        SetCurrentDirectory(lists2);

     }

Im surprised using GetCurrentDirectory gets flagged so much.

csharp17 avatar Dec 16 '21 13:12 csharp17

I meant that I need to make it "dynamic" code due to each files output location and name being configurable, it's fully possible that no file added will use the current directory in which case none of the current directory code should be added to the program. Even then I'm currently working on the miner and the web panel (with the little time that I have) so I wouldn't be able to add it in a while.

UnamSanctam avatar Dec 16 '21 14:12 UnamSanctam

I meant that I need to make it "dynamic" code due to each files output location and name being configurable, it's fully possible that no file added will use the current directory in which case none of the current directory code should be added to the program. Even then I'm currently working on the miner and the web panel (with the little time that I have) so I wouldn't be able to add it in a while.

Can you add me on discord i sent you a request

csharp17 avatar Dec 16 '21 17:12 csharp17