logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
jhghar  
#1 Posted : Wednesday, May 30, 2018 4:06:13 PM(UTC)
jhghar


Rank: Guest

Joined: 6/28/2017(UTC)
Posts: 5
United States

Thanks: 1 times
Hello, we're attempting to provide our team with a clickable relay:// link within our asset manager, which will allow us to immediately remote control the associated asset.

We've taken the route of attempting to reverse engineer the URL we see within ScreenConnect. Here's what we've got thus far:


  1. relay://server:port
  2. /
  3. sessionID
  4. /
  5. BgIAAACkAABSU0ExAAgAABEAA.... (400 character encoded string that does not seem to change based on user or machine)
  6. /
  7. AQHK6oKV7QGAowUAAC.... (60 character encoded string that we're acquiring from https://server:port/Services/PageService.ashx/access-token )
  8. //Access/
  9. hostname


Aside from this overall effort being fundamentally wrong-headed, we believe our issue resides in #7; our 60 character access token does not match the format we see in Chrome Dev Tools when ScreenConnect builds its relay:// links.

Any tips on building this URL?

Scott  
#2 Posted : Tuesday, June 5, 2018 1:31:04 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,862
United States

Thanks: 3 times
Was thanked: 351 time(s) in 303 post(s)
So this URI is specific to the relay itself, ie our protocol for session control/communication. If you want to create a clickable link that exists somewhere else on the web you'll want to create an Extension that is able to generate this list of "Client Launch Parameters" specific to the session and user requesting it.

There's a decent breakdown of the Client Launch Parameters themselves on our KB, specifically here.

The ScreenConnector Extension creates a Service.ashx file which contains a method that you can pretty much just copy into your own extension, also shown here:
Code:

public object GetLaunchUrl(string sessionName)
	{
		var permissionEntries = Permissions.GetEntriesForUser();
		Permissions.AssertAnyPermission(permissionEntries);

		var sessionFilter = ServerExtensions.GetExpression("Name", "=", sessionName);
		var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
		var userDisplayName = FormsAuthenticationModule.GetUserDisplayNameWithFallback(HttpContext.Current.User);
		var variables = ServerExtensions.GetStandardVariables(userDisplayName);
		var handlerUrl = ServerExtensions.GetWebServerUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true) + WebConfigurationManager.GetHandlerPath(typeof(ClickOnceDirectHandler)).ReplaceFirst("*", WebResources.GetString("FileDownload.BaseName"));
		
		return
			(from session in SessionManagerPool.Demux.GetSessions(sessionFilter)
			from groupContainingSession in SessionManagerPool.Demux.GetSessionGroupsContainingSession(session.SessionID, variables)
			where Permissions.HasPermission(new SessionPermissionRequest { Name = PermissionInfo.ViewSessionGroupPermission, SessionType = session.SessionType, SessionGroupName = groupContainingSession }, permissionEntries)
			let sessionPermissions = PermissionInfo.GetSessionPermissions(permissionEntries, session.SessionType, groupContainingSession, session.Host == userDisplayName)
			select new ClientLaunchParameters
			{
				Host = relayUri.Host,
				Port = relayUri.Port,
				EncryptionKey = ServerCryptoManager.Instance.PublicKey,
				SessionType = session.SessionType,
				SessionID = session.SessionID,
				ProcessType = ProcessType.Host,
				SessionTitle = session.Name,
				AccessToken = ServerCryptoManager.Instance.GetAccessToken(session.SessionID, ProcessType.Host, userDisplayName, sessionPermissions, default(DateTime)),
			})
			.FirstOrDefault()
			.SafeNav(clp => handlerUrl + ClientLaunchParameters.ToQueryString(clp));
	}


You pass it the Name of a session and it joins the first one it finds with that list. It might be better to change it to use the SessionID but that's up to you. It also pulls authentication from the webrequest itself but you can always change that to use an API token or something similar.
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.