SSH成功链接 修改CMD能显示颜色

1718373682860

cd ~/repo
wget https://github.com/erebe/wstunnel/releases/download/v9.6.3-rc1/wstunnel_9.6.3-rc1_freebsd_amd64.tar.gz
wget https://github.com/erebe/wstunnel/releases/download/v9.7.0/wstunnel_9.7.0_freebsd_amd64.tar.gz
tar zxvf wstunnel_9.7.0_freebsd_amd64.tar.gz
rm -f wstunnel_9.7.0_freebsd_amd64.tar.gz
chmod +x wstunnel
./wstunnel server wss://0.0.0.0:
#请将端口号18443替换为实际放行的端口
.\wstunnel client -L socks5://127.0.0.1:1080 https://
#请将xxx.xxx.xxx.xxx:18443修改为实际的IP地址和wstunnel server监听端口号

INFO 怎么乱码啊

没有作用

在Windows的CMD(命令提示符)中配置UTF-8输出,可以按照以下步骤进行操作:

临时修改(仅当前窗口有效)

  1. 打开CMD:首先,你需要打开命令提示符窗口。你可以通过按下 Win键 + R,输入 cmd,然后按 Enter键来打开它。
  2. 改变代码页:在CMD窗口中,输入 chcp 65001,然后按 Enter键。这里的 65001是UTF-8的代码页编号。执行此命令后,当前CMD窗口的代码页就被设置为UTF-8了。
  3. 修改窗口属性:为了正确显示UTF-8字符,你还需要修改窗口的字体设置。在CMD窗口的标题栏上点击右键,选择“属性”,然后在弹出的窗口中选择“字体”选项卡。将字体修改为True Type字体“Lucida Console”,然后点击确定将属性应用到当前窗口。
  4. 注意事项:通过以上操作,你可能发现显示出来的内容不完全。这时,你可以先最小化,然后最大化命令行窗口,文件的内容就应该能够完整地显示出来了。

永久修改(每次打开CMD都有效)

如果你希望每次打开CMD窗口时都默认使用UTF-8编码,那么可以通过修改注册表来实现:

  1. 打开注册表编辑器:按下 Win键 + R,输入 regedit,然后按 Enter键打开注册表编辑器。
  2. 导航到指定位置:在注册表编辑器中,按照路径 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor进行导航。
  3. 新建字符串值:在 Command Processor项上点击右键,选择“新建”->“字符串值”,并将新建的字符串值命名为“autorun”。
  4. 设置数值数据:双击新建的“autorun”字符串值,将其数值数据设置为 chcp 65001
  5. 关闭注册表编辑器:点击“确定”保存设置,并关闭注册表编辑器。

现在,每次你打开CMD窗口时,它都会自动将代码页设置为UTF-8。

注意事项

  • 修改注册表可能会对系统产生影响,因此在进行修改之前,请确保你知道如何恢复更改(或备份你的注册表)。
  • 如果你在运行UTF-8编码的批处理文件时遇到问题,可以尝试通过按住 Shift + 鼠标右键启动CMD窗口,并使用上述方法设置UTF-8编码。这样可以确保即使是直接双击UTF-8编码的批处理文件,也不会出现乱码问题。

