#153 Windows 端口代理的实现方法
Windows SSH 计算机网络 2016-06-24Windows 主机上做一个代理,映射指定端口到另一台能访问到的主机上。
coding in a complicated world
Windows 主机上做一个代理,映射指定端口到另一台能访问到的主机上。
总结一下 SSH 相关知识,给新手一点指导,提升其工作效率。
三大理论:盖天说、浑天说、宣夜说。
UnicodeEncodeError
源代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'中国'
报错:
Traceback (most recent call last):
File "test.py", line 4, in <module>
print u'中国'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
通过命令调用,随机生成密码。
我常用的方法:date | md5sum | base64 | head -c16; echo
主要讲的是如何通过 SSH 的代理机制实现网络的穿透访问。
作业部落,用来写 Markdown,挺好的,不过样式不太符合我的心意,好在提供自定义功能...
乐视超4 X50 Pro,2999 元。
阅读下面的漫画材料,根据要求写一篇不少于800字的文章。(60 分)
要求:结合材料的内容和寓意,选好角度,确定立意,明确文体,自拟标题;不要套作,不要抄袭。
$ curl -v "http://成都大运会.网址"
* Input domain encoded as `UTF-8'
* About to connect() to xn--6oqv8vrnhtp3c7hb.xn--ses554g port 80 (#0)
* Trying 202.173.11.233... connected
* Connected to 成都大运会.网址 (202.173.11.233) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: xn--6oqv8vrnhtp3c7hb.xn--ses554g
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: openresty/1.21.4.3
< Date: Sat, 16 Dec 2023 06:09:33 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 61
< Connection: keep-alive
< Location: http://www.2021chengdu.com
<
<a href="http://www.2021chengdu.com">Moved Permanently</a>.
* Connection #0 to host 成都大运会.网址 left intact
* Closing connection #0
中文域名,中文顶级域名都已经支持很多年了,虽然看到不多。
上面示例中的域名 成都大运会.网址
实际上在域名系统中是以 xn--6oqv8vrnhtp3c7hb.xn--ses554g
形式存在的。
这种编码方式叫做 Punycode,非 ASCII 字符会被按照 Unicode 编号转换成 ASCII 字符。
域名系统中允许的字符集基于 ASCII,不允许以母语或字母表示多种语言的名称和单词。
ICANN 批准了国际化域名(IDNA)系统,该系统通过一种称为 Punycode 的编码将应用程序用户界面中使用的 Unicode 字符串映射到有效的 DNS 字符集。
Example of Greek IDN with domain name in non-Latin alphabet: ουτοπία.δπθ.gr (Punycode is xn--kxae4bafwg.xn--pxaix.gr)
'I❤️U'.encode('punycode')
b'IU-ony8085h'
'baidu.com'.encode('idna').decode()
# baidu.com
'中国.com'.encode('idna').decode()
# 'xn--fiqs8s.com'
'编程.中国'.encode('idna').decode()
# 'xn--9nz56h.xn--fiqs8s'
先提取 ASCII 字符,再编码非 ASCII 字符。