VSCODE remote ssh debugging linux+cpolar intranet penetration

VSCODE remote ssh debugging linux+cpolar intranet penetration

1. Configuration and use of cpolar

1. Enter cpolar official website https://i.cpolar.com/m/4kqU

2. Click Free to use to register an account


3. Install cpolar on linux

  • Domestic installation
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • Or cpolar short link installation method: (for foreign use)
curl -sL https://git.io/cpolar | sudo bash
  • Check the version number, if it is displayed normally, the installation is successful
cpolar version
  • token authentication

Enter the official website https://www.cpolar.com/, log in to your account, click the verification on the left to view your authentication token, and then paste the token in the command line, as shown in the figure below

cpolar authtoken xxxxxxx

insert image description here

  • Simple Penetration Test
cpolar http 8080

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-ZH0RpPsw-1684670497575) (remote ssh.assets/image-20230503210023545.png)]

If the corresponding public network address is normally generated, press ctrl+c to exit
– add services to the system

sudo systemctl enable cpolar
  • Start the cpolar service
sudo systemctl start cpolar
  • Check the status of the service, if it is displayed as shown in the figure below, activeit is in the started state
sudo systemctl status cpolar

insert image description here

After the installation and configuration of cpolar is complete, visit the local port 9200 on the browser, and use the cpolar email account to log in to the cpolar web UI management interface

insert image description here
insert image description here
After cpolar is successfully installed, 2 sample tunnels will be installed by default, which can be edited or deleted by yourself:

  • ssh tunnel: point to local port 22, TCP protocol
  • website tunnel: point to local port 8080, HTTP protocol

You can see the public network address of ssh in the online tunnel list. Since it is a free plan, the address is updated every 24 hours. Be careful not to copy *tcp://* when using remote

insert image description here

Of course, you can also log in to the cpolar official website https://www.cpolar.com/ to view the status and URL

insert image description here

Two, VSCODE for ssh remote connection

1. Install vscode

2. Search for "remote" in the extension store and install Remote-SSH

insert image description here

3. Public network SSH remote connection to Ubuntu

  • new remote

insert image description here

ssh -p XXXXX [email protected] such as:

ssh -p 23501 [email protected]
Among them, X is the port number generated by cpolar, and the user name needs to be replaced with the Ubuntu host user name). It should be noted that before the numerical port number, you need to add the "(space)-p (space)" parameter, otherwise the tunnel cannot be connected; secondly, after "ssh -p XXXXX username@", you must enter the copy generated by the client tcp address

Then choose a location to save the config file

insert image description here

  • refresh
    insert image description here

  • Choose to connect in the current window or create a new window

insert image description here

  • Select linux—>continue—>enter password—>select folder to open

insert image description hereinsert image description here

insert image description here

insert image description here

  • After opening, the interface is as follows, install the remote extension plug-in you need, and then start debugging.

insert image description here

3. Reference link

https://www.cpolar.com/blog/vscode-uses-ssh-to-connect-to-linux-remotely

Guess you like

Origin blog.csdn.net/KIDfengKID/article/details/130795899