Guacamole RDP Remote App within a black box - rdp

When I connect to a RemoteApp using the following code:
#Override
protected GuacamoleTunnel createTunnel(Session session, EndpointConfig config) throws GuacamoleException {
// Create our configuration
GuacamoleConfiguration guacConfig = new GuacamoleConfiguration();
guacConfig.setProtocol("rdp");
guacConfig.setParameter("security", "any");
guacConfig.setParameter("hostname", HOST);
guacConfig.setParameter("port", PORT);
guacConfig.setParameter("username", USER);
guacConfig.setParameter("password", SECRET);
guacConfig.setParameter("ignore-cert", "true");
guacConfig.setParameter("remote-app", "||calc");
// Connect to guacd
GuacamoleSocket socket = new ConfiguredGuacamoleSocket(
new InetGuacamoleSocket(GUACD_HOST, GUACD_PORT),
guacConfig
);
return new SimpleGuacamoleTunnel(socket);
}
I connect just fine, but the remote app is displayed in a big black box.
Is there any way to crop the display to the remote-app only?
Also, closing the page does not close the remote-app on the server, so when I'd refresh the page, i'd end up with two calculators, any tips on that too?

The black box you see is a "desktop", or whatever is contained below the remote app. You can use "width" and "height" parameters to set the desktop size. The list of available RDP options is here: https://guacamole.apache.org/doc/0.9.5/gug/configuring-guacamole.html#rdp
Alternatively, you can set the application to start maximized and occupy the whole desktop. You can check here how to set this up: https://www.computerhope.com/tips/tip201.htm.

Related

Xero API Allows connection but fails to redirect back, has an uncaughtreferenceerror: fbq is not defined

Upon running the program I am redirected to sign in with xero. Once I sign in I am able to choose an organization to allow access to the app
Upon clicking allow access I get redirected to the default "This site can't be reached" error page.
If I look at the console output when I click the button, for a few seconds an "uncaught reference error: fbq is not defined" is shown. Unfortunately it goes away before I can click on it.
Here is some of the relevant code:
void LoginToXero()
{
var xeroLoginUri = XeroService.GetLoginUri();
OpenBrowser(xeroLoginUri);
var listener = new HttpListener();
listener.Prefixes.Add(XeroService.CallbackUri);
listener.Start();
Console.WriteLine("Waiting for the browser to callback from Xero login page...");//Logs
var context = listener.GetContext();//Does not progress past here
//...
}
public static class XeroService
{
public static string CallbackUri => "xxxxxxxxxxxxx";
static string xeroState = Guid.NewGuid().ToString();
static string oAuth2Token = "";
static XeroClient xeroClient = new XeroClient(new XeroConfiguration
{
ClientId = "XXXXXXXXXXXXXX",
ClientSecret = "XXXXXXXXXXXXXXXXXXXX",
Scope = "openid payroll.employees",
CallbackUri = new Uri(CallbackUri)
});
public static string GetLoginUri()
{
xeroClient.xeroConfiguration.State = xeroState;
return xeroClient.BuildLoginUri();
}
}
Please note all sensitive data has been replaced by "XXXXXXXXX"
I have tested both localhost callback URI's (with specified ports) and custom ones that redirect to localhost via the host file on my machine
I have also tried running it on Windows 11 and Windows 10, both with the firewall enabled and then with it disabled
Any help would be greatly appreciated
The problem was that the listener and the App was set up for https, changing it to http and making sure there was an explicit port resolved the issue

Xamarin forms app Connection to Asp.net core web Api

