How to find out the port on which my PowerShell script is communicating to the other server? - windows

I have a PowerShell script which copies certain files from a remote server and pastes in the local server. Now I need to use the file from another agent server which doesn't have connectivity to the remote server.
So I need to find out the port on which the communication will be established to the remote server from the agent server to copy the data.
I tried using netstat command but didn't find anything in that.
What are the steps to be followed to get the port information?

Related

Execute actions before specific commands in Apache Guacamole

I setup Apache Guacamole 0.9.14 on my CentOS 7 with nginx as reverse proxy to it.
I want to give limited access to some of my employees for some of my servers via ssh.
Some of them are SFTP enabled and to prevent sabotage on purpose or not I edit guacamole upload function to upload a copy of file uploaded on guacamole server itself alongside destination server.
I was wondering if I could create a copy of files getting on destination servers via wget, curl, etc.
If I can control specific commands on destination servers and do some actions before executing them, (For example backing files on guacamole server before executing any rm -rf command or creating a copy of file 'wget'ed on guacamole server), that would be great.
There are more than a thousand servers with different Linux OSs on them, so editing any server except guacamole server itself is impossible to do.
Any idea on how to control commands before executing on guacamole server specially on ssh?

Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1

Running into the subject issue trying to update the proxies with nswag... funny enough, the app that this came with is preconfigured to use a specific port for that service, but I don't see anything on that port using netstat -ano in the command line. Does anyone have any thoughts?
Before running nswag/refresh.bat the host needs to be up and running.
To start host, copy the below lines and create a batch file (bat).
CD "D:\Github\MySolution\src\MyProject.Web.Host"
SET ASPNETCORE_ENVIRONMENT=Development
SET ASPNETCORE_URLS=http://*:22742
dotnet run
It was some settings on the server (so a corporate guy told me), so nothing on my end, but thank you everyone for your help!

xdebug remote server and SFTP - cannot connect

I am trying to debug PHP files which sit on a remote server (on the same network) without success.
Here is my php.ini config for xdebug on the remote server where PHP and xdebug are installed:
xdebug.remote_enable=1
xdebug.remote_host=192.168.128.56
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=0
192.168.128.56 is the IP address of my PC on which my editor is installed.
I have tried to get this working with both Atom and Sublime Text 3 without success. I think that my path bindings may be incorrect.
I log into the remote linux machine using SFTP. I can then double click on php files in my application and they will open in my editor where I can work on them and save them. How can I set up the path bindings to debug these remote php files? I'm not sure what the second (local) part of the path binding should actually be? Do I need to add the location where the FTP software stores a temporary copy of the file I am working on as the local part of the binding?
I have tried the following:
URL - the address of where the app runs on the remote server:
e.g. http://www.mywebsite.com/testapp/
Path Binding - remote path to the application root on linux : path to the local copy of the files on my machine where the FTP software stores them:
e.g. /web/testApp/ : C:\Users\me\AppData\Local\Temp\scp18929\
I'm a little confused about how the path binding works, and what the values should be. Am I doing this correctly? Can this even be done?
If anyone can help that would be great.
Probably, the first thing to check is whether Xdebug actually tries to connect to your IDE. You can do that, by adding:
xdebug.remote_log=/tmp/xdebug.log
to your php.ini file. When you then initiate debugging, there should be information in the /tmp/xdebug.log file, where it will tell you where it tried to connect too, and whether the connection succeeded or failed.
If you get something like:
I: Remote address found, connecting to 192.168.128.56:9000.
E: Could not connect to client. :-(
That means that either your IDE wasn't listening for something, or that there is a firewall preventing an incoming connection, or that the IP address is incorrect.

Telnet to Server Trying to Open Program Cant see it

I telnetted to my server and i tried to open a simple program say notepad.exe or skype.exe.For some reason on my desktop it does not open when i use telnet to do so, but a process does initiate when i run it from telnet.
How come i cant see the program open on my desktop when i telnet to my server and run a program?
I am running the telnet server on a vm and using the client on my host computer.
I run simple command like this
*===============================================================
Welcome to Microsoft Telnet Server.
*===============================================================
C:\Program Files\Skype\Phone>Skype.exe
Telnet is a text-based utility. Notepad, Skype, et al require a graphics interface not available to a telnet client, therefore they won't start. It doesn't matter that the telnet client and server are on the same hardware.
You can initiate a process on a remote machine via a telnet client because it doesn't require a user interface.

Run script on remote machine via telnet (not SSH)

I need to somehow run a script which resides on a remote machine running Ubuntu.
SSH or any other connection type that requires complex encryption is not possible.
The client that will connect to the remote machine is only capable of opening a port and sending and receiving strings.
Can anyone tell me how to do this?
Why is your remote Ubuntu machine "not natively capable of SSH". That's nonsense.
But if you want a solution, use expect - it can run ftp/telnet or any other terminal-based application. It can react to different input, and type in a password.
There are python and perl-based packages that also do this.

Resources