: exec ld.lld14 newlisp rst2pseudoxml
! exiftool ld.lld15 newlisp-10.7.5 rst2pseudoxml-3.10
./ exit ld.lld16 newlispdoc rst2pseudoxml.py
[ exiv2 ld64.lld.darwinnew12 newsboat rst2pseudoxml.py-3.10
[[ expand ld64.lld.darwinnew13 nex rst2s5
]] expect ld64.lld.darwinold13 nfsstat rst2s5-3.10
{ expect_autoexpect ld64.lld10 ngettext rst2s5.py
} expect_autopasswd ld64.lld11 ngrep rst2s5.py-3.10
2to3 expect_cryptdir ld64.lld12 nice rst2xetex
2to3-2 expect_decryptdir ld64.lld13 nikon-curve rst2xetex-3.10
2to3-2.7 expect_dislocate ld64.lld14 nim rst2xetex.py
2to3-3 expect_ftp-rfc ld64.lld15 nimble rst2xetex.py-3.10
2to3-3.10 expect_kibitz ld64.lld16 ninja rst2xml
2to3-3.11 expect_lpunlock ldapadd nl rst2xml-3.10
2to3-3.7 expect_mkpasswd ldapcompare nltk rst2xml.py
2to3-3.8 expect_multixterm ldapdelete nm rst2xml.py-3.10
2to3-3.9 expect_passmass ldapexop nns rstpep2html
3proxy expect_rftp ldapmodify nnsd rstpep2html-3.10
411toppm expect_rlogin-cwd ldapmodrdn nnslog rstpep2html.py
7z expect_timed-read ldappasswd node rstpep2html.py-3.10
7zz expect_timed-run ldapsearch node12 rsvg-convert
a2ping expect_tknewsbiff ldapurl node14 rsync
a2x expect_tkpasswd ldapvc node16 rsync-ssl
a52dec expect_unbuffer ldapwhoami node18 rtmpdump
a5toa4 expect_weather ldc-build-runtime node20 rubibtex
aafire expect_xkibitz ldc-profdata node21 rubikrotation
aainfo expect_xpstat ldc-prune-cache node22 ruby
aalib-config export ldc2 nohup ruby32
aasavefont expr ldd nop rumakeindex
aatest exr2aces ldd32 normalizer run_erl
ab exrenvmap ldmd2 normalizer-3.10 run-clang-tidy13
ack exrheader leaftoppm notepad run-clang-tidy14
aclocal exrinfo leave notify-send run-clang-tidy15
aclocal-1.16 exrmakepreview lensfun-add-adapter npm run-mailcap
acountry exrmaketiled lensfun-convert-lcp npm14 run-with-aspell
acyclic exrmultipart lensfun-update-data npm16 runghc
addftinfo exrmultiview lenstool npm18 runghc-9.2.7
addr2line exrstdattr less npm20 rungs
adhocfilelist extcheck lesscpy npm21 runhaskell
adig extconv lesscpy-3.10 npm22 runhaskell-9.2.7
aec external-ip lessecho nproc rup
affixcompress extract_a52 lesskey npth-config ruptime
afm2afm extract_dca lesspipe.sh npx rusers
afm2pl extract_dts let npx14 rust-gdb
afm2tfm extract_mpeg2 lex npx18 rust-gdbgui
afmtodit extractbb lex++ npx20 rust-lldb
aft extractres lftp npx21 rustc
agentxtrap eyuvtoppm lftpget npx22 rustdoc
agrep f18-parse-demo13 libassuan-config nqs2pbs rustfmt
ahost f18-parse-demo14 libde265-dec265 nroff rview
aide f1813 libdeflate-gunzip nsec3hash rvim
aiksaurus f2c libdeflate-gzip nslookup rwall
al f2py libevdev-tweak-device nspr-config rwho
al2 f2py-3.10 libgcrypt-config nss-config rzsh
albatross f2py3 libinput nsupdate s3cmd
alias f2py3-3.10 libmcrypt-config ntpq s3put
allcm f2py3.10 libnetcfg number s3put-3.10

cd ~/repo && ./wstunnel server wss://0.0.0.0:56561 
#注意将这里的 xxxx 及目录名 pan 修改为自己的
cd ~/domains/xxxx.serv00.net/pan && nohup ./PanIndex -c=config.json &
#注意将这里的 xxxx 及目录名 pan 修改为自己的

使用wstunnel提供隧道连接可以通过多种方式保护你的隐私和数据安全,主要是通过以下几个机制:

服务器端(server):

wstunnel --server wss://0.0.0.0:443 --cert /path/to/cert.pem --key /path/to/key.pem

客户端(client):

wstunnel --tunnel wss://your-server.com:443 localhost:8080

操作步骤:

  1. 生成自签名证书(可选)
    如果你没有真实的SSL证书,可以生成一个自签名的证书用于测试或开发。可以使用 OpenSSL 工具生成自签名证书:

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
    

    这个命令将生成一个有效期为365天的自签名证书和相应的私钥文件 key.pemcert.pem

  2. 启动 wstunnel 服务器
    使用以下命令启动 wstunnel 服务器,并指定生成的证书和私钥文件:

    wstunnel --server wss://0.0.0.0: --cert cert.pem --key key.pem
    
    • --server wss://0.0.0.0:443:指定wstunnel服务器监听在 0.0.0.0 的443端口上,使用WebSocket Secure(wss)协议。
    • --cert /path/to/cert.pem:指定TLS证书的路径,替换 /path/to/cert.pem 为你实际的证书路径。
    • --key /path/to/key.pem:指定TLS私钥的路径,替换 /path/to/key.pem 为你实际的私钥路径。
  3. 客户端连接
    在客户端,你可以使用类似以下命令来连接到你的 wstunnel 服务器:

    wstunnel --tunnel wss://your-server.com:443 localhost:8080
    
    • --tunnel wss://your-server.com:443:指定wstunnel客户端连接到 your-server.com 的443端口上,使用WebSocket Secure(wss)协议。

注意事项:

  • 证书路径:确保替换命令中的 /path/to/cert.pem/path/to/key.pem 为实际的证书和私钥文件路径。
  • 自签名证书:如果使用自签名证书,请确保客户端信任该证书,或者在测试和开发阶段适当配置客户端以接受自签名证书。
  • 真实SSL证书:对于生产环境,建议获取由受信任的证书颁发机构(CA)签发的真实SSL证书,以确保通信的安全性和合规性。

通过这些步骤,你应该能够正确地配置和运行带有TLS加密的 wstunnel 服务器,并通过安全的WebSocket连接传输数据。

./wstunnel server wss://0.0.0.0: –tls-certificate cert.pem –tls-private-key key.pem

When behind a corporate proxy在公司代理人的背后

An other useful example is when you want to bypass an http proxy (a corporate proxy for example)The most reliable way to do it is to use wstunnel as described below
另一个有用的例子是当你想绕过一个http代理(例如一个公司代理)时,最可靠的方法是使用wstunnel,如下所述

Start your wstunnel server with tls activated
启动您的wstunnel服务器与tls激活

wstunnel server wss://[::]:443 --restrict-to 127.0.0.1:22
  

The server will listen on any interface using port 443 (https) and restrict traffic to be forwarded only to the sshdaemon.
服务器将侦听使用端口443(https)的任何接口,并将流量限制为仅转发给ssh守护进程。

Be aware that the server will use self signed certificate with weak cryptographic algorithm.It was made in order to add the least possible overhead while still being compliant with tls.
请注意,服务器将使用具有弱加密算法的自签名证书。这样做是为了增加尽可能少的开销,同时仍然符合tls。

Do not rely on wstunnel to protect your privacy, if it is one of your concerns, you should only forwards traffic thatis already secure by design (ie: https or vpn traffic)
不要依赖wstunnel来保护你的隐私,如果这是你的顾虑之一,你应该只转发那些设计上已经安全的流量(即:https或vpn流量)。

Now on the client side start the client with
现在,在客户端,

wstunnel client -L tcp://9999:127.0.0.1:22 -p http://mycorporateproxy:8080 wss://myRemoteHost:443
  

It will start a tcp server on port 9999 that will contact the corporate proxy, negotiate a tls connection with theremote host and forward traffic to the ssh daemon on the remote host.
它将在端口9999上启动一个tcp服务器,该服务器将联系公司代理,与远程主机协商tls连接,并将流量转发到远程主机上的ssh守护进程。

You may now access your server from your local machine on ssh by using
您现在可以使用以下命令从ssh上的本地计算机访问服务器:

ssh -p 9999 login@127.0.0.1

.\wstunnel client -L socks5://127.0.0.1:1080 https://


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 3400639399@qq.com

×

喜欢就点赞,疼爱就打赏

github