I have a xamarin forms app that uses a (local) web api (using asp.net core) to connect to Sql Server Database.
i tried the demo provided here https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client to make a client api calls but it uses a console app instead of mobile app and it worked fine.
using both Microsoft.AspNet.WebApi.Client
and Newtonsoft.Json Nuget Packages
Xamarin forms client code
client.BaseAddress = new Uri("http://myIP:port/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
try
{
HttpResponseMessage response = await client.PostAsJsonAsync("api/users", user);
response.EnsureSuccessStatusCode();
return response.IsSuccessStatusCode;
}
catch (Exception ex)
{
Debug.WriteLine("Post Api Exception Msg: " + ex.Message, Class_Name);
return false;
}
and my web-Api code
public IActionResult Post([FromBody] User user)
{
if(!ModelState.IsValid)
{
return BadRequest(ModelState);
}
bool result= repository.Create(user);
if(result)
{
return Ok();
}
else
{
return StatusCode(500);
}
}
and i have tested the api code and it's working fine.
but whenever i try to make calls from my xamarin app
first) i placed a breake point in the web-api code it never gets hit
second) i keep getting the exception
[monodroid-net] --- End of managed Java.Net.SocketException stack trace ---
[monodroid-net] java.net.SocketException: Socket closed
[monodroid-net] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:394)
[monodroid-net] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
[monodroid-net] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
[monodroid-net] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
[monodroid-net] at java.net.Socket.connect(Socket.java:621)
[monodroid-net] at com.android.okhttp.internal.Platform.connectSocket(Platform.java:145)
[monodroid-net] at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:141)
[monodroid-net] at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
[monodroid-net] at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
[monodroid-net] at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
[monodroid-net] at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
[monodroid-net] at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
[monodroid-net] at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
[monodroid-net] at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
[monodroid-net] at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
I think it means that there is a problem with the connection socket but I have no idea what the problem is and how to resolve it.
You need change this:
client.BaseAddress = new Uri("http://10.0.2.2:port/");
instead of:
client.BaseAddress = new Uri("http://myIP:port/");
for more information, see the official documentation:
https://learn.microsoft.com/en-us/xamarin/cross-platform/deploy-test/connect-to-local-web-services
In order to access your location machine's web API in the android emulator, you must use the IP 10.0.2.2, see the link below for assistance
https://developer.android.com/studio/run/emulator-networking#networkaddresses
I finally solved the problem by using the Conveyor Extension here is the steps:
open visual studio and select from the tool bar extensions -> manage extension.
in online section search for Conveyor By Keyoti.
after installing the extension restart your Visual studio and it will resume installing.
after that you need to Add a firewall rule for your api to use.
open the windows defender firewall with advanced security form the start menu or type in the search box wf.mfc whatever works for you.
for full steps watch this brief tutorial.
Conveyor: Remote access to IIS Express web application [Updated]
after making all firewall configuration except the part of access over the internet (because in my case both my api and my android device are connected on the same network )
i did not work so i tried this:
5) click on tools -> conveyor allow remote access it will open up this window click on options.
on the far right side there option I clicked on FireWall check to check any issue with the firewall
afterwards it will open a window display the issues with the firewall
and you'll have two option to apply firewall rules automatically or to apply firewall rules manually

Task Module call from Ms Teams in Bot Framework

