How to use libssh as server? - c++

I am working on a Windows version of a server application that communicates with a web application. The web application originally worked with a Linux server, and would SSH into Linux to execute commands on the server. My plan is to build a C++ server using Qt to receive commands from the web application, and process them to do the windows version of what those commands are.
So for example, if the web application originally sent "echo $HOME" and received back the home directory, I want to receive that same SSH command on my Windows server, then process it so if the server was configured for the home directory to be C:\Example\, then it would send back C:\Example\. My goal is to make as little change to the web application, and instead have the Windows server process the Linux SSH commands to do the Windows equivalent.
I've never worked with libssh before, but from some searching I found it and read that it could be used as an SSH2 server. Basically my question here, is how would I use libss2 to create a server in my Qt project to allow this web application to SSH in and send commands.
If you think there is a better way then libssh please let me know, this is just what I have found through searching.
UPDATE: I found this code of a server example. https://github.com/substack/libssh/blob/master/examples/samplesshd-tty.c
Honestly, I'm very confused by it. I'll probably be able to break it down and understand what's happening after a few hours of Googling and working through the code. But If anyone would be willing to walk me through main explaining what's happening at each step, that would be appreciated.

Related

QT Creator https request not working on VM

I am working on a small Application in Qt with C++.
(This Application is meant to run on Windows)
I am sending a few https requests in this App and recieving answers from an API.
This works fine. But on Vm with Windows 10 Enterprise 21H1 Image I cant get a connection to the Api. Installing Open SSL on the VM is not an option.
What else could I do, to get it working on the VM?

Chrome not connecting to network

I was wondering how I could let Chrome connect to my network. I am using a website called Codeanywhere.com and I was using a Django container. I used the built-in terminal and installed Python 3.4 and Django 10. I created a project and ran the server, and it said it had created one at this ip: http://127.0.0.1:8000/. However, whenever I try to access it, it the site can't be reached. If it helps, I am using a Chromebook Thinkpad, and it is a school computer. They do block things with Lightspeed Systems and they have a lot of blacklisting things going on. I am trying to learn Django for a project. Below is a screenshot of the screen when I try to access the server.
My screenshot of the error screen.
I can't embed my image yet, I don't have 10 reputation points :/ It's a link instead.
Mistake #1
The server isn't located on your local host, so you need to go to the provided server. for example, when I opened a project I got this instruction:
To access your application over HTTPS, make sure your application is running on port 3000 and use the following link:
https://mysite-{username}551936.codeanyapp.com
Mistake #2
you should run the server with a specified ip commend - and use 0.0.0.0:3000 instead of the usual localhost, like so:
python manage.py runserver 0.0.0.0:3000
In addition, I would reccomend you to read the "mysite Container" file which explains everything about the setup in detail.

Monitoring command prompt executed programs with Fiddler2

I am currently experimenting with using Fiddler 2 to monitor web service requests. I would like to know if it is possible to pick up the sessions from a program run via the command prompt in Windows 7. I have tried configuring the command prompt to use the local host proxy using the following:
netsh winhttp set proxy 127.0.0.1:8888
This doesn't seem to have made a difference though since running the program (a simple sample from the Axis2C install which communicates with a Yahoo web service) still produces no session in Fiddler. I would appreciate any help anyone can give on setting this up to work.
http://www.fiddler2.com/fiddler/help/hookup.asp explains how to hook various HTTP stacks to Fiddler. It sounds like you've ruled out WinINET and WinHTTP; you should ask the maintainers of "Axis2C" what network stack it uses.

Debugging asmx web services

How can I debug asmx webservices running on IIS? I read that I must Attach to process called aspnet_wp or w3wp. But I can not find these processes... I selected checkbox show processes from all users but still nothing. What can be wrong?
regards
If your service is not running, then there might not be a worker process running. Start your service by accessing it from the browser, of use "View In Browser" from inside of Visual Studio.
It may not be what you are looking for, but can't you run your project from visual studio first? I usually do it that way before going to IIS.
Or does your project run fine on VS and an other way with IIS? I personnaly never done it myself since I debug all my code in local.
As far as remote and local IIS debugging are concerned, I think you can check on this site CodeProjectI and CodeProjectII. The author claims to be a former MVP in ASP.NET, should be useful.
You have to be logged onto the machine that runs web service. You would need a debugger installed on that machine.
If that is not possible, you can install remote debugger for VS on the server. To install remote debugger you just need to copy msvsmon.exe from your VS installation CD or from machine where VS is already installed and start it.
Then when you attach to proccess from your machine you can type in the name of your remote server and click Browse. You should be able to see all proccess that are running on remote server. You would need administrative or Debugger rights on that server.

django: Call to remote service kills python

I'm writing a django app that communicates with remote service (on my VPN but not hosted locally). I can successfully communicate with the service via the django shell but when I try to call the exact same function, posting the information from a webform, the development server dies.
I would have thought the shell and the development server would behave exactly the same way. The only thing I could think of was that the shell might be more 'patient', waiting for a response?
The communication happens via protocol buffers.
Help!
The developpement server is single-threaded so if you open another connection it hangs the server.
You could try for dev purposes : http://github.com/jaylett/django_concurrent_test_server
works very well for me
Or use a real configuration, apache+wsgi for example