[bug] Cant do reverse connect via automated task (scheduler)

Here you will find help for frequently asked questions as well as for your specific question.

[bug] Cant do reverse connect via automated task (scheduler)

Postby AnotherUVNCuser » 2017-10-01 01:23

Hello all (and Rudi) :-)


The following has been tested using 1.2.1.6, under a virtual Windows 7 Home Basic Edition (x86) and a real Windows 10 Pro (x64)


I wanted to execute a reverse connection to my own computer via an automated task (Windows Task Scheduler).
The task gets executed but nothing happens.

For your information:

The Task Scheduler does NOT execute WINVNC -connect HOSTNAME/IP directly,
but runs a self compiled commandline .exe, that i've made using http://orwelldevcpp.blogspot.be/ and http://www.codeblocks.org/

Code: Select all
#include <windows.h>
//#include <winver.h>

using namespace std;

int main() {

//   system("NETSTAT -N | FINDSTR /I ESTABLISHED | FINDSTR :1234 >NUL || winvnc.exe -connect 192.168.0.226:1234");
   system("winvnc.exe -connect 192.168.0.226");
   return 0;

}


With TightVNC this works fine, but with UltraVNC it doesn't do anything.

Hopefully this can be fixed, as i intent to run multiple commands on a scheduled/repeating time and want to do this via an .exe, so that i don't have to add more stuff to the task scheduler (i prefer this method over a .bat/.cmd).
With the automated task i can manage my computers when i'm not at home, without having to manually connect to them (call me lazy, i find it convenient :mrgreen:).

Also (to eliminate any misunderstandings): the server connects to the correct address, the 192. was purely entered as an example and i also use encryption/authentication.


EDIT: 1.2.1.7 is also affected

/AnotherUVNCuser
Last edited by AnotherUVNCuser on 2017-10-01 16:43, edited 6 times in total.
AnotherUVNCuser
20
20
 
Posts: 39
Joined: 2017-09-13 00:40

[bug] Cant do reverse connect via automated task (scheduler)

Postby AnotherUVNCuser » 2017-10-01 02:25

I have recorded a video in which i demonstrate the (reproducable) problem (1.2.1.7 is also affected):

https://www.youtube.com/watch?v=P4tpjXDbGX8
AnotherUVNCuser
20
20
 
Posts: 39
Joined: 2017-09-13 00:40

Re: [bug] Cant do reverse connect via automated task (schedu

Postby AnotherUVNCuser » 2017-10-02 15:45

The problem with the non running task really appears to be related to session 0 (SYSTEM) :/

Isn't it possible to make it compatible with the Windows SYSTEM account?

Besides trying the system(); C++ directive i've also tried the following (of which both methods fail when trying to run them from a SYSTEM task):

ShellExecute
Code: Select all
#include <windows.h>

// using namespace std;

int main()

{

   ShellExecute(0, "open", "winvnc.exe", "-connect 192.168.0.226:1234", 0, 1);

   return 0;

}



CreateProcess
Code: Select all
#include <windows.h>

// using namespace std;

int main()

{
   HWND            hWnd;
   STARTUPINFO         sInfo;
   PROCESS_INFORMATION   pInfo;

   ZeroMemory(&sInfo, sizeof(sInfo));
   sInfo.cb = sizeof(sInfo);
   ZeroMemory(&pInfo, sizeof(pInfo));

   char cmdArgs[] = " -connect 192.168.0.226:1234";

   if(CreateProcess("winvnc.exe", cmdArgs, NULL, NULL, false, 0, NULL, NULL, &sInfo, &pInfo));

    {
//        WaitForSingleObject(pInfo.hProcess,INFINITE);

        CloseHandle(pInfo.hThread);
        CloseHandle(pInfo.hProcess);

    } 

    return 0;

}


EDIT: After some more testing, i've came to a possible solution (i don't want to call it a workaround just yet).

I've noticed that i can make the task work when choosing a different built in account, i.e. SID: S-1-5-32-545, which is the built in users account.

(found here: https://support.microsoft.com/nl-nl/hel ... ng-systems )

Using this account, i only don't know if it can connect to me without me having to log on first (which would defeat its purpose of my usage goal).
AnotherUVNCuser
20
20
 
Posts: 39
Joined: 2017-09-13 00:40

Re: [bug] Cant do reverse connect via automated task (schedu

Postby Tki2001 » 2017-11-06 12:22

It should be the same account permission issue, as the UltraVNC has when it is not permitting the installation on a remote desktop session (well, it is, but not running correctly after install).
It is just because the permissions are not the same, that the user it is running the task.
Try to run the task under the same user, the UltraVNC has installed its files.
Take into account, that before login in, there's no user interaction, as desktop has not been loaded.
The server is running fine before loggin in, and permits connections, but I don't know if client permits execution without a user logged in.
Tki2001
8
8
 
Posts: 21
Joined: 2016-04-24 11:44


Return to General help

Who is online

Users browsing this forum: Bing [Bot] and 4 guests