I am looking to open a task module (Pop up - iframe with audio/video) in my bot that is connected to Teams channel. I am having issues following the sample code provided on the GitHub page.
I have tried to follow the sample and incorporate to my code by did not succeed.
In my bot.cs file I am creating card action of invoke type:
card.Buttons.Add(new CardAction("invoke", TaskModuleUIConstants.YouTube.ButtonTitle, null,null,null,
new Teams.Samples.TaskModule.Web.Models.BotFrameworkCardValue<string>()
{
Data = TaskModuleUIConstants.YouTube.Id
}));
In my BotController.cs that inherits from Controller
[HttpPost]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
// The adapter will invoke the bot.
await _adapter.ProcessAsync(Request, Response, _bot);
}
public async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
if (activity.Type == ActivityTypes.Invoke)
{
return HandleInvokeMessages(activity);
}
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
private HttpResponseMessage HandleInvokeMessages (Activity activity)
{
var activityValue = activity.Value.ToString();
if (activity.Name == "task/fetch")
{
var action = Newtonsoft.Json.JsonConvert.DeserializeObject<Teams.Samples.TaskModule.Web.Models.BotFrameworkCardValue<string>>(activityValue);
Teams.Samples.TaskModule.Web.Models.TaskInfo taskInfo = GetTaskInfo(action.Data);
Teams.Samples.TaskModule.Web.Models.TaskEnvelope taskEnvelope = new Teams.Samples.TaskModule.Web.Models.TaskEnvelope
{
Task = new Teams.Samples.TaskModule.Web.Models.Task()
{
Type = Teams.Samples.TaskModule.Web.Models.TaskType.Continue,
TaskInfo = taskInfo
}
};
return msg;
}
return new HttpResponseMessage(HttpStatusCode.Accepted);
}
There is more code as per the GitHub sample but I won't paste it here. Can someone point me into the correct direction ?
I have got to the stage that it is displaying a pop up window but the content and title comes from manifest file instead of creating actual iframe also no video is rendering. My goal is to render video within my teams using iframe container.
The important part from the sample:
This sample is deployed on Microsoft Azure and you can try it yourself by uploading Task Module CSharp.zip to one of your teams and/or as a personal app. (Sideloading must be enabled for your tenant; see step 6 here.) The app is running on the free Azure tier, so it may take a while to load if you haven't used it recently and it goes back to sleep quickly if it's not being used, but once it's loaded it's pretty snappy.
So,
Your Teams Admin MUST enable sideloading
Your bot MUST be sideloaded into Teams
The easiest way to do this would be download the sample manifest, open it in App Studio, then edit your bot information in. You then need to make sure Domains and permissions > Valid Domains are set for your bot. Also ensure you change the Tabs URLs to your own.
You also need to make sure that in your Tasks, the URLs they call ALL use https and not http. If anywhere in the chain is using http (like if you're using ngrok and http://localhost), it won't work.

Issue with SSH.NET UWP

I am having issues using SSh.net in a UWP App. This app will run on Win10.
I get the following error:
An attempt was made to access a socket in a way forbidden by its access permissions. I have looked online and there is no one actually dealing with this.The exact same code works in a standard Desktop App (WPF)
The key is the key string and I had to replace \r with \n because the PrivateKeyFile creation gave an error message and I tracked this down to carriage return placed instead of new line (by the textbox).
key = key.Replace("\r", "\n");
PrivateKeyFile(stringToStream(key));
client = new SshClient(ip, port, username, pkf);
if (!client.IsConnected)
{
try
{
client.Connect();
connected = true;
}
catch (Exception ex)
{
exception = ex.Message.ToString();
connected = false;
}
}
Finally resolved this issue - Look here: An attempt was made to access a socket in a way forbidden by its access permissions
Go down to the following line:
If you're getting the same error in Windows 8 development, it could be that you haven't enabled access over Private Networks in your Package.appxmanifest file:
Select the Private Networks (Client & Server) option as shown on the image.
Click here for the image

Selenium+AutoIt - send commands to execute in Remote Desktop

I am trying to automate non-browser based functionality (thick client application - Delphi based), web-based application(new java application) and opted to use Selenium + AutoIt for this. I need to compare data displayed in both applications for one particular user.
To access the thick client application, I need to use Remote Desktop Connection. I was able to connect to the remote desktop through selenium+autoit but not able to send any commands to the remote machine. If anyone is aware of the solution please help.
Following is the code I used.
import java.io.File;
import autoitx4java.AutoItX;
import com.jacob.com.LibraryLoader;
public class sampleTest {
  static String rdcPwd = "password";
  static String remoteComputerName = "computername";
  
  public static void main(String[] args) throws InterruptedException {
    String jacobDllVersionToUse;
    jacobDllVersionToUse = "jacob-1.18-x64.dll";
    File file = new File("lib", jacobDllVersionToUse);
    System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
    AutoItX x = new AutoItX();
    x.run("MSTSC.EXE");
    x.winActivate("Remote Desktop Connection");
    x.winWaitActive("Remote Desktop Connection");
    x.controlClick("Remote Desktop Connection", "Co&nnect", "1");
    Thread.sleep(15000);
    x.send(rdcPwd);
    Thread.sleep(3000);
    x.controlClick("Windows Security", "", "[CLASS:Button; INSTANCE:2;]");
    Thread.sleep(10000);
    x.send("#r");      // Not Working
    x.run("explorer.exe");  //Not Working
  }
}
Thanks,
Madhu.