This commit is contained in:
2026-02-04 02:55:12 +00:00
commit 529319e74b
312 changed files with 93374 additions and 0 deletions

336
2020/01/05/devops.html Normal file
View File

@@ -0,0 +1,336 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Mayx的运维笔记 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="Mayx的运维笔记" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="新年新Bug" />
<meta property="og:description" content="新年新Bug" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-01-05T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Mayx的运维笔记" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-01-05T00:00:00+08:00","datePublished":"2020-01-05T00:00:00+08:00","description":"新年新Bug","headline":"Mayx的运维笔记","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/01/05/devops.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/01/05/devops.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/01/05/devops.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-01-05T00:00:00+08:00">5 January 2020</time> - 字数统计2306 - 阅读大约需要7分钟 - Hits: <span id="/2020/01/05/devops.html" class="visitors">Loading...</span></small>
<h1 class="p-name">Mayx的运维笔记</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 05 Jan 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章记述了运维人员新年期间遇到的问题花火学园的服务器宕机原因是数据库连接问题。在经历重启失败、故障排查后发现用户表出现问题通过重置解决问题。为了提高稳定性运维决定迁移服务器从Ubuntu迁移到CentOS并使用LEMP应用。迁移过程中包括数据库和文件备份、新服务器部署、DNS设置、CDN配置以及基础环境优化如BBR和Swap安装。在优化过程中运维尝试使用UNIX domain sockets但遇到了权限设置问题后来调整了MySQL连接配置。此外还发现并处理了postfix和日志记录的问题。最后运维反思了之前的问题并计划分开开发环境和主站服务器。</p>
<hr />
<ul><li><a href="#开端">开端</a></li><li><a href="#重建的过程">重建的过程</a></li><li><a href="#之后的优化">之后的优化</a></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>新年新Bug<!--more--></p>
<h1 id="开端">
<a href="#开端"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 开端
</h1>
<p>前天,我维护的<a href="https://www.say-huahuo.com">花火学园</a>宕机了,由于在上面安了乱七八糟的各种各样的东西,所以我以为它只是日常卡机,所以我就随手重启了一下。 </p><p>
重启完之后它凉了不知道为什么数据库连不上了……于是我开始问另外一个同样可以登录服务器的人问他有没有动过数据库结果听起来貌似他好几个月都没登服务器了。于是我慌了试着手动启动MySQL的服务然而黑色的界面里冷冰冰的<code class="language-plaintext highlighter-rouge">Job for mysql.service failed</code>告诉我事情没有那么简单。我按照错误的提示查看了详细信息,然而里面也只是简单的记录了一句<code class="language-plaintext highlighter-rouge">mysql.service: Main process exited, code=exited, status=1/FAILURE</code>这样通俗而又简单的一句话……这和没说有什么区别……谁都知道它启动失败了…… </p><p>
没办法,这时候只能向网站的上一代运维求助了 <del>(向大佬低头)</del> 经过大佬不知道什么样的操作终于找到了真正的错误详细信息看起来好像是数据库中的用户表出了问题。于是大佬重置了用户表总算是勉强把MySQL服务重新启动了。 </p><p>
不过虽然这时候再做一些简单的配置,应该差不多就可以重新上线了,不过考虑了一下,为了让以后不会再出现乱七八糟的事,我打算把网站重新迁移一遍,让系统环境做一个大更新!</p>
<h1 id="重建的过程">
<a href="#重建的过程"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 重建的过程
</h1>
<p>首先重新租一台服务器吧之前用的是Ubuntu的服务器现在一年过去了也该考虑考虑稳定性的问题了于是我把系统换成了CentOS。 </p><p>
然后为了之后配置起来方便一些我依然决定使用服务器商已经配置好的LEMP应用这样建好以后我也不用再考虑安装服务器软件的问题了。 </p><p>
在新的服务器部署的过程中,我回到原来的服务器,开始打包网站的数据库和文件,做好向新的服务器转移的准备。 </p><p>
没多久,新的服务器就部署好了,于是我直接一个<code class="language-plaintext highlighter-rouge">scp</code>就把所有的文件传到了新的服务器上。不得不说服务器直接传输文件的速度是真的快几个GiB的文件几分钟就传完了。顺便感叹一下花火学园的数据居然也都好几个GiB了想当年我接手的时候还不到2GiB。 </p><p>
然后就是导入数据库和解压网站文件以及配置Nginx完成以后网站不出所料的可以正常使用了。 </p><p>
然后就是设置DNS之类乱七八糟的事以及Cloudflare的CDN之类的不过还好之前设置过防火墙白名单的配置这次也方便了不少。 </p><p>
不过这还没完,既然换了新的服务器,而这一年里我对服务器的了解也更深了一些,至少应该做一些优化吧。 </p><p>
所以呢我就先把BBR给装上了搞太多东西也很麻烦所以我就直接用了<a href="https://github.com/teddysun/across/blob/master/bbr.sh">一键脚本</a>。顺便又搞了Swap毕竟服务器只有1GiB的内存是应该多搞点内存虽然可能速度会降低但还是求稳嘛而且服务器好像是SSD的硬盘应该影响不大。 </p><p>
到这里,基础的环境部分我就自认为搞好了。</p>
<h1 id="之后的优化">
<a href="#之后的优化"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 之后的优化
</h1>
<p>到了第二天我又心血来潮想再搞点别的东西来优化服务器首先我的目标是把对内的TCP/IP sockets全部换成UNIX domain sockets用UNIX domain sockets可以减少不少系统开销所以我首先对PHP-FPM开刀。 </p><p>
其实改起来也很简单就是把PHP-FPM的配置文件中的<code class="language-plaintext highlighter-rouge">listen</code>项从IP地址换成文件然后把Nginx中的<code class="language-plaintext highlighter-rouge">fastcgi_pass</code>改成带<code class="language-plaintext highlighter-rouge">unix:</code>前缀的文件就OK了。我改完之后真就以为OK了但是现实中的<code class="language-plaintext highlighter-rouge">502 Bad Gateway</code>打破了我的幻想,看来没那么简单…… </p><p>
后来我仔细看了一下PHP-FPM文件的注释发现了一句警告</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>; WARNING: If you switch to a unix socket, you have to grant your webserver user
; access to that socket by setting listen.acl_users to the webserver user.
</code></pre></div></div>
<p>哦哦,原来是要设置<code class="language-plaintext highlighter-rouge">listen.acl_users</code>……然后我把nginx加了进去重启之后它就好了。 </p><p>
之后我打算优化一下MySQL不过我也不是很清楚MySQL中怎么设置UNIX domain sockets本来是打算就此放过不过我听说好像数据库连接中用<code class="language-plaintext highlighter-rouge">127.0.0.1</code>要比<code class="language-plaintext highlighter-rouge">localhost</code>要好,因为少了一次解析。我听着感觉好像有那么点道理,然后就去把网站配置的数据库地址给改了。 </p><p>
不过后来发现查了一下发现好像MySQL对<code class="language-plaintext highlighter-rouge">localhost</code>地址有特殊规定在MySQL中如果使用<code class="language-plaintext highlighter-rouge">localhost</code>那么连接就会走UNIX domain sockets而使用<code class="language-plaintext highlighter-rouge">127.0.0.1</code>就会和平常一样走TCP/IP sockets。 </p><p>
看完之后我感觉有那么点不爽啊然后就回去又把我的数据库地址改了回去不仅如此我还打算关掉3306端口后来查了一下发现在配置文件中加入<code class="language-plaintext highlighter-rouge">skip-networking</code>就可以了。 </p><p>
之后我查看了一下端口除了443端口和我的SSH的端口外还有一个奇怪的25端口看着感觉很不爽查了一下是postfix的端口然后我一个不爽就把postfix随手卸载掉了。 </p><p>
再往后我看了看我的Nginx日志发现大小有那么点不对劲才建的服务器日志已经有400-500MiB了虽然花火学园平时流量不算小但也不至于这么夸张吧后来我发现我没有过滤静态资源的日志之后又修改了一下配置文件心里就舒服多了😁。 </p><p>
于是,花火学园的优化就到此结束。</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>我其实应该仔细看看日志的向莫名其妙出现的BUG说不定是攻击 <del>被害妄想症23333</del> 后来我翻了翻日志好像也没这个倾向。 </p><p>
另外我确实不应该把正在开发中的项目和主站放在同一个服务器,至少鸡蛋也不应该放到同一个篮子里面嘛……这次我打算做好主站的所有配置,保证它的正常运行。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%BF%90%E7%BB%B4"><em>运维</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%AC%94%E8%AE%B0"><em>笔记</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-01-05-devops.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/01/05/devops.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2019/12/31/summary.html">
上一篇:年终总结
</a>
</span>
<br />
<span class="next">
<a href="/2020/01/21/devops.html">
下一篇Mayx的运维笔记 - 应用优化
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/01/05/devops', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/01/05/devops.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

330
2020/01/21/devops.html Normal file
View File

@@ -0,0 +1,330 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Mayx的运维笔记 - 应用优化 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="Mayx的运维笔记 - 应用优化" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="优化?能不负优化就够好了!" />
<meta property="og:description" content="优化?能不负优化就够好了!" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-01-21T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Mayx的运维笔记 - 应用优化" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-01-21T00:00:00+08:00","datePublished":"2020-01-21T00:00:00+08:00","description":"优化?能不负优化就够好了!","headline":"Mayx的运维笔记 - 应用优化","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/01/21/devops.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/01/21/devops.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/01/21/devops.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-01-21T00:00:00+08:00">21 January 2020</time> - 字数统计1924 - 阅读大约需要6分钟 - Hits: <span id="/2020/01/21/devops.html" class="visitors">Loading...</span></small>
<h1 class="p-name">Mayx的运维笔记 - 应用优化</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Tue, 21 Jan 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章记录了作者对Mayx论坛应用进行优化的过程。首先尝试更换了图片处理库从GD库改为ImageMagick库但遇到了图片缩略图显示问题怀疑是数据库问题最终恢复默认设置。然后尽管对Redis缓存有所期待但配置过程遇到困难特别是与/tmp/文件夹权限相关的问题。作者将Redis配置到/run/文件夹后问题得以解决但并未显著提升性能反而因请求量激增而发现优化的必要性。此外还调整了Discuz的权限设置和发帖限制以应对可能存在的恶意操作。作者最后感慨优化过程中的挫折和提升自身技能的需求。</p>
<hr />
<ul><li><a href="#继续优化">继续优化!</a></li><li><a href="#关于图片处理库的优化">关于图片处理库的优化</a></li><li><a href="#关于缓存的优化">关于缓存的优化</a><ul><li><a href="#历经艰辛的redis之旅">历经艰辛的Redis之旅</a></li></ul></li><li><a href="#其他的杂事">其他的杂事</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>优化?能不负优化就够好了!<!--more--></p>
<h1 id="继续优化">
<a href="#继续优化"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 继续优化!
</h1>
<p>接着<a href="/2020/01/05/devops.html">上一篇</a>的重建我在上一次做了一些系统环境上的优化不过论坛中用的Discuz系统也算是一个成熟的应用了 <del>(可惜再成熟也不会自己写代码😂)</del> 所以这次我打算在Discuz这个应用上做优化。 </p><p>
不过毕竟以我的PHP水平还做不到直接在源代码上进行修改所以我打算使用Discuz本身有的优化功能上进行优化。</p>
<h1 id="关于图片处理库的优化">
<a href="#关于图片处理库的优化"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 关于图片处理库的优化
</h1>
<p>在Discuz的后台面板中我首先看到的关于性能优化方面的地方就是图片处理库 <del>(尽管它不是最先出现的)</del>。看旁边的介绍中说默认的GD库似乎更加消耗系统资源而相比之下ImageMagick库会好一些既然它都这么说了那我肯定是毫不犹豫的选择了ImageMagick库嘛。 </p><p>
当然事实上我也确实是这么做的然而这个操作貌似发生了一些不可预料的问题。修改了这个选项后我开始逛论坛但是我发现论坛中不少帖子的图片缩略图显示出现了问题这时候我感觉不大对劲首先我确定了一下Vultr中的LEMP肯定是有装ImageMagick库的那问题肯定不是我PHP环境的问题这时候我怀疑是数据库保存的东西可能有问题。不过这个问题就超出了我的解决范围没办法我只好又把选项还原回去了😓反正它这么多年也都过来了应该影响没多大吧。</p>
<h1 id="关于缓存的优化">
<a href="#关于缓存的优化"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 关于缓存的优化
</h1>
<p>在之前的花火学园中我也用了Discuz的缓存引擎是MemCache。事实上在LEMP默认是不提供MemCache的扩展反倒是有Redis的扩展。不过我看着Redis那红色的图标不知道为什么心里总有一种抵触感后来经过了解Redis似乎要比MemCache的性能好的多我也就半信半疑的打算装一下试试。 </p><p>
不过事实上我并不怎么相信这种缓存能提升多少性能只是看着网上说着各种加速到0.005s让人非常的心动。毕竟我的服务器内存并不大总共也就1个G另外还加了Swap。如果缓存占用的内存很多分配来分配去又回到Swap所在的硬盘那我优化岂不是失去了意义不过心里总是被别人的博客搞的很羡慕所以我开始研究怎么样搞Redis缓存。</p>
<h2 id="历经艰辛的redis之旅">
<a href="#历经艰辛的redis之旅"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 历经艰辛的Redis之旅
</h2>
<p>Redis并不是很难安装一句<code class="language-plaintext highlighter-rouge">yum install redis</code>就搞定了,主要难的地方还是在于配置。 </p><p>
我知道这时候只要在Discuz的配置文件里加一句<code class="language-plaintext highlighter-rouge">$_config['memory']['redis']['server'] = '127.0.0.1';</code>然后再以默认的方式启动Redis服务就OK了。但是既然之前我说过在内部的服务中不应该使用TCP/IP sockets那我肯定是不能允许它就用默认的配置工作。 </p><p>
在Redis中倒是有支持UNIX domain sockets的选项也支持关闭监听TCP/IP Port。我按照它上面的说明配置了然后信心满满的在配置文件中设定好了。然而现实告诉我没那么简单我写了一个测试脚本它返回了一个<code class="language-plaintext highlighter-rouge">No such file or directory</code>我反复确认路径保证自己没有手残到把路径写错然后上网搜这个错误查了半天也没有什么有建设性的结果……我甚至把权限都设置为777把php-fpm加到了redis的组里都没有任何用处另外我也用redis-cli确定了那个文件确实是一个socket文件。这时候我实在是无计可施了我打算放弃就这样屈服于TCP/IP sockets然而我的强迫症和其他博客里中说的10ms不允许我放弃没办法我只好仔细思考了。 </p><p>
我觉得这个问题应该还是在于权限只是这个问题过于奇妙让我无法理解。按照默认的配置那个socket文件在/tmp/文件夹下因为PHP在上传文件的时候也用到了这个文件夹所以我也没怎么怀疑它。但是我的mysql同样也用了UNIX domain sockets只是文件在/run/下它也没出问题啊我想了想也许把这个socket文件放到/run/文件夹下就可以正常工作了。没想到还真是这个问题,随着我把配置文件中的路径修改了,它也能正常工作了……我真的是无言以对…… </p><p>
在这之后我把redis服务设置成了开机自启动然后这段优化就到此为止了。</p>
<h1 id="其他的杂事">
<a href="#其他的杂事"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 其他的杂事
</h1>
<p>其他也没什么特别多可以优化的地方,后来我查了一下,发现花火学园的请求在那天出现问题的时候请求量突然涨了一倍,也许是这个原因把之前的花火学园逼停了,所以优化还是挺重要的嘛。 </p><p>
其他方面就是对于Discuz权限的一些调整不知道为什么总有些人要在试贴区水贴真的是无法理解它们的操作另外就是连发贴的问题我感觉估计有人用发帖机搞我们的论坛所以又提高一点发帖的门槛。 </p><p>
其实这次也没什么大的改动就是这个Redis搞的我真是当场爆炸看来我还是要提高一下我的姿势水平啊23333。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%BF%90%E7%BB%B4"><em>运维</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%AC%94%E8%AE%B0"><em>笔记</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E4%BC%98%E5%8C%96"><em>优化</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-01-21-devops.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/01/21/devops.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/01/05/devops.html">
上一篇Mayx的运维笔记
</a>
</span>
<br />
<span class="next">
<a href="/2020/02/02/old.html">
下一篇:过去与未来的科技变化
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/01/21/devops', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/01/21/devops.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

351
2020/02/02/old.html Normal file
View File

@@ -0,0 +1,351 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>过去与未来的科技变化 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="过去与未来的科技变化" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="回忆了一下,总感觉最近的科技没有什么变化啊……" />
<meta property="og:description" content="回忆了一下,总感觉最近的科技没有什么变化啊……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-02-02T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="过去与未来的科技变化" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-02-02T00:00:00+08:00","datePublished":"2020-02-02T00:00:00+08:00","description":"回忆了一下,总感觉最近的科技没有什么变化啊……","headline":"过去与未来的科技变化","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/02/02/old.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/02/02/old.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/02/02/old.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-02-02T00:00:00+08:00">2 February 2020</time> - 字数统计3430 - 阅读大约需要11分钟 - Hits: <span id="/2020/02/02/old.html" class="visitors">Loading...</span></small>
<h1 class="p-name">过去与未来的科技变化</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 02 Feb 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章回忆了过去与现代科技设备的变化提到了一台20年前的华硕M1300笔记本电脑其配置陈旧但依然运行Windows XP。作者指出尽管科技设备的性能有提升但感觉创新速度减缓更多是在现有基础上的改进如处理器架构和云计算。文章提及了5G网络的发展和区块链的热潮但也对它们的实际应用提出了疑问。作者对未来保持期待认为可能是自己过于急躁科技可能需要更多时间才能带来质变。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#试用过去的设备">试用过去的设备</a><ul><li><a href="#那台古老的电脑">那台古老的电脑</a></li><li><a href="#从直板机到智能机">从直板机到智能机</a></li><li><a href="#正在写博客的旧电脑">正在写博客的旧电脑</a></li></ul></li><li><a href="#对于未来设备的看法">对于未来设备的看法</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>回忆了一下,总感觉最近的科技没有什么变化啊……<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近由于什么冠状病毒之类的事也不能出门,只能在家里宅着。不过我并不讨厌在家里,网络中有那么多事情可以看,计划有那么多没有实行,我怎么会担心无聊的事呢?那些在网络中天天说在家有一种像狗一样想往外跑的冲动 <del>那可能他们是真的狗23333</del> 那可能他们日常的生活中也没什么乐趣吧。 </p><p>
不过天天抱着手机打游戏还是看视频也不太合适总想干些什么事看着家里人翻出了几十年前的相片突然想起来家里还有一台大约有20年左右历史的电脑正好在这次找相片的时候有了找这台电脑的思路结果当然也是找到了。那既然想到找旧电脑不如把旧手机也一起翻出了看看吧。</p>
<h1 id="试用过去的设备">
<a href="#试用过去的设备"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 试用过去的设备
</h1>
<h2 id="那台古老的电脑">
<a href="#那台古老的电脑"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 那台古老的电脑
</h2>
<p>在翻出来的所有设备中可能生产日期最早的就是那台古老的电脑了吧我看了一下版权信息都是2001年的。那台电脑的型号是华硕M1300处理器是Pentium III有128MiB的运行内存和20GB的硬盘。这个配置可以说是相当的古老了它甚至还配备了一个外置的软盘驱动器。 </p><p>
这台笔记本的接口也看起来都很古老除了一个USB1.1的接口和VGA接口在现在还能见到外其他的接口我几乎都不认识。我只能看到有一堆针口的应该是一个并行接口另外还有一个看起来有点像电路板上的BTB接口一样的接口也不知道是干什么的……除此之外我还认识一个1394接口以及电话线和网线接口不过现在的我都找不到除了使用USB接口以外的设备了不用说那些奇奇怪怪的并口想想连MicroUSB接口都马上就要淘汰了1394接口哪还能见得到啊。 </p><p>
除了接口以外还有些奇奇怪怪的插槽比如说PCMCIA插槽我查了一下这个东西就相当于给笔记本电脑用的PCI-E接口在以前都认为是笔记本不可缺少的东西可惜现在的笔记本电脑都趋向于轻薄化占掉一大堆空间的PCMCIA插槽自然是没有了活路。 </p><p>
另外就是光驱,现在好多电脑上甚至连光驱都没有了……为的就是让电脑更加轻薄……这也算是科技的进步吧…… </p><p>
其他像红外线设备之类的我也没用过,所以也就不在这里多说什么了。 </p><p>
尽管这台电脑如此之旧但是一个电子设备的寿命远超常人想象它本来预装的是Windows98的系统不过让它运行WindowsXP也是绰绰有余。按下开机键后电脑就如同一架即将起飞的螺旋桨飞机一般呜呜的响了起来。不过开机速度还不错我感觉不到15s就启动到桌面了。不愧是WindowsXP还是一如既往的经典。 </p><p>
我在这台电脑上发现了一个看起来是5年前的<a href="/2015/02/23/diary.html">日记</a>,感觉还是挺有纪念意义的,于是就随手上传到了博客上。 </p><p>
另外这台电脑上没有无线网卡上网是个很困难的事情不过我在网上找了一个tetherxp.inf的配置文件插上手机倒是也勉强能用。不过这个WindowsXP上带的IE6也真的是彻底脱离了时代很多网页都打不开因为WindowsXP只支持TLS1.0以下的加密协议。也正是这个原因所以我的博客在兼容性上兼容的是IE8。 </p><p>
虽然它看起来脱离了时代但是毕竟作为那时候的生产力工具办个公还是没有问题的上面的Office2003依然可以正常使用。过了将近20年绝大多数的办公人员依然使用传统的Office办公包括学校在内PPT仍然是旧版的.ppt格式而不是.pptx格式。说不定学校的课件仍然是十几年前的课件从来没有更新过。不过给学生教的东西嘛倒是也没什么可以更新的所以用着有历史意义的课件也是能理解的。</p>
<h2 id="从直板机到智能机">
<a href="#从直板机到智能机"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 从直板机到智能机
</h2>
<p>我看了看翻出来的手机一共有7部没有一部是旗舰机……应该说还有些是山寨机不过也很正常毕竟以前的手机比较贵嘛而且工资也不高不像现在几乎所有人都不会买低端机型大多数人都使用的是旗舰机。 </p><p>
在这堆手机里我看年代最早的是Nokia 2626这个手机的充电口不是标准的充电口不过没关系我可以直接给手机电池充电。这部手机是2007年上市的也不知道是什么原因这部手机没有摄像头。这部手机唯一还比较有意思也就只有自带的类似于3D弹球的游戏。其他方面也没有什么更多有意思的地方了在搜索引擎上搜索可以找到这个手机的更多信息。 </p><p>
除了上面所说的直板机还有一个翻盖机叫做步步高I508。即使作为音乐手机它播放音乐的水平还是比不上我现在仅仅是能听个响的手机。不过毕竟不是智能手机能做到这样已经很不错了。 </p><p>
本来还想搞个滑盖机不过剩下的手机基本上都是智能机了……智能机即使很老也因为使用的是安卓系统也让我感受不到它的古老。在这堆手机里最老的是海信HS-T830系统是安卓2.3.5。貌似是充话费送的,当时我用这个手机可是干了不少事,具体的事情可以在<a href="/2019/02/01/history.html#linux-shell%E6%97%B6%E6%9C%9F">这里</a>看到。 </p><p>
其他的手机就是一堆山寨机,什么优思还是什么酷派,全是一堆杂牌子,也就没什么好说的了。</p>
<h2 id="正在写博客的旧电脑">
<a href="#正在写博客的旧电脑"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 正在写博客的旧电脑
</h2>
<p>目前我正在写博客的电脑是Dell D430看起来是2008年上市的。配置还可以处理器是Core 2 Duo有2GiB的运行内存和120GB的硬盘预装的是WindowsXP勉勉强强能带起来Windows7。 </p><p>
虽然Windows7前几天停止了维护不过既然WindowsXP都能正常使用Windows7有何不可呢这台电脑基本上和现在的电脑差不多了可惜还是没有HDMI的接口。不过自带无线网卡还是挺不错的至少正常上网没有什么问题2GiB的内存安一个Google Chrome还是绰绰有余的所以我现在在这个上面写博客也丝毫没有问题。 </p><p>
另外我在这个电脑上发现了一个东西它让我又一次的感受到了SEO的重要性它的名字叫做pkmnEMU貌似是以前下的据说是在暗网上的游戏我在某搜索引擎搜索这个关键词时结果搜到了一本小说看起来是一个丝毫不担心版权问题的科幻小说偏偏我就喜欢这类的于是很遗憾的我就入坑了😂……SEO……真的是太重要了……</p>
<h1 id="对于未来设备的看法">
<a href="#对于未来设备的看法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 对于未来设备的看法
</h1>
<p>从上面所说的设备来看,我感觉现在的科技似乎发展的没有那么快了。也许是期望过高,现在的设备变化并不大,唯一变化的就是更好的性能,更优秀的程序和更先进的应用模式。但是本质没有变,电脑还是那个电脑,手机还是那个手机。也许是厂家的兼容性让我误认为科技没有发展,又也许是某些厂家的垄断性让其他新的东西没有生产的机会。总之,现在科技的进步让我感觉就是挤牙膏,只有纵向缓慢的发展,没有横向大范围的跃进。 </p><p>
变化的总是一些平常人看不出来的地方虽然像生物计算机和量子计算机仍然没有商业化但是处理器的结构貌似已经和原来不一样了。尽管都是X86或X64以及ARM的架构但是也许实现方式不一样了呢。不过具体到底有没有进步我真的是看不出来只希望这些厂家厚积薄发能让我感觉到质的变化吧。 </p><p>
未来的设备我无法想象可能真的不再在硬件上做进步像现在大多数公司都更愿意在软件上进行改进像什么云计算之类的也就是一些新的概念不过基础没有变软件不过是在原有的基础上加东西这倒也不是不能理解毕竟要考虑到兼容性不能为了新的东西就不顾旧的东西。像HTTP/3它就是为了兼容性才用了UDP协议作为底层。不过令我感到糟糕的是DoT/DoH之所以使用UDP作为DNS协议的底层不就是为了快速嘛结果它还来一个在TCP上加密那样延迟怎么下的来 </p><p>
像现在出现的5G网络也是不可思议现在大多数家庭都达不到千兆网络甚至许多网站服务器带宽也达不到千兆5G到千兆网络有什么意义在大多数时候需要用千兆的时候用光纤它不好吗需要无线用Wifi6它不好吗我实在是很难想到5G的实际用途。不过未来也很难预测6G如果是运行在卫星上那当然是真的有意义但是5G的发展目前我实在是想不明白不过既然那么多专家都对5G抱有信心那就看看它能怎么样吧。 </p><p>
不过这又让我回想起区块链了,前几个月区块链火了,仅仅是因为领导人说区块链很重要……不过几个月过去了我依然没看到这个区块链有什么应用。 </p><p>
我对未来还是抱有希望的,之所以我觉得现在发展变慢了,也许是我太着急了,再过几年吧,如果真的有质的变化,那么以后再回来看这篇文章也许就会感到人类真的还是有些能力的,但是如果没有发展,那我就看看我还能等到什么时候吧!</p>
<p>P.S.今天是<a href="https://archiveprogram.github.com/">Github Archive Program</a>的截止日期,我之前写了<a href="/2019/11/18/archive.html">一篇文章</a>介绍它。希望过了这个截止日期后Github能把我的博客收录到GitHub Arctic Code Vault里这样我的博客说不定千年以后还有人能看到呢23333</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%A7%91%E6%8A%80"><em>科技</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-02-02-old.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/02/02/old.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/01/21/devops.html">
上一篇Mayx的运维笔记 - 应用优化
</a>
</span>
<br />
<span class="next">
<a href="/2020/02/10/tieba.html">
下一篇如何不使用贴吧App查看贴吧
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/02/02/old', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/02/02/old.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

358
2020/02/10/tieba.html Normal file
View File

@@ -0,0 +1,358 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>如何不使用贴吧App查看贴吧 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="如何不使用贴吧App查看贴吧" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="为自己手机的最后一片净土而战(ง •_•)ง" />
<meta property="og:description" content="为自己手机的最后一片净土而战(ง •_•)ง" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-02-10T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="如何不使用贴吧App查看贴吧" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-02-10T00:00:00+08:00","datePublished":"2020-02-10T00:00:00+08:00","description":"为自己手机的最后一片净土而战(ง •_•)ง","headline":"如何不使用贴吧App查看贴吧","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/02/10/tieba.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/02/10/tieba.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/02/10/tieba.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-02-10T00:00:00+08:00">10 February 2020</time> - 字数统计1965 - 阅读大约需要6分钟 - Hits: <span id="/2020/02/10/tieba.html" class="visitors">Loading...</span></small>
<h1 class="p-name">如何不使用贴吧App查看贴吧</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Mon, 10 Feb 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者由于不想使用百度贴吧App通过编程技能找到了绕过App直接访问贴吧帖子的方法。作者发现通过在特定URL后添加帖子ID可以查看帖子全文但这个方法不能用于发帖。他参考以前的代码写了一个PHP脚本用于从网页版贴吧获取帖子列表并提供了演示链接。作者对于百度和知乎强制用户下载App的行为表示不满认为这会阻碍用户流畅的在线体验。同时他也提到了其他平台上也有类似的小程序。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#解决方案">解决方案</a></li><li><a href="#代码">代码</a></li><li><a href="#演示">演示</a></li><li><a href="#后记">后记</a></li><li><a href="#真相">真相</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>为自己手机的最后一片净土而战(ง •_•)ง<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>由于某些原因,我还是很想上百度贴吧看看的。虽然一些大公司很流氓,但也正因为他们是大公司,所以积累的信息才更多…… </p><p>
一年前,我因为使用百度搜索时打不开搜索内容,所以不得不<a href="/2019/05/12/baidu.html">使用了一些办法</a>来解决这个问题。不过看起来百度也知道自己这么做是在砸自家招牌,所以后来这个问题百度貌似他们自己解决了。 </p><p>
而现在呢我又因为某些原因需要使用百度贴吧当然安装贴吧App就是在侮辱我的手机。一般来说遇到这个问题只要用桌面版的贴吧就好了但是很遗憾的是我用的浏览器是基于WebView的Firefox Rocket不支持更改UA……既然如此我只好运用我编程的技能解决这个问题了。</p>
<h1 id="解决方案">
<a href="#解决方案"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 解决方案
</h1>
<p>在正常情况下用手机看贴吧的贴子是看不到全部内容的只能看到前两楼当然这样的贴吧就是废物要想看剩下的内容就需要下载贴吧App了。不过以前贴吧有一个极简版虽然很简陋但是也够用了。然而很糟糕的是百度他们不允许极简版列出贴子的标题了如果用极简版看贴吧的话是看不到贴子的列表的。 </p><p>
不过如果知道贴子的ID貌似还是能正常打开的所以我们只需要获得到贴子的列表和ID就OK了。 </p><p>
经过我的研究,只要在<code class="language-plaintext highlighter-rouge">http://tieba.baidu.com/mo/q-----1----/m?kz=</code>后面加上贴子的ID就能看到贴子的全部内容只是这个貌似不能发帖不过我也不需要这个就是了。 </p><p>
于是我参考了以前<a href="/2019/04/13/iwara.html">Iwara Viewer</a>的代码,写出了最终的代码。</p>
<h1 id="代码">
<a href="#代码"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 代码
</h1>
<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?php</span>
<span class="k">if</span> <span class="p">(</span><span class="k">isset</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"kw"</span><span class="p">]))</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">isset</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"pn"</span><span class="p">]))</span> <span class="p">{</span>
<span class="nv">$_GET</span><span class="p">[</span><span class="s2">"pn"</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="nv">$url</span> <span class="o">=</span> <span class="s1">'https://tieba.baidu.com/f?kw='</span><span class="mf">.</span><span class="nb">iconv</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">,</span><span class="s2">"gb2312"</span><span class="p">,</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"kw"</span><span class="p">])</span><span class="mf">.</span><span class="s1">'&amp;pn='</span><span class="mf">.</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"pn"</span><span class="p">]</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="mi">50</span><span class="p">;</span>
<span class="nv">$str</span> <span class="o">=</span> <span class="nb">file_get_contents</span><span class="p">(</span><span class="nv">$url</span><span class="p">);</span>
<span class="nv">$preg</span><span class="o">=</span><span class="s1">'/&lt;a rel="noreferrer" href="\/p\/(.*?)" title="(.*?)" target="_blank" class="j_th_tit "&gt;/is'</span><span class="p">;</span>
<span class="nb">preg_match_all</span><span class="p">(</span><span class="nv">$preg</span><span class="p">,</span><span class="nv">$str</span><span class="p">,</span><span class="nv">$match</span><span class="p">);</span><span class="c1">//在$str中搜索匹配所有符合$preg加入$match中</span>
<span class="k">echo</span> <span class="s2">"&lt;title&gt;Mayx Tieba Viewer&lt;/title&gt;&lt;h1&gt;Mayx Tieba Viewer&lt;/h1&gt;&lt;hr /&gt;"</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$http_response_header</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s2">"HTTP/1.0 200 OK"</span><span class="p">){</span>
<span class="k">echo</span> <span class="s2">"&lt;b&gt;Warning&lt;/b&gt;:It's Not Tieba Name&lt;br&gt;"</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">for</span><span class="p">(</span><span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="nv">$i</span><span class="o">&lt;</span><span class="nb">count</span><span class="p">(</span><span class="nv">$match</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span><span class="nv">$i</span><span class="o">++</span><span class="p">)</span><span class="c1">//逐个输出超链接地址</span>
<span class="p">{</span>
<span class="k">echo</span> <span class="s2">"&lt;a href=</span><span class="se">\"</span><span class="s2">http://tieba.baidu.com/mo/q-----1----/m?kz="</span><span class="mf">.</span><span class="nv">$match</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="nv">$i</span><span class="p">]</span><span class="mf">.</span><span class="s2">"</span><span class="se">\"</span><span class="s2">&gt;"</span><span class="mf">.</span><span class="nv">$match</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="nv">$i</span><span class="p">]</span><span class="mf">.</span><span class="s2">"&lt;/a&gt;&lt;br&gt;"</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">echo</span> <span class="s2">"&lt;hr&gt;&lt;a href=</span><span class="se">\"</span><span class="s2">?pn="</span><span class="mf">.</span><span class="p">(</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"pn"</span><span class="p">]</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="mf">.</span><span class="s2">"&amp;kw="</span><span class="mf">.</span><span class="nv">$_GET</span><span class="p">[</span><span class="s2">"kw"</span><span class="p">]</span><span class="mf">.</span><span class="s2">"</span><span class="se">\"</span><span class="s2"> &gt;Next Page&lt;/a&gt;"</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="k">echo</span> <span class="s1">'&lt;title&gt;Mayx Tieba Viewer&lt;/title&gt;&lt;h1&gt;Mayx Tieba Viewer&lt;/h1&gt;&lt;hr&gt;&lt;form action="" method="get"&gt;Please Input Tieba Name:&lt;input type="text" name="kw" required&gt;&lt;input type="submit" value="Submit"&gt;&lt;/form&gt;'</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></div>
<p>虽然说用JavaScript貌似也可以做到可惜我学艺不精只好用PHP解决了。</p>
<h1 id="演示">
<a href="#演示"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 演示
</h1>
<p><a href="https://yuri.gear.host/tiebaview.php">https://yuri.gear.host/tiebaview.php</a></p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>P.S.这个东西是专门为了手机设计的,所以电脑完全没必要使用这个看帖子。 </p><p>
另外就是希望百度做个人吧……HTML肯定是能实现相应功能的非要人下载App虽然我也知道是为了利益但是这真的是太恶心了……另外……知乎也一样太恶心最终一定会流失掉用户的。</p>
<h1 id="真相">
<a href="#真相"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 真相
</h1>
<p>我不知道的是很多的小程序上也有贴吧,像微信上也有,白做了😂……算了,就当练手+氵一篇了23333</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%B4%B4%E5%90%A7"><em>贴吧</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=PHP"><em>PHP</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-02-10-tieba.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/02/10/tieba.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/02/02/old.html">
上一篇:过去与未来的科技变化
</a>
</span>
<br />
<span class="next">
<a href="/2020/02/15/phone.html">
下一篇:关于对未来手机的想象
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/02/10/tieba', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/02/10/tieba.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

346
2020/02/15/phone.html Normal file
View File

@@ -0,0 +1,346 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于对未来手机的想象 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于对未来手机的想象" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="我听说洗澡的时候思维最发散(笑)" />
<meta property="og:description" content="我听说洗澡的时候思维最发散(笑)" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-02-15T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于对未来手机的想象" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-02-15T00:00:00+08:00","datePublished":"2020-02-15T00:00:00+08:00","description":"我听说洗澡的时候思维最发散(笑)","headline":"关于对未来手机的想象","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/02/15/phone.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/02/15/phone.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/02/15/phone.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-02-15T00:00:00+08:00">15 February 2020</time> - 字数统计2413 - 阅读大约需要8分钟 - Hits: <span id="/2020/02/15/phone.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于对未来手机的想象</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sat, 15 Feb 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章作者讨论了对未来手机设计的想象,认为手机不应该单纯追求性能的堆砌,而应向更节能、低成本、连接高性能服务器的方向发展,即所谓的“云手机”概念。作者提出手机主要负责显示和控制,而运算交给服务器处理,这样可以降低手机成本,延长电池寿命,并且可以根据用户需求提供不同配置。文章还提及了云手机可能的经济模型,如根据实际使用频率计费,以及在设计上强调屏幕和电池的重要性,而主板和其他附加功能保持简单。作者对这种模式的前景充满信心,并表示如果有条件,愿意尝试创业实现这一设想。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#对手机与性能的看法">对手机与性能的看法</a></li><li><a href="#未来的手机云手机">未来的手机:云手机</a><ul><li><a href="#设计内容">设计内容</a></li></ul></li><li><a href="#附加的优点">附加的优点</a></li><li><a href="#我的计划">我的计划</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>我听说洗澡的时候思维最发散(笑)<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>前两天小米10发布了看着那最高将近6000CNY的手机我沉默了…… </p><p>
昨天我在洗澡的时候正好就在想关于手机的事手机越来越贵看起来似乎成为了趋势当然对于小米10Pro来说它的技术是应该值那样的价钱。但是我觉得这不应该是未来手机的发展未来的手机绝对不是将越来越多的东西堆到一个砖头大的小盒子里于是在我洗澡的时候就回想起了以前对未来设备的想象。</p>
<h1 id="对手机与性能的看法">
<a href="#对手机与性能的看法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 对手机与性能的看法
</h1>
<p>因为以前做过<a href="https://github.com/Mabbs/Mabbs">Telnet BBS</a>所以我对Telnet与当时的历史了解的也比较深。我听说以前的电脑算力十分的差当人们需要计算一些比较复杂的东西就会通过Telnet连接到算力更强的电脑上去计算那些东西。但是随着现在个人电脑的计算能力越来越强以及对于安全性的需要Telnet成为了历史的记忆。 </p><p>
像我的服务器才1h1g而现在买到的电脑甚至都可以是几十核真的是不能比……不过对于手机来说配置再高的手机运算能力也完全比不过电脑毕竟功耗在那里放着电脑里可以搞一个巨大的风扇或者是一套复杂的水冷系统。但是手机主要还是便携性搞一堆复杂的散热系统也不现实就更不用说供电的问题了。 </p><p>
让手机有着更好的性能从这个角度来看似乎是没有意义的,更好的性能要么更耗电,要么就用更好的生产工艺与设计,然而这样会更贵……所以我觉得手机向着更好的性能发展是不合理的发展趋势。 </p><p>
综上所述,我觉得可以把手机的算力设计到很低,这样无论从耗电发热还是从成本来说都很低。然后让手机去连接运算能力更强的服务器,在那个上面去运行需要用到运算能力的程序,这样我们就可以去掉手机上所有的散热设备,以及各种各样的附件,用以增大电池的空间,或者让手机更薄。 </p><p>
我之所以这样想主要还有一个原因那就是旧手机的问题。我有一部5年前的华为麦芒4它的CPU是骁龙616的算力十分垃圾被淘汰是应该的。但是它的屏幕是1080P的屏幕和我目前使用的红米K20Pro的屏幕像素密度差不多虽然材质不一样。即使到现在大多数的旗舰机也都使用的是1080P的屏幕。既然如此这个屏幕还是完好无损且同样更得上时代的情况下仅仅是因为处理器过时了就被时代淘汰了不是显得浪费吗</p>
<h1 id="未来的手机云手机">
<a href="#未来的手机云手机"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 未来的手机:云手机
</h1>
<p>所以我想了一种新的手机设计方案,那就是云手机。虽然云手机的理念提出了很长时间,但是不知道为什么出的都是为电脑工作的云手机,而不是真正为手机服务的云手机。或者说仅仅做为单独的应用使用的云手机,比如云存储还是什么云服务啥的……总而言之,目前的云手机完全没有融入使用者的生活,仅仅是作为一种辅助。 </p><p>
如果说可以制造一种手机,主要的成本全部在屏幕和电池上,然后这个手机在没有联网时唯一能做的就是打电话,而联网时连接到远程服务器上就可以像正常的手机一样上网聊天打游戏,所有的操作全部由服务器进行运算,然后通过远程桌面的协议在手机上进行表达。 </p><p>
现在的远程桌面协议已经很多了像什么VNC、RDP还有什么SPICE所以说我觉得从技术上来说服务器负责运行程序而手机只负责控制与显示这样手机也不再耗电可能充一次可以用个两三天在打游戏时也不再发烫和卡顿网络原因除外而且也可以根据自己的需要得到相应的配置价格也会更加便宜。</p>
<h2 id="设计内容">
<a href="#设计内容"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 设计内容
</h2>
<ol>
<li>关于服务器的配置 </p><p>
现在的虚拟化技术也非常成熟了什么弹性计算之类的也做的很不错了。像大多数时候当人们不再使用手机的时候手机事实上是在空载状态的最多就是聊天信息需要随时到达。那么大多数情况我们的手机可能只需要一核CPU就可以满足需要对于ARM的CPU一核的运行成本应该很低吧而在人们打游戏的时候需要的更多核服务器也可以想提供多少就能提供多少吧而且这个还能挂机。那么我们就可以进行定价比如手机平时使用一核突发性使用四核这个成本也没多高1天1CNY应该也不亏吧或者根据实际使用计算价格一年下来可能也就花个400CNY左右吧这也不算贵嘛正常买一部高性能手机也要花2000-3000CNY吧但是实际用个2-3年也就淘汰了嘛。</li>
<li>关于手机的设计 </p><p>
现在的手机主要成本屏幕占的应该也不算太多换个屏幕也就300-400CNY左右吧我觉得主要成本应该还是在主板上。但是如果说这个主板除了联网打电话加个定位和WiFi顺便来个5MP能扫码的后摄应该也没多贵吧200CNY总能拿下吧想拍照为啥不买微单呢电池就更不用说了200CNY买个4000mAh的电池应该轻轻松松吧700CNY出一个超长待机屏幕又大又清晰的手机即使对于山寨机来说都是轻轻松松吧700CNY的手机如果说加上每年400CNY的云手机费用性能能和目前4000CNY的手机相比那我觉得还是挺划算的吧</li>
</ol>
<p>最终成本也不高,消费者也能负担的起,然后服务商也能持续从消费者那里拿钱,岂不美哉?</p>
<h1 id="附加的优点">
<a href="#附加的优点"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 附加的优点
</h1>
<p>我们也不一定只提供Android系统同样如果有必要也可以提供Windows系统顺便卖个没有运算能力的平板和电脑盒子系统可以互相相互连接在平板上既可以操作手机的系统随时也可以操作电脑的系统两个系统硬盘可以相互访问也就没必要再导来导去的了。毕竟这时候手机、平板、电脑都成为了真正意义的终端一切服务都在服务器上完成。 </p><p>
还有一个优点这时候终端的网速将不再重要重要的是与服务器连接的稳定性服务器本身的带宽自然是超级大毕竟连的都是光纤延迟也极其的小实际的延迟在于终端操作与服务器的延迟上不过我觉得随着现在网络的发展家里的延迟由WiFi6去缩小家外的延迟由5G去缩小最终一定能得到与原生一般的操作体验。</p>
<h1 id="我的计划">
<a href="#我的计划"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 我的计划
</h1>
<p>如果说在我大三的时候这样的手机还没有出现在市场上我就有了创业的冲动突然理解了为什么大学生想出去创业想办法去拉众筹、投资与贷款然后看看自己能不能搞到人脉去和华强北的大佬们一起研发出这样的手机23333 </p><p>
如果真的能造出这样的手机以及这样的服务,我觉得一定会有市场的。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%9C%AA%E6%9D%A5"><em>未来</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%89%8B%E6%9C%BA"><em>手机</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-02-15-phone.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/02/15/phone.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/02/10/tieba.html">
上一篇如何不使用贴吧App查看贴吧
</a>
</span>
<br />
<span class="next">
<a href="/2020/02/18/browser.html">
下一篇Mayx的浏览器使用史
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/02/15/phone', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/02/15/phone.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

324
2020/02/18/browser.html Normal file
View File

@@ -0,0 +1,324 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Mayx的浏览器使用史 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="Mayx的浏览器使用史" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="我感觉遇到了不错的浏览器" />
<meta property="og:description" content="我感觉遇到了不错的浏览器" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-02-18T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Mayx的浏览器使用史" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-02-18T00:00:00+08:00","datePublished":"2020-02-18T00:00:00+08:00","description":"我感觉遇到了不错的浏览器","headline":"Mayx的浏览器使用史","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/02/18/browser.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/02/18/browser.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/02/18/browser.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-02-18T00:00:00+08:00">18 February 2020</time> - 字数统计1420 - 阅读大约需要5分钟 - Hits: <span id="/2020/02/18/browser.html" class="visitors">Loading...</span></small>
<h1 class="p-name">Mayx的浏览器使用史</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Tue, 18 Feb 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者对浏览器使用的经历转变。从最初默认使用系统自带浏览器因为广告过多而开始尝试Firefox。由于意外卸载了Firefox作者转向了Firefox Lite原Firefox Rocket后来发现其功能有限。通过Via浏览器作者找到了满足需求的小巧、功能丰富的替代品尤其是其自定义选项、性能和基于WebView的优点。作者对国内厂商如华为、小米和腾讯等自家浏览器内核的批评表示不解为何不直接使用先进的WebView而偏选择占用更多资源、降低性能的非标准方案。最后作者推测Firefox为中国和印度提供特供版可能是因为适应本地需求。</p>
<hr />
<ul><li><a href="#最初的改变">最初的改变</a></li><li><a href="#意外发生">意外发生</a></li><li><a href="#偶然遇见">偶然遇见</a></li><li><a href="#技术分析">技术分析</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>我感觉遇到了不错的浏览器<!--more--></p>
<h1 id="最初的改变">
<a href="#最初的改变"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 最初的改变
</h1>
<p>以前我对浏览器没有什么要求,所以一般都用的是系统自带的浏览器。但是最近几年各大厂商都开始犯病,在浏览器里疯狂加广告,所以没办法,我只好选择其他的浏览器。 </p><p>
我选择浏览器也是近几年才做的事,因为厂商也是最近几年才开始在系统里加广告。 </p><p>
我最初的选择是Firefox因为我听说Firefox的历史悠久从很久以前浏览器出现的时候Firefox就已经出现了只是当时它好像叫Netscape来着。总之就是对Firefox有一些好感然后就一直用Firefox了即使我后来换了手机也一直用的是Firefox。</p>
<h1 id="意外发生">
<a href="#意外发生"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 意外发生
</h1>
<p>不知道我是怎么了就手残了偶然有一次不知道我是想清除缓存呢还是想强行停止Firefox结果手残点到卸载上了……而且更加不可思议的是下一步我还点到确认键上了……结果我的浏览器就随着我的一大堆书签消失不见了…… </p><p>
当时貌似我周围没有WiFi只有流量再下一遍Firefox有点太费了不过我在搜索Firefox的时候发现了Firefox Lite原Firefox Rocket大小只有几MiB是给中国和印度的特供版。我查了一下貌似是北京谋智公司搞的说实话我不太放心这个公司但是当时也没有想太多然后就一直用着了。 </p><p>
不过这个浏览器的功能是真的少垃圾的以至于UA也改不了网页源代码也看不了更不用说什么插件啥的……不过我想我不过是用手机上个网罢了也不打算干什么复杂的事情所以也就忍了。 </p><p>
后来想上贴吧因为这个破浏览器不能改UA所以我只好<a href="/2020/02/10/tieba.html">使用PHP</a>解决这个问题。</p>
<h1 id="偶然遇见">
<a href="#偶然遇见"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 偶然遇见
</h1>
<p>我后来想了想,也许上不了贴吧是我的问题,解决方案可能比我想象的更多,比如说换浏览器之类的,不过问题已经解决了我也就没多想。 </p><p>
不过没过几天我偶然看见了一个浏览器叫做Via大小只有几百KiB功能还比Firefox Lite多。这时候我就没理由不换浏览器了。 </p><p>
换成Via后发现这个功能比我想象的更多不仅主页可以自定义而且可以自定义UA、查看源代码、屏蔽广告也可以装插件这个功能甚至比Firefox本身都多了大小还小了几十倍。 </p><p>
不仅如此里面的插件完美的解决了贴吧的问题这再一次打击了我写垃圾代码的信心lol。 </p><p>
然后我觉得我以后应该不会再换浏览器了。</p>
<h1 id="技术分析">
<a href="#技术分析"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 技术分析
</h1>
<p>我实在是不能理解某些大厂的做法像华为自带的浏览器是UC提供的内核还是Webkit小米的浏览器是直接是Chromium套了层壳顺便还加了一堆广告结果Chromium还是32位的。而腾讯系的软件也是搞的什么X5内核结果还是基于Webkit的越改越烂。 </p><p>
明明谷歌为Android系统配了WebView为什么就不能好好用呢这个WebView基于的还是最新的Chrome呢全球最先进的浏览器这些厂商非要自己瞎搞增加了空间还降低了性能然后还不符合标准真不知道他们到底在搞什么。 </p><p>
像Firefox Lite和Via浏览器就是基于WebView的空间又小性能又好而且到时候升级只用升WebView就OK了。后来我发现用腾讯X5内核的还不只是腾讯系软件连哔哩哔哩居然都在用真是可耻啊不过还好这个内核腾讯还留了一个后门好像是<a href="http://debugtbs.qq.com">http://debugtbs.qq.com</a>用这个就可以不使用X5内核而改用WebView内核了。 </p><p>
感觉真是不理解国内的某些互联网公司在搞什么操作也许就是这个原因Firefox才会为中国和印度提供特供版的浏览器吧23333</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%B5%8F%E8%A7%88%E5%99%A8"><em>浏览器</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-02-18-browser.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/02/18/browser.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/02/15/phone.html">
上一篇:关于对未来手机的想象
</a>
</span>
<br />
<span class="next">
<a href="/2020/03/01/plan.html">
下一篇:对于云手机的策划书
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/02/18/browser', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/02/18/browser.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

550
2020/03/01/plan.html Normal file
View File

@@ -0,0 +1,550 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>对于云手机的策划书 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="对于云手机的策划书" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="策划?不存在的!" />
<meta property="og:description" content="策划?不存在的!" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-03-01T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="对于云手机的策划书" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-03-01T00:00:00+08:00","datePublished":"2020-03-01T00:00:00+08:00","description":"策划?不存在的!","headline":"对于云手机的策划书","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/03/01/plan.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/03/01/plan.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/03/01/plan.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-03-01T00:00:00+08:00">1 March 2020</time> - 字数统计6187 - 阅读大约需要18分钟 - Hits: <span id="/2020/03/01/plan.html" class="visitors">Loading...</span></small>
<h1 class="p-name">对于云手机的策划书</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 01 Mar 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章策划了远程云手机RCP一种基于云计算和5G技术的移动通讯设备。它通过分拆为低成本控制终端和高性能远程服务器提供了价格低廉、性能强大且节省资源的手机体验。文章提出市场机会在于手机价格上涨与性能需求矛盾云手机有望填补中低端市场采用无差异营销策略。团队构成包括四部分技术与生产是最具挑战性的资金、人才和市场推广是关键。文章分析了市场竞争环境云手机有望在众多手机厂商中脱颖而出特别是在5G时代。市场调查表明云手机凭借成本优势和运行速度将吸引中高端用户特别是在迭代换新需求强烈的市场。通过详细的战略规划公司预计在成本控制、技术创新和目标市场定位上取得竞争优势。</p>
<hr />
<ul><li><a href="#前言">前言</a></li><li><a href="#一执行总结">一、执行总结</a><ul><li><a href="#一概念产品概述">一、概念产品概述</a></li><li><a href="#二面临的市场机会和目标市场定位">二、面临的市场机会和目标市场定位</a></li><li><a href="#三市场环境与竞争优势">三、市场环境与竞争优势</a></li><li><a href="#四团队概述">四、团队概述</a></li><li><a href="#五经济状况和盈利能力预测">五、经济状况和盈利能力预测</a></li><li><a href="#六所需资源和所提供的利益">六、所需资源和所提供的利益</a></li></ul></li><li><a href="#二产业背景和市场竞争">二、产业背景和市场竞争</a></li><li><a href="#三市场调查和分析">三、市场调查和分析</a><ul><li><a href="#一目标市场的定位与分析">一、目标市场的定位与分析</a></li><li><a href="#二市场容量估算和趋势预测">二、市场容量估算和趋势预测</a></li><li><a href="#三竞争格局分析和竞争优势">三、竞争格局分析和竞争优势</a></li><li><a href="#四估计的市场份额和销售额">四、估计的市场份额和销售额</a></li><li><a href="#五市场发展的趋势">五、市场发展的趋势</a></li></ul></li><li><a href="#四公司战略">四、公司战略</a><ul><li><a href="#一商业模式">一、商业模式</a></li><li><a href="#二公司的研发方向和产品线扩张策略">二、公司的研发方向和产品线扩张策略</a></li><li><a href="#三主要的合作伙伴与竞争对手等">三、主要的合作伙伴与竞争对手等</a></li></ul></li><li><a href="#五关键的风险和问题">五、关键的风险和问题</a><ul><li><a href="#一技术方面">一、技术方面</a></li><li><a href="#二市场方面">二、市场方面</a></li><li><a href="#三财务方面">三、财务方面</a></li></ul></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>策划?不存在的!<!--more--></p>
<h1 id="前言">
<a href="#前言"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 前言
</h1>
<p>我写了<a href="/2020/02/15/phone.html">对未来手机的想象</a>这篇文章之后,突然想起来学校最近搞了一个创新比赛,反正在家里也是闲着,就打算和同学一起参考我的文章搞一下。 </p><p>
不过我只对写我的博客感兴趣,对写像什么调查之类乱七八糟的东西没什么兴趣,然后我就把策划书的大部分内容交给了那个同学,自己就主要写一下大概的方向。 </p><p>
当然作为人来说,他看起来也对写这种东西不怎么感兴趣,瞎编一部分又从网上找了些资料,写了一半就打算就这么交差。不过其实我对这个东西也没抱多大期望,就当给延长的假期找个乐子吧。 </p><p>
那么接下来就是主要内容了:</p>
<h1 id="一执行总结">
<a href="#一执行总结"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一、执行总结
</h1>
<h2 id="一概念产品概述">
<a href="#一概念产品概述"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一、概念产品概述
</h2>
<p>远程云手机(Remote Cloud Phone简称“RCP”)是基于远程控制与虚拟化技术的移动通讯设备该产品运用云计算与5G技术提高了资源的利用率大大降低了手机的生产成本和实际运算成本。 </p><p>
该产品主要分为两部分,一部分是价格低廉,且有着强大续航能力的控制与显示终端,另一部分是计算力强大,且无需考虑电能消耗的远程云计算平台。 </p><p>
控制与显示终端利用5G的低延时和高效的传输来尽可能的模拟真实手机的使用效果由于计算不在本地所以本地设备的电能消耗和发热都可以做到相当低。远程云计算平台使用虚拟化技术进行动态的弹性计算既能提高能效比又可以提高实际的运算能力。由于远程云计算完全不需要考虑发热量和电能消耗所以也可以提供无限的计算能力。</p>
<h2 id="二面临的市场机会和目标市场定位">
<a href="#二面临的市场机会和目标市场定位"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 二、面临的市场机会和目标市场定位
</h2>
<p>市场机会: </p><p>
外部环境:随着手机科技含量的逐步提高,导致手机价格不断上涨,人民群众对于高科技手机日渐增长的需求与手机不断增长的价格产生了矛盾,人们需要一种价格相对较低,又能满足需求的较高性能的手机。 </p><p>
内部环境:虚拟化技术与远程服务器已经成熟,并且这两项也是云手机的实现最为重要的技术。 </p><p>
目标市场定位:由于手机市场还未有完整成熟的云手机产业链,所以应该先占据市场金字塔的中层,依靠成本低的优势开拓市场。针对于云手机现在的状况,应该采用无差异营销战略,集中研发中端产品。</p>
<h2 id="三市场环境与竞争优势">
<a href="#三市场环境与竞争优势"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 三、市场环境与竞争优势
</h2>
<p>市场环境:目前,多家公司已经迈进了“云手机”大门,瞄准了“云端”,共同发力智能手机市场。但仍没有做到彻底意义上的云手机,云手机的市场尚未达到饱和,仍有发展潜力 </p><p>
竞争优势:云手机比起普通智能手机,有几处非常大的优势。</p>
<ol>
<li>存储优势:云手机本身没有存储功能,所有存储都将“云存储”在服务器中,节省了普通智能手机中的内存条空间。</li>
<li>价格优势:云手机几乎所有的计算与渲染工作全部交给了远程服务器,因此云手机产品主要关注于云手机的外观、屏幕分辨率、摄像头分辨率、电池容量,少了许多硬件的安装,手机成本自然降低。</li>
<li>电量持久性优势:手机由于少了许多硬件的安装,手机内部空间变大,可以安装更大容量的电池,并且由于“云手机”在真正工作时,只起到显示的作用,因此电量持续时间可以更久,不会由于工作太久而发热,不影响用户操作体验。</li>
<li>网速更快:由于所有的计算与渲染工作全部交给了远程服务器,远程服务器的运算速度肯定是大于手机本身的,所以可以提高网速,带给用户极致体验。</li>
</ol>
<h2 id="四团队概述">
<a href="#四团队概述"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 四、团队概述
</h2>
<p>团队分为四块主体:营销、策划、技术人员和生产。 </p><p>
技术与生产是最为困难的部分。技术人员主要依靠招聘相关专业高素质人才,生产项目依托给华强北,营销策划另外招聘相关专业人员。</p>
<h2 id="五经济状况和盈利能力预测">
<a href="#五经济状况和盈利能力预测"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 五、经济状况和盈利能力预测
</h2>
<p>创业初期资金紧张,主要依靠企业投资和创始者资金众筹。 </p><p>
由于云手机概念并未普及,前期需要进行大量宣传,资金主要花在了研发、广告宣传、服务器等设备的购买上。企业前几个季度必然是亏损为主,但后几个季度会趋之平稳,待云手机的优势宣传普及民众,必然会有更多的消费者购买。</p>
<h2 id="六所需资源和所提供的利益">
<a href="#六所需资源和所提供的利益"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 六、所需资源和所提供的利益
</h2>
<p>企业的经首先营需要资金支持,人才资源支持、场地支持 </p><p>
云手机两大核心技术是虚拟机技术与远程服务器技术需要购买服务器因为安卓在ARM指令集运行效率最高所以最好买ARM指令集的服务器。 </p><p>
由于手机的原本功能都由服务计算,不需要在手机中再安装过多芯片所以能为制造手机商减少硬件安装成本。服务器集群,可以在服务器空闲状态出售空闲算力,获得资金,还可以进行品牌宣传。</p>
<h1 id="二产业背景和市场竞争">
<a href="#二产业背景和市场竞争"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 二、产业背景和市场竞争
</h1>
<p>产业背景:目前,多家公司已经迈进了“云手机”大门,瞄准了“云端”,共同发力智能手机市场。但仍没有做到彻底意义上的云手机,云手机的市场尚未达到饱和,仍有巨大的发展潜力。手机科技含量逐步提高,导致手机价格不断上涨,中低端消费者对于高科技手机的需求日渐增长,但手机价格不断增长,人们需要一种价格相对较低,又能满足需求的较高性能的手机。 </p><p>
市场竞争环境: </p><p>
多家公司迈进了“云手机”大门。 </p><p>
苹果先行一步基于原有的MobileMe功能全新改写而成的苹果iCloud服务iCloud正式对全球的苹果开发者开放。 </p><p>
国内的手机厂家也不甘落后阿里巴巴、小米、腾讯纷纷开始发力。2011年8月阿里巴巴推出的“阿里云”手机介入智能手机市场。手机系统是自主研发“云智能OS”采用Cloud App方式用户无需在手机端下载应用只要在网络环境下登陆统一的云账号就可以运行OS平台上的各种应用如阿里浏览器、阿里搜索、手机旺旺等。腾讯已经和华为合作推出了包含19款QQ应用的手机其和中国电信深度定制的手机QPhone操作系统也在加快面世的速度。小米更是发布首台智能手机以攻城略地。 </p><p>
2011年9月百度和戴尔也瞄准了“云端”共同发力智能手机市场。2011百度世界大会上百度创始人兼CEO李彦宏就流传已久的“百度手机”透露了相关信息。“我们应该已经跟一家国际手机厂商达成了协议”。最终中国搜索引擎巨头百度将携手全球第二大PC制造厂商戴尔公司共同开发智能手机以及平板电脑。双方合作的手机产品预计将于11月—12月期间上市销售。与此同时百度在本次大会上还发布了移动终端操作系统“百度易”并开始向第三方开发商抛出橄榄枝。不难看出百度进军移动互联网领域的目标正在有条不紊的进行着。 </p><p>
与此同时不少厂商还瞄准了老人手机市场其中2012年3月国内首款云老人手机由沃爱思推出。其将云服务功能用于老人手机实现了子女远程即可操作控制父母手机的全新体验。只需轻松通过web端即可达到子女身边电脑和父母的沃爱思云服务手机之间的连接内容变更、设置设定等就可以变成一件没有距离的事情。可以为老人进手机的所有设置可以远程管理设置远程定位、健康资料、联系人、图铃、闹钟、桌布时间与日期、键盘、高级设置、手机模式等菜单功能。</p>
<h1 id="三市场调查和分析">
<a href="#三市场调查和分析"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 三、市场调查和分析
</h1>
<h2 id="一目标市场的定位与分析">
<a href="#一目标市场的定位与分析"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一、目标市场的定位与分析
</h2>
<p>云手机尚未普及可以凭借其成本低价格低的优势获得中低端消费者的青睐具体的目标群体应该是高中生大学生这类消费者消费能力处于中高端水准并且有较高的素质弄够理解云手机的概念并更好的使用云手机的相关功能。根据调查报告显示大学生对手机要求最重要的是运行速度占34%;其次是功能全面占29%在往下是价格便宜占18%当然外观漂亮也是重要的占14%其余的要求占4%。云手机依靠远程服务器拥有运行速度的优势,能够很好地满足消费者需求。</p>
<h2 id="二市场容量估算和趋势预测">
<a href="#二市场容量估算和趋势预测"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 二、市场容量估算和趋势预测
</h2>
<p>由于云手机概念产品并未正式上市所以其市场容量估算和趋势预测只能依靠2009-2018年智能手机的市场容量估算和趋势去进行参考云手机的出现将是与智能手机的出现一样具有跨时代革命意义的所以云手机的发展趋势可以拿智能手机这些年的发展作为一个参考。 </p><p>
近几年中国智能手机行业蓬勃发展手机更新换代频繁手机产量持续增长。2016年手机产量达到最高峰共计22.61亿部。2018年1-11月手机产量为16.41亿部同比下降2.4%。预计2019年手机产量降幅或扩大。 </p><p>
手机市场趋向于存量状态国内手机市场国产品牌迅速崛起。国内手机存量市场份额最大的仍然是苹果占比28.90%华为占比17.10%国产品牌手机近年来占比持续上升华为在2018年的市场占有率达到26.39%OPPO和Vivo占比达到将近40%。中国巨大的市场需求给中国本土手机品牌的崛起增添了更多的筹码,国内分销市场代理国内品牌的比例普遍上升。 </p><p>
5G将带来新一轮换机潮。基于作为移动互联入口的智能手机与人类生活深度融合5G手机有望开启智能手机的高速物联时代。5G作为第五代移动通信网络相比于4G网络来说其最高理论传输速度可达数10Gb/秒快了将近数百倍一部完整超高清画质的电影可在一秒内下载完成。预计2019年5G智能手机出货量占智能手机出货量总额的0.5%整体智能手机出货量在下降但是5G智能手机预计到2023年有望超过4亿台市占率达到26%。 </p><p>
经过十多年高速发展中国手机市场接近饱和状态虽然全面屏、AI等技术带动了手机行业的发展但在5G到来之前这些技术还不足以带来大面积的换机需求。而在国际上的一些新兴市场依然存在增长红利。 </p><p>
华为目前在欧洲、中东、非洲和印度市场都加快脚步受益于中国和印度市场出货量大增小米成为2018年全球增速最快的手机品牌之一除了印度之外目前其加速发力西班牙、俄罗斯、欧洲等市场。</p>
<h2 id="三竞争格局分析和竞争优势">
<a href="#三竞争格局分析和竞争优势"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 三、竞争格局分析和竞争优势
</h2>
<p>三星在2019年全球智能手机出货量市场占份额为21.6%华为在2019年全球智能手机出货量市场份额为17.6%位居第二苹果市场占份额为13.9%。小米出货量为1.256亿台占市场份额为9.2%OPPO出货量为1.143亿台占市场份额为8.3%。值得一提的是前五大手机厂商市场份额超全球智能手机市场份额的7成。 </p><p>
在一个竞争如此激烈的市场存活绝非易事需要有过人的竞争优势。云手机概念产品最大的优势便是其续航能力因为云手机本身只负责接收和显示耗电量并不大估算续航能力是普通手机的3-4倍。并且计算和渲染在服务器中进行所以处理速度也是可以令消费者满意的。</p>
<h2 id="四估计的市场份额和销售额">
<a href="#四估计的市场份额和销售额"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 四、估计的市场份额和销售额
</h2>
<p>2019年全球智能手机出货量为13.71亿部同比下降2.3%。全球智能手机出货量连续第三年下滑。 从手机厂商来看2019年三星、华为、苹果、小米、OPPO出货量排名前五位出货量分别为2.96亿部、2.41亿部、1.91亿部、1.26亿部、1.14亿部。2019年尽管华为在海外市场面临持续挑战但仍超越了苹果成为智能手机出货量全球第二。未来伴随着网络覆盖率提高、5G提速中国消费者仍在等待更加亲民的5G智能手机面市。</p>
<h2 id="五市场发展的趋势">
<a href="#五市场发展的趋势"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 五、市场发展的趋势
</h2>
<p>智能机行业呈现平缓发展状态2018年市场规模达到15.6亿台同比增长9.4%,随着人口红利枯竭,智能机市场增长动力主要依靠迭代换新。 </p><p>
苹果在国内的市场首席地位并未被超越但以华为、oppo和vivo为首的国产阵营品牌抓住科技机遇和换机红利不断扩大市场空间而小米、三星、魅族等品牌则有锁缩水。 </p><p>
智能手机迭代需求弥补人口红利动力减弱的损失,通过更富科技感和时尚感的产品设计和定位,激发人们的换机心理,推动市场向更高层次发展。 </p><p>
一、二线城市以及东部沿海地区引领高端智能机市场,三、四线、五线城市以及华中、西南、西北等内陆地区则不断升级设备,其中定位中端的智能机较受欢迎。 </p><p>
一线城市智能移动终端市场新增乏力,二线城市是新增智能移动终端主要市场,新增设备以高端机为主流,三线及以下城市的增幅更加明显,中端机更加受到用户亲睐。 </p><p>
智能移动终端质量方面整体提升明显,电池、屏幕等主要故障问题逐步减少,但是,内存不足问题有所升温;智能移动终端维修渠道目前主要依赖官方售后和传统线下门店。 </p><p>
根据上面数据可得几个结论:</p>
<ol>
<li>智能机市场增长动力主要依靠迭代换新。</li>
<li>需要更富科技感和时尚感的产品才能促进迭代换新。</li>
<li>定位中端的智能机较受欢迎。</li>
<li>二、三线城市是新增智能移动终端主要市场。</li>
<li>内存不足问题有所升温。</li>
</ol>
<p>从以上结论中发现云手机概念产品是适合当下市场的消费者需求与大环境发展趋势的 </p><p>
云手机概念产品的提出,可以有力的促进迭代换新,从而从接近饱和的市场中再次开拓新的市场。并且云手机消费群众定位在中端消费者与二三线城市,且中端消费者的市场还未饱和,仍有开拓潜力。云手机本身优势可以很好地解决内存、手机发热、价格过高的问题。</p>
<h1 id="四公司战略">
<a href="#四公司战略"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 四、公司战略
</h1>
<h2 id="一商业模式">
<a href="#一商业模式"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一、商业模式
</h2>
<p>关键业务: 统一通信、通信设备、云计算与云服务 </p><p>
核心资源: 创新的技术、人才资源、顾客信息 </p><p>
价值主张: 以提高人们生活质量为愿景,运用云计算科学与技术领域专业,缩小贫富差距, 让人人享有。以绿色科学为基本准则,应对全球变暖挑战,资源集群化,减少能源浪费,创造更佳的社会效益,经济效益。 </p><p>
顾客关系: 以顾客和市场为中心。 与客户结为战略合作伙伴,以双赢为发展目标。以及时挖掘顾客需求作为企业发展动力;以客户不断增长的需求作为企业存在的意义。 </p><p>
销售渠道: 分销渠道,直销渠道。 </p><p>
售后服务: 设置对应的客户群经理、区域客户代表,了解客户需求,满足客户需求。确保及时响应。设有服务热线,顾客可以直接通过拨打热线来反映需求,其需求将由专人转达给相关人员,最后再反馈给客户。成本结构:研发成本、采购成本、生产成本、无形成本 </p><p>
收入来源:通信设备占主要,云计算与云服务占次要。其中主要为通信设备购买、云端软件购买、服务器空闲资源出租</p>
<h2 id="二公司的研发方向和产品线扩张策略">
<a href="#二公司的研发方向和产品线扩张策略"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 二、公司的研发方向和产品线扩张策略
</h2>
<p>公司研发方向主要是设计产品外观、服务器群的搭建、最重要的事开发、优化远程连接服务器与手机的软件 </p><p>
产品线扩张策略:在概念产品基本研制完毕的基础上,第一季度主要搭建服务器群组,第二季度进入设备测验、调试、生产阶段,并进行策划宣传。第三季度正式投入市场。每两个季度推出一款优化过的云手机。优化主要是针对设备运行速度。</p>
<h2 id="三主要的合作伙伴与竞争对手等">
<a href="#三主要的合作伙伴与竞争对手等"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 三、主要的合作伙伴与竞争对手等
</h2>
<p>主要的合作伙伴是生产商、宣传商、设备及其零件提供商。 </p><p>
主要对手是例如像华为、苹果这样已经在云手机方面有开发经验和已经开始研发的厂商。</p>
<h1 id="五关键的风险和问题">
<a href="#五关键的风险和问题"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 五、关键的风险和问题
</h1>
<h2 id="一技术方面">
<a href="#一技术方面"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一、技术方面
</h2>
<p>可能存在实际产品的网络稳定性无法达到预期,或使用效果无法和原机相比。 </p><p>
这部分可以通过向更可能提供稳定网络区域的消费者宣传,比如上班族等使用范围始终在稳定区域的人们</p>
<h2 id="二市场方面">
<a href="#二市场方面"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 二、市场方面
</h2>
<p>可能出现消费者不信任等问题。 </p><p>
这个解决方案可以通过提高宣传预期来降低人们对这个产品的不信任。</p>
<h2 id="三财务方面">
<a href="#三财务方面"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 三、财务方面
</h2>
<p>可能存在初期成本无法回收等问题。 </p><p>
可以通过众筹等方式融资。</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>我在这个活动结束之后,仔细思考了一下我的这个产品的的实用性。 </p><p>
我看了一下现在更多人买手机的方案发现我的产品还是有很多地方是有缺陷的。先不论技术问题对于消费者来说现在分期消费已经很流行了比如一台5000CNY的手机如果可以免息分期24期每月也才200CNY左右而过了两年之后也差不多该换新的手机了这时候再来一波以旧换新5000CNY的手机2年后顶1000CNY应该没问题吧然后第三年换个更好的手机在不考虑通货膨胀等情况下再分期……这样算下来其实价格也没多高然后相比于云手机的稳定性又会高很多…… <del>感觉老考虑这种事的我是不是穷疯了23333</del> </p><p>
不过如果真的有云手机出现说不定以后终端设备包年免费送结果最后又回到现在需要一次付清的尴尬情况23333 </p><p>
感觉生活就像是正弦函数一般,不断在前进,但是又不断在重复,感觉进步毫无意义,但是又不能不做…… </p><p>
不过对于我来说,我还是挺希望云手机的出现,因为我觉得云手机更符合手机的意义,堆配置不应该是手机该做的事,那是电脑该做的,手机还是应该做好它便携高效的本职才对。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%89%8B%E6%9C%BA"><em>手机</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%AD%96%E5%88%92"><em>策划</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-03-01-plan.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/03/01/plan.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/02/18/browser.html">
上一篇Mayx的浏览器使用史
</a>
</span>
<br />
<span class="next">
<a href="/2020/03/08/oldphone.html">
下一篇旧手机的N种用法
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/03/01/plan', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/03/01/plan.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

316
2020/03/08/oldphone.html Normal file
View File

@@ -0,0 +1,316 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>旧手机的N种用法 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="旧手机的N种用法" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="利用旧手机是废物利用呢还是强行增添价值?" />
<meta property="og:description" content="利用旧手机是废物利用呢还是强行增添价值?" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-03-08T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="旧手机的N种用法" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-03-08T00:00:00+08:00","datePublished":"2020-03-08T00:00:00+08:00","description":"利用旧手机是废物利用呢还是强行增添价值?","headline":"旧手机的N种用法","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/03/08/oldphone.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/03/08/oldphone.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/03/08/oldphone.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-03-08T00:00:00+08:00">8 March 2020</time> - 字数统计1707 - 阅读大约需要6分钟 - Hits: <span id="/2020/03/08/oldphone.html" class="visitors">Loading...</span></small>
<h1 class="p-name">旧手机的N种用法</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 08 Mar 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章主要讲述了作者对家中旧手机的处理方式转变从最初打算出售或回收转而思考如何最大限度地利用旧手机的剩余价值。作者提到可以将手机用作行车记录仪利用摄像头和GPS、服务器利用Android系统和ARM指令集运行服务器软件、桌面虚拟人偶通过Live2D壁纸、智能音响通过耳机孔以及小型家庭云存储。作者虽然提到了这些方案但也承认对于大多数人来说如果懒得折腾卖出或购买新设备可能是更直接的选择他个人则是出于对资源的不舍而寻求旧手机的价值发掘。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#旧手机的用法">旧手机的用法</a></li><li><a href="#总结">总结</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>利用旧手机是废物利用呢还是强行增添价值?<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>在上个月我找到了家里的一堆旧电子产品,顺便水了一篇<a href="/2020/02/02/old.html">文章</a>。不过像旧电脑可能还有收藏价值,旧手机就毫无用处了。 </p><p>
首先我想的是把旧手机卖掉之前我在闲鱼上卖掉了一部锤子T1也才卖200CNY然后我和买家都不满意然后事还多然后其他的手机也都是伊拉克成色……所以剩下的手机我也不打算在闲鱼上卖了。 </p><p>
第二个选项是回收我在网上回收估价唯一能找到品牌的华为麦芒4才能回收70多CNY在线下估才估了120CNY我想了想这个手机虽然CPU垃圾成色也垃圾但是我的屏幕是完好的而且还是1080P的一个完好的屏幕总成都不止70CNY吧何况这个手机还有32GiB的存储就是拿来存东西也比卖个120CNY好吧 </p><p>
所以我不再打算把这些旧手机换成钱了,我还是想想怎么样开发它的剩余价值吧。</p>
<h1 id="旧手机的用法">
<a href="#旧手机的用法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 旧手机的用法
</h1>
<p>我在网上查了查旧手机能做什么,看好多文章都说的是做监控、行车记录仪、导航仪、闹钟啥的,更有甚者拿它来做时钟。 </p><p>
我想了想导航仪和闹钟用自己的手机比旧手机要好多了吧监控的话手机又不能转而且不像买的摄像头有自带的NAT穿透感觉太鸡肋。行车记录仪倒是还可以屏幕、存储、GPS和摄像头都能用上不过支架不太好找而且我也没车没驾照对我来说也没啥用。 </p><p>
当做时钟倒也是一个不错的想法毕竟手机屏幕也不小不过我算了一下如果用手机当时钟耗电量要比普通时钟大几百倍而且LCD屏只要开着整个背光都是亮的如果背景全白亮瞎眼全黑又感觉浪费一有强光又看不清而且人一天也不会看几次时钟大多数想看时间的时候都会把自己的手机摸出来看所以这个方案同样很糟糕。 </p><p>
不过我觉得整个手机最有用的也就是屏幕了,所以屏幕应该要用上,然后再思考一下什么事适合旧手机做而不适合自己的手机做……像需要性能的部分电脑做就够了,大多数功能当前用的手机就够了,那么什么事情费手机就让手机来做吧! </p><p>
我觉得屏幕常亮就已经很费手机了那么更费手机的应该是让手机做一些小而杂的工作比如说当服务器用电脑当服务器太耗电所以肯定不应该让电脑长时间开着但是手机很适合24H开机所以拿来当服务器是个不错的选择而且当服务器的同时也不占用屏幕可以让手机最大化的利用。 </p><p>
让手机当服务器的方案很多毕竟Android系统本身就是基于Linux的所以运行服务器软件并不是什么难事。想自己搞的话可以自己编译一套ARM指令集的Nginx+PHP+MySQL嫌麻烦也可以直接用现有的KSWEB一键安装也很方便如果手机的配置实在垃圾也可以用BusyBox上带的httpd然后用C或shell写一套网站都没问题有CGI也没多难当然技术厉害的大佬也可以直接写服务器程序也没有问题。 </p><p>
既然旧手机后台的工作已经确定下来了那么前台的屏幕可以做什么呢1080P的屏幕应该说也是相当不错了拿来搞电子相册就挺不错的不过现在电子相册现在已经淘汰了而且就显示个照片实在是浪费这么好的屏幕。 </p><p>
不过只显示照片很浪费那么显示视频如何呢要不然就直接动态桌面不是更好吗我觉得这个想法不错于是我就在Google Play上找了一个不错的Live2D的壁纸拿来做在桌上的虚拟人偶也不错嘛。 </p><p>
屏幕也用到了要不然再用个耳机孔在旧手机上插一套音响设备然后用服务器控制也可以或者用语音助手控制也可以至少华为麦芒4这个手机还支持DTS音效啥的放歌总比MP3好多了吧像买一个智能音响也要不少钱但是旧手机加普通音响的价格就会低很多。 </p><p>
当然上述一切的前提是这个旧手机只有CPU和存储器过时了电池坏没坏倒是无所谓但如果说屏幕和音频解码也很垃圾的话那么上述效果会差很多。</p>
<h1 id="总结">
<a href="#总结"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 总结
</h1>
<p>综上所述一部旧手机在外拿来做行车记录仪在家作为服务器、桌面虚拟人偶和智能音响是个不错的选择当然想拿来做小型家庭云存储也挺好NAS那么贵不如用旧手机。 </p><p>
当然以上都是尽可能的利用旧手机的方案,如果懒得折腾还是买正规设备更好,如果觉得上述功能对自己没任何用处,那么换成钱也许更好(其实我也用不到上面那些功能,只是 ……<del>穷疯了23333</del> 不舍得丢掉,所以想榨干它们最后的价值罢了)</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%89%8B%E6%9C%BA"><em>手机</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-03-08-oldphone.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/03/08/oldphone.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/03/01/plan.html">
上一篇:对于云手机的策划书
</a>
</span>
<br />
<span class="next">
<a href="/2020/03/12/novel.html">
下一篇:关于写小说的技巧探究
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/03/08/oldphone', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/03/08/oldphone.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

364
2020/03/12/novel.html Normal file
View File

@@ -0,0 +1,364 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于写小说的技巧探究 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于写小说的技巧探究" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="我可从来没写过小说啊……" />
<meta property="og:description" content="我可从来没写过小说啊……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-03-12T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于写小说的技巧探究" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-03-12T00:00:00+08:00","datePublished":"2020-03-12T00:00:00+08:00","description":"我可从来没写过小说啊……","headline":"关于写小说的技巧探究","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/03/12/novel.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/03/12/novel.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/03/12/novel.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-03-12T00:00:00+08:00">12 March 2020</time> - 字数统计3359 - 阅读大约需要10分钟 - Hits: <span id="/2020/03/12/novel.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于写小说的技巧探究</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Thu, 12 Mar 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章是一位作者探讨如何提升自己的写作能力,特别是编写游戏剧情,以创作推理解谜游戏。作者将写作风格视为小说的外在形式(如同身体),认为写作风格受到作者的经历、写作风格特征(如个人语言习惯)和生活经历的影响。而对于剧情创作,作者强调了建立独特世界观、角色配置(包括能力和发展趋势)、剧情起伏以及避免套路的重要性。作者表达了对自己写作水平的自谦,并希望能通过学习优秀作品来提高,同时表达了对未来游戏开发合作的期待。</p>
<hr />
<ul><li><a href="#前言">前言</a></li><li><a href="#写作风格">写作风格</a></li><li><a href="#剧情">剧情</a><ul><li><a href="#建立世界">建立世界</a></li><li><a href="#角色配置">角色配置</a></li><li><a href="#发展模式">发展模式</a></li></ul></li><li><a href="#结语">结语</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>我可从来没写过小说啊……<!--more--></p>
<h1 id="前言">
<a href="#前言"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 前言
</h1>
<p>我在前几个月定下的5年计划中有一个<a href="/2019/12/17/game.html">制作游戏的计划</a>,不过说实话我的文学水平实在是不堪,所以近些日子我时不时的就在考虑到底怎么样写游戏的剧情才能让玩家觉得不会很无聊。 </p><p>
最近我也有看过一些小说或动画作品我觉得它们应该也会对我的写作和剧情构思能力有一定的提升。比如《ID:INVADED》我觉得这是这个季度最有意思的推理动画另外我还看过《文学少女》这部小说也同样有着推理内容而且看完以后会感觉到作者强大的文学底蕴。 </p><p>
对于我的游戏而言,因为整体设计是作为解谜游戏来制作,所以从剧情上来说我也更希望能做成推理的解谜游戏。 </p><p>
虽然我个人没写过小说,但是看了各种优秀的作品以后,我觉得自己应该也能总结它们的特点,写出属于我自己的剧情。 </p><p>
经过我的总结,我认为一部小说总体可以分为两部分,即写作风格和剧情,写作风格可以看做是小说的身体,而剧情则是灵魂。所以我接下来打算以这两个方面来总结一下我对写小说的理解。</p>
<h1 id="写作风格">
<a href="#写作风格"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 写作风格
</h1>
<p>从我前面写的几十篇文章来看,大家也都应该知道,我的写作水平是真的垃圾,垃圾到自己只敢写第一遍,不敢读第二遍……不过这么垃圾的东西我也不会删掉,毕竟这作为历史我也不应该消除它。 </p><p>
虽然我的写作能力很垃圾,但是这就是我的写作风格,水平垃圾是水平问题,但是风格垃圾这就没办法了…… <del>我只会生产垃圾QAQ</del> 尽管我写的很垃圾,但是我看了看网上的某些小说,发现它们看起来似乎更垃圾,这让我稍微安心了一点点。不过其实我的写作水平总体来说就是大概小学的水平,即使别人写的看起来很烂,但是能发布小说而且还有人打赏的,也要比我写的好吧…… </p><p>
经过我的总结我觉得写作风格主要来源于作者的平时经历比如平时喜欢写技术文档的人他如果写小说就是比较理性的风格虽然我没写过技术文档但是我觉得至少我写的也算是技术类博客吧另外如果喜欢ACGN次文化的人在写文章的时候也会经常加入相关语句之类的……比如说梗Meme以及在网络社区呆的时间很长也会喜欢加入一些网络用语。 </p><p>
另外写作能力也算风格的一部分,比如我经常莫名其妙的连续使用连词,比如然后、而且、对于、虽然……之类的,而且在写文章的时候经常前言不搭后语,就感觉似乎自己脑子的缓存很小,可能在写文章的时候也就能存一句话,写下一句话的时候要看一下前一句话然后进行实时演算,这个样子的效率可以说是真的低,不过这也算是用时间解决空间过小的问题吧。 </p><p>
我在小时候也看过很多文章,我记得当时还有订阅过一些刊物,比如《实用文摘》之类的,但是我总觉得我的记忆力是越来越差了,大概和我现在糟糕的生活习惯有关吧,而且即使我看过很多文章和小说,也很难把他们的写作风格吸收…… </p><p>
总而言之,写作风格和写程序一样,一是平时的水平积累,二是脑子够不够用,三是生活经历。这时候我又回去看了看我以前写的<a href="https://github.com/Mabbs/Mabbs">MaBBS</a>由衷的感叹那时我的脑子可真是厉害那么奇葩的代码我竟然能坚持写到将近1700行现在的我无论从哪一方面都比不了那时了……但是我也能理解那时的我为什么弃坑……也和经历有关……TAT</p>
<h1 id="剧情">
<a href="#剧情"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 剧情
</h1>
<p>写作风格我没法讲的更多了因为我自己的水平本来就很垃圾讲的再多就成了对自己的批斗会了23333。对于剧情嘛……就是逻辑方面的东西我觉得这个我可能更加擅长一些。 </p><p>
首先我认为写剧情要先建立一个相关世界,无论是描写真实的事物,还是描写虚假的事物,都需要先有被描写的对象才可以开始。所以第一点就是对世界的建立。</p>
<h2 id="建立世界">
<a href="#建立世界"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 建立世界
</h2>
<p>建立剧情的世界和当造物主一样,要先考虑建一个什么样的世界。对于我看过的大多数小说而言,大家认为写自己所在的世界更加容易一些,毕竟想象不如参照现实来的简单,所以大多数人都会选择地球作为剧情发生地或起始地。 </p><p>
虽然用自己所在的世界创建剧情世界不需要自己考虑太多,一切都是现成的,但是也正是因为一切都是现成的,而且也都是大家生活的地方,所以限制也非常大。首先为了避免被认为是对现实的含沙射影,很多时候可能在写关于地名时不应该使用现实中的地名,同样也不应该写对现实事物或人物造成了什么伤害,否则如果以后知道的人多了,就会被“炎上”,毕竟写小说的人也不希望自己写的东西太过于有争议性,影响到现实中的自己也不太好。 </p><p>
除此之外就是一些现实的常识限制,如果在地球上还修改了一堆基础的物理学,要么会被说是物理没学好 <del>河马的物理23333</del>,要么就是被人说是强行乱改物理学。总之就是以地球为基准对剧情的限制会比较多,当然写好了也会增加对读者亲密度,因为大家都对自己生活的地球都很了解,不需要再去考虑更多的设定,对读者的压力会小很多。 </p><p>
不过既然我要写的是推理解谜游戏,那么当然不在乎对读者有多少压力,能给读者更大的压力才是解谜游戏有趣的地方,所以我更希望使用非现实世界作为剧情发生的世界。另外如果想增加读者亲密度,也可以把起始地设置为现实世界,剧情发生地在完全自创的世界。 </p><p>
不过自己从零创造世界是个很困难的事情,现实的规则可以不用,但要符合逻辑性,不能因为是自己创造的世界就完全不需要遵守规则,没有逻辑的世界会让人读起来很难受,所以从零创造世界也非常考验作者的水平。</p>
<h2 id="角色配置">
<a href="#角色配置"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 角色配置
</h2>
<p>除了世界以外当然还要有在世界中的表演的角色,就像演戏一样,世界是角色表演的舞台,而角色则是在舞台上表演的人,角色的配置也很重要。 </p><p>
对于如何描写角色,用第一视角还是第三视角这个其实不重要,对于初期建立剧情来说,我们不需要考虑那么多,就像建模一样,建模虽然需要一个第一视角(摄像头),但是它不重要,重要的是里面的模型。 </p><p>
对于角色是不是人这种事,其实主要还是看建立的世界如何。建立的世界定义了在其中活动角色的世界观,如果那个世界的角色都认为在那个世界上生存的是对我们来说的怪物,那么它们在那个世界看待怪物里和我们在现实世界看待人是一样的。不一样的是在现实世界中看到怪物,这种事情会与其中人物的世界观发生冲突,然后再引起事件就很容易了。 </p><p>
所以对于角色配置,如果希望搞事情就可以设置与那个世界不相符合的角色,如果希望搞事情不是从这里开始,那就按照建立的世界规则走就可以了。 </p><p>
定义了角色的类型以后,还需要定义角色的一些能力,比如某个角色在整个世界中站在什么样的程度,像主角到底应不应该很厉害,到底是那种打败天下无敌手,还是普通的厉害?或者说就是一个菜鸡?当然这个角色配置也不一定就定下来了,菜鸡也可能凭自己的努力变厉害,或者是欧气爆棚捡到了神级装备,也或者是受神恩赐得到了很强大的能力之类的。 </p><p>
初始的角色能力的配置并不是很重要,因为它可以通过剧情发展变化,重要的是角色能力变化趋势,也就是最后角色的能力如何。在角色能力变化的时候发生的剧情也是比较有意思的。 </p><p>
我看小说的时候很喜欢主角很厉害因为我看小说的时候喜欢把自己代入到主角中所以对于我个人而言我不希望主角遇到糟糕的事情也不喜欢BE更不喜欢NTR。</p>
<h2 id="发展模式">
<a href="#发展模式"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 发展模式
</h2>
<p>有了舞台和演员,接下来就要开始演戏了。这个戏怎么演,主要就看它的发展走向。根据我的了解,一个故事剧情最重要的就是波折,如果一个故事中全都是高潮,那么它就是很高的平淡无奇。所以一般比较好的写法就是剧情开始怎么低落怎么来,但是不能低落到让读者失去兴趣,之后慢慢上升,上升到一个高度再猛然下降,就这样搞一些发展趋势三角形,最后在上到最高点,让人感觉如同在坐过山车一般。 </p><p>
当然说起来谁都会,写起来可不容易,不过我目前还是没什么好的灵感,现在不过是在积累方法,就让我再多胡诌一阵子吧。 </p><p>
在整个剧情的发展中,最忌讳的就是套路,如果读者在阅读的时候已经预测到结果了,那这一部作品就是垃圾。毕竟大家看剧情要看没见过的,已经见过的还有什么看头? </p><p>
不过这一方面也很复杂,我现在连我以前的代码都看不懂,怎么才能想到别人没想到的层面呢?如果作家才在第二层,读者都想到第五层了,那还有什么写头?</p>
<h1 id="结语">
<a href="#结语"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 结语
</h1>
<p>总之,写小说还是非常考验水平的,无论从写作水平还是编剧水平,都是要求很高的。写作水平要求的是积累的能力,而编剧水平则要求的是思考深度,这两部分都很难啊……我该怎么样写好我的游戏呢?真希望有人能和我一起来写这个游戏啊…… </p><p>
另外我写的游戏也不只是小说还要把各种谜题合理的嵌入其中……这个5年计划可真是复杂啊…… </p><p>
P.S.我觉得纯前端写这个还是尽量出逻辑解谜题,毕竟程序题有了源代码还是很容易被破解。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%B0%8F%E8%AF%B4"><em>小说</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%AE%A1%E5%88%92"><em>计划</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-03-12-novel.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/03/12/novel.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/03/08/oldphone.html">
上一篇旧手机的N种用法
</a>
</span>
<br />
<span class="next">
<a href="/2020/04/06/self.html">
下一篇Mayx的自我探索之旅
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/03/12/novel', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/03/12/novel.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

267
2020/04/06/self.html Normal file

File diff suppressed because one or more lines are too long

423
2020/04/19/exam.html Normal file
View File

@@ -0,0 +1,423 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于制作考试(答题)系统的研究 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于制作考试(答题)系统的研究" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="在答题系统的安全性上,没有人胜利……" />
<meta property="og:description" content="在答题系统的安全性上,没有人胜利……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-04-19T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于制作考试(答题)系统的研究" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-04-19T00:00:00+08:00","datePublished":"2020-04-19T00:00:00+08:00","description":"在答题系统的安全性上,没有人胜利……","headline":"关于制作考试(答题)系统的研究","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/04/19/exam.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/04/19/exam.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/04/19/exam.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-04-19T00:00:00+08:00">19 April 2020</time> - 字数统计3184 - 阅读大约需要11分钟 - Hits: <span id="/2020/04/19/exam.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于制作考试(答题)系统的研究</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 19 Apr 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章主要讲述了作者对一个学校的答题系统进行研究的经历。作者一开始利用网络考试中常见的将答案隐藏在源代码中的漏洞在答题系统中找到了通过获取已知答案来作弊的方法成功注册了花火学园并因这个发现加入了运维团队。尽管作者随后指出系统的阅卷逻辑存在漏洞可以通过无限重复已知答案的问题来获取满分但问题并未被开发者完全修复。文章的最后提到作者偶然间发现自己的修改并未解决问题实际上漏洞仍然存在被另一位测试者Sora Jin重新发现。作者反思认为设计答题系统时应避免过于精密以避免被轻易破解。</p>
<hr />
<ul><li><a href="#答题系统的来由">答题系统的来由</a></li><li><a href="#修复漏洞">修复漏洞</a></li><li><a href="#参考代码">参考代码</a></li><li><a href="#结尾">结尾</a></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>在答题系统的安全性上,没有人胜利……<!--more--></p>
<h1 id="答题系统的来由">
<a href="#答题系统的来由"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 答题系统的来由
</h1>
<p>在我维护的花火学园上,有一套答题系统。另外我能成为花火学园的运维也是因为这个系统,这件事也是个很神奇的事情。 </p><p>
具体内容也充满了机遇性在我上高中的一天我偶然发现了花火学园论坛发现了之后我就想注册然而这个论坛注册要求挺高需要邀请码如果没有就要去答20道题来获得邀请码。 </p><p>
那个题很难,正常人会的可能只有不到一半,如果有兴趣也可以看看<a href="https://www.say-huahuo.com/answer/">花火考场</a>对于这些题同样我也不会。不过不会没关系我以前在做网上的考试时从来都不会安心看题总会想着按下F12看看有没有什么不答题也能通过的方法。 </p><p>
按正常来说,应该没有人会把答案放到网页源代码中,但是在我做的好多次网络考试中,他们都把答案放到了源代码之中。我想这也许是为了降低服务器的运算压力吧……但是这样考试有点计算机知识的人都能把答案找出来,那考试还有啥意义…… </p><p>
总之就是因为这样奇怪的程序员很多所以我每次在网上答题前都会按下F12看看有没有什么更简单的通过方法。 </p><p>
当时我看了看花火考场的源代码是打包后的vue代码看来是没法从网页源代码这里入手了那第二点就是查看网络请求的数据了。 </p><p>
我大概看了一下这个答题系统的获得题目和提交都是由同一个php程序工作的过程是答题之前获得一组题目答完后将答案和一组表示题目的ID组合到一起提交到这个程序上提交后如果分数超过70分就会生成一个邀请码。看着这个过程我突然脑洞大开想着既然这个程序阅卷时只用ID和答案那么我如果会做其中一道题让这个程序反复批已知答案的同一道题那么我就可以得满分了吧。 </p><p>
结果还真是这样,有点不可思议,于是我就成功的注册了花火学园。 </p><p>
注册后我就给管理员说了这个问题,也是这样的一次机会我加入了花火学园的程序组当中。 </p><p>
这个答题系统是由<a href="https://github.com/you06">you06</a>大佬开发的,不过我反馈了这个问题以后,貌似问题仍然没有被解决……而我一般看代码也是有一定的机遇,只有心情适合写代码或看代码的时候才愿意去写,所以我成为管理员以后我也没有解决。 </p><p>
关于答题系统这个东西我一直觉得开发起来很简单,像客观题就是比对一下答案是不是一致就行了,所以说我上了大学以后,我一直想着和同学一起做个答题系统练练手,可惜现代大学生最喜欢干的事情就是摸鱼,所以一直都没有做答题系统。 </p><p>
不过前几天正好我的心情符合看代码的状态,然后就看了看我能不能解决这个问题。</p>
<h1 id="修复漏洞">
<a href="#修复漏洞"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 修复漏洞
</h1>
<p>我闲来无事打开看了看阅卷的这个小程序整个代码很短也很好理解。当时加入程序组后我和you06说用session解决这个问题也许不错虽然问题没解决但是能看到他已经写了一部分了也许是因为调试时出问题了所以写了一半之后就再没管。 </p><p>
我看了看之所以you06的代码出了问题其实主要原因是因为环境变量上少加了下划线所以没读到数据才导致程序出问题的既然问题找到了我很轻松的就改了过来。</p>
<h1 id="参考代码">
<a href="#参考代码"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 参考代码
</h1>
<p>既然漏洞解决了,那我觉得即使大家看到程序的源代码也没关系,我检查了很多遍,也没看出问题,所以现在我将阅卷系统的核心代码展示出来:</p>
<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?php</span>
<span class="nb">Session_start</span><span class="p">();</span>
<span class="nv">$filename</span> <span class="o">=</span> <span class="s2">"problem.json"</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">'REQUEST_METHOD'</span><span class="p">]</span> <span class="o">===</span> <span class="s1">'GET'</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// query problem data</span>
<span class="nv">$json_string</span> <span class="o">=</span> <span class="nb">file_get_contents</span><span class="p">(</span><span class="nv">$filename</span><span class="p">);</span>
<span class="nv">$questionSet</span> <span class="o">=</span> <span class="nb">json_decode</span><span class="p">(</span><span class="nv">$json_string</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
<span class="nv">$questiones</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span>
<span class="k">for</span> <span class="p">(</span><span class="nv">$i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nv">$i</span> <span class="o">&lt;</span> <span class="mi">20</span><span class="p">;</span> <span class="nv">$i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="nv">$index</span> <span class="o">=</span> <span class="nb">mt_rand</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$questionSet</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
<span class="nb">array_push</span><span class="p">(</span><span class="nv">$questiones</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span>
<span class="s1">'title'</span> <span class="o">=&gt;</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$index</span><span class="p">][</span><span class="s1">'title'</span><span class="p">],</span>
<span class="s1">'code'</span> <span class="o">=&gt;</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$index</span><span class="p">][</span><span class="s1">'code'</span><span class="p">],</span>
<span class="s1">'options'</span> <span class="o">=&gt;</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$index</span><span class="p">][</span><span class="s1">'options'</span><span class="p">],</span>
<span class="s1">'img'</span> <span class="o">=&gt;</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$index</span><span class="p">][</span><span class="s1">'img'</span><span class="p">]</span>
<span class="p">));</span>
<span class="nb">array_splice</span><span class="p">(</span><span class="nv">$questionSet</span><span class="p">,</span> <span class="nv">$index</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="p">}</span>
<span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$questiones</span><span class="p">;</span>
<span class="k">echo</span> <span class="nb">json_encode</span><span class="p">(</span><span class="nv">$questiones</span><span class="p">);</span>
<span class="k">die</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">'REQUEST_METHOD'</span><span class="p">]</span> <span class="o">===</span> <span class="s1">'POST'</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// check result</span>
<span class="nv">$answers</span> <span class="o">=</span> <span class="nb">json_decode</span><span class="p">(</span><span class="nb">file_get_contents</span><span class="p">(</span><span class="s2">"php://input"</span><span class="p">),</span> <span class="kc">true</span><span class="p">);</span>
<span class="nv">$score</span> <span class="o">=</span> <span class="nf">calcscore</span><span class="p">(</span><span class="nv">$answers</span><span class="p">);</span>
<span class="nv">$pass</span> <span class="o">=</span> <span class="nv">$score</span> <span class="o">&gt;=</span> <span class="mi">70</span><span class="p">;</span>
<span class="nv">$invitecode</span> <span class="o">=</span> <span class="s1">''</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$pass</span><span class="p">)</span> <span class="p">{</span>
<span class="nv">$invitecode</span> <span class="o">=</span> <span class="nf">invite</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">echo</span> <span class="nb">json_encode</span><span class="p">(</span><span class="k">array</span><span class="p">(</span>
<span class="s1">'score'</span> <span class="o">=&gt;</span> <span class="nv">$score</span><span class="p">,</span>
<span class="s1">'pass'</span> <span class="o">=&gt;</span> <span class="nv">$pass</span><span class="p">,</span>
<span class="s1">'invitecode'</span> <span class="o">=&gt;</span> <span class="nv">$invitecode</span>
<span class="p">));</span>
<span class="k">if</span> <span class="p">(</span><span class="k">isset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">]))</span> <span class="p">{</span>
<span class="k">unset</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">]);</span>
<span class="p">}</span>
<span class="k">die</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">function</span> <span class="n">calcscore</span><span class="p">(</span><span class="nv">$answers</span><span class="p">)</span> <span class="p">{</span>
<span class="nv">$score</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="nv">$filename</span> <span class="o">=</span> <span class="s2">"problem.json"</span><span class="p">;</span>
<span class="nv">$json_string</span> <span class="o">=</span> <span class="nb">file_get_contents</span><span class="p">(</span><span class="nv">$filename</span><span class="p">);</span>
<span class="nv">$questionSet</span> <span class="o">=</span> <span class="nb">json_decode</span><span class="p">(</span><span class="nv">$json_string</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="nv">$i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nv">$i</span> <span class="o">&lt;</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$answers</span><span class="p">);</span> <span class="nv">$i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$answers</span><span class="p">[</span><span class="nv">$i</span><span class="p">][</span><span class="s1">'answer'</span><span class="p">])</span> <span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="nv">$j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nv">$j</span> <span class="o">&lt;</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$questionSet</span><span class="p">);</span> <span class="nv">$j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$answers</span><span class="p">[</span><span class="nv">$i</span><span class="p">][</span><span class="s1">'code'</span><span class="p">]</span> <span class="o">==</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$j</span><span class="p">][</span><span class="s1">'code'</span><span class="p">]</span> <span class="o">&amp;&amp;</span>
<span class="nv">$answers</span><span class="p">[</span><span class="nv">$i</span><span class="p">][</span><span class="s1">'answer'</span><span class="p">]</span> <span class="o">==</span> <span class="nv">$questionSet</span><span class="p">[</span><span class="nv">$j</span><span class="p">][</span><span class="s1">'answer'</span><span class="p">])</span> <span class="p">{</span>
<span class="nv">$score</span> <span class="o">+=</span> <span class="mi">5</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nv">$matchCount</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$_SESSION</span> <span class="o">&amp;&amp;</span> <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">])</span> <span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="nv">$i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nv">$i</span> <span class="o">&lt;</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$answers</span><span class="p">);</span> <span class="nv">$i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="nv">$j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nv">$j</span> <span class="o">&lt;</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">]);</span> <span class="nv">$j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$answers</span><span class="p">[</span><span class="nv">$i</span><span class="p">][</span><span class="s1">'code'</span><span class="p">]</span> <span class="o">==</span> <span class="nv">$_SESSION</span><span class="p">[</span><span class="s1">'questiones'</span><span class="p">][</span><span class="nv">$j</span><span class="p">][</span><span class="s1">'code'</span><span class="p">])</span> <span class="p">{</span>
<span class="nv">$matchCount</span><span class="o">++</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="nv">$matchCount</span> <span class="o">==</span> <span class="nb">sizeof</span><span class="p">(</span><span class="nv">$answers</span><span class="p">))</span> <span class="p">{</span>
<span class="k">return</span> <span class="nv">$score</span><span class="p">;</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">function</span> <span class="n">invite</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">//generate invite code</span>
<span class="p">}</span>
</code></pre></div></div>
<h1 id="结尾">
<a href="#结尾"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 结尾
</h1>
<p>其实答题系统想让用户钻不了空还是相当简单的事情,不过我个人还是希望那些答题系统能不要写的太精密,这样谁都不会胜利,互相为难也不好嘛……</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>我的愚蠢超乎我想象这个代码的漏洞应该说完全没有解决看似复杂的代码就如同破铜烂铁一般轻易就能击碎QAQ。 </p><p>
我完全没有测试就胡乱改,改完之后除了让代码看起来更加复杂外没有解决任何问题。今天一位名叫<a href="https://github.com/MoeLoli">Sora Jin</a>的大佬像曾经的我一样测试了这个垃圾答题系统,重新发现了这个漏洞…… </p><p>
不过这次的修复不怎么美观,代码我就不放上来了,不是很难的问题,有兴趣的读者可以自己研究一下。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%80%83%E8%AF%95"><em>考试</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%AD%94%E9%A2%98"><em>答题</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-04-19-exam.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/04/19/exam.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/04/06/self.html">
上一篇Mayx的自我探索之旅
</a>
</span>
<br />
<span class="next">
<a href="/2020/04/21/laptop.html">
下一篇:记一次买笔电的经历
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/04/19/exam', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/04/19/exam.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

316
2020/04/21/laptop.html Normal file
View File

@@ -0,0 +1,316 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>记一次买笔电的经历 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="记一次买笔电的经历" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="买个电脑真是太难了QAQ……" />
<meta property="og:description" content="买个电脑真是太难了QAQ……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-04-21T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="记一次买笔电的经历" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-04-21T00:00:00+08:00","datePublished":"2020-04-21T00:00:00+08:00","description":"买个电脑真是太难了QAQ……","headline":"记一次买笔电的经历","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/04/21/laptop.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/04/21/laptop.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/04/21/laptop.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-04-21T00:00:00+08:00">21 April 2020</time> - 字数统计1088 - 阅读大约需要4分钟 - Hits: <span id="/2020/04/21/laptop.html" class="visitors">Loading...</span></small>
<h1 class="p-name">记一次买笔电的经历</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Tue, 21 Apr 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者经历了一次曲折的电脑购买过程他原本期待AMD的Zen2架构CPU的电脑最终选择了华硕天选但遇到了预售难、发货延迟、配置缩水和价格问题。尽管更换了低端版且配置下降但还是决定不再深究期待这台5799元的电脑能在未来五年内正常运行。使用体验中电脑存在屏幕闪动和噪音大的问题但日常使用尚可。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#糟糕的购买经历">糟糕的购买经历</a></li><li><a href="#使用体验">使用体验</a></li><li><a href="#对这台电脑的期望">对这台电脑的期望</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>买个电脑真是太难了QAQ……<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>在去年我曾说过以后如果有出了7nm制程、Zen2架构的AMD移动端CPU的电脑我就买一台。结果今年年初AMD公司就出了。不过当时我听说当时出的时候好像是联想的电脑装的名字好像叫Yoga Slim 7可惜我等了好久也没见它开卖。正好这时我偶然看到了华硕天选也出了符合我要求的电脑而且还有蓝色的外壳 <del>再加上看起来很像Kiana的天选姬23333</del> 这看起来都很吸引我,于是我就决定买这款电脑了。</p>
<h1 id="糟糕的购买经历">
<a href="#糟糕的购买经历"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 糟糕的购买经历
</h1>
<p>当时我在这款电脑预售的第二天就知道了它的存在,思考了几天我决定买下它。当时这个电脑似乎只有在京东上可以买,但是由于某些原因我在淘宝上也看了看,结果淘宝上也有,能加内存条还不用抢,价格一样而且还比京东上多了一堆赠品。我想了想,新电脑有那么高级的配置应该多加一条内存,但是我手残,自己<a href="/2019/08/17/memory.html">装内存条还把笔记本装坏了</a>……再加上一堆加成,我就被这个淘宝店吸引了。 </p><p>
正是因为如此,所以我没有在第一次发售去抢,结果第一次发售结束后店家还没有发货,我试着抢第二次发售的货,结果由于第一批货口碑不错,第二批根本抢不到,再往后就开始涨价了……然而淘宝店的店家仍然没有发货……据他们说,厂家不给他们货了。 </p><p>
当然,这个店家拖这么久我是可以让他们给我赔钱的,但是我不希望赔钱,我想要电脑啊……直到前几天华硕又一次发售,这次他们在这个产品上加了一个低端版的电脑,没办法,店家好像有低端版本的,所以我就让他们给我换了一下。 </p><p>
换了低端版之后给我退了1K的差价从原来6799的有着RTX2060显卡和16GiB内存的电脑妥协成了现在5799的只有GTX1650ti的垃圾显卡和8GiB的内存配置一下降了一半但是价格才退1000……而且还等了这么久QAQ……真的是太难了。</p>
<h1 id="使用体验">
<a href="#使用体验"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 使用体验
</h1>
<p>今天电脑到手了还好是真的电脑没给我寄一块砖头😂打开看了一下也没什么太大的问题于是我就开始把电脑原来家庭版的系统换成了专业版我之所以换的主要原因是为了用BitLocker、Windows沙箱和Hyper-V。 </p><p>
整个调试好之后我发现这个电脑还是有不少问题的,比如在电脑没有打游戏的时候屏幕会闪,大概是核心显卡或者是驱动的问题?另外这个电脑在有一些运算的时候声音是真的大,真的和开直升机一样。不过平时上个网,打个字倒还是挺安静的,感觉风扇一点也没转,我现在写博客就用的是这台电脑。</p>
<h1 id="对这台电脑的期望">
<a href="#对这台电脑的期望"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 对这台电脑的期望
</h1>
<p>不过既然这个电脑还不到6000我觉得还是不追究这些问题了至少这还是华硕的电脑如果真的出了问题也有售后。现在我就希望未来5年内它能好好的为我工作不要比过了20年都还能正常开机的电脑差就好了。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%AC%94%E8%AE%B0%E6%9C%AC%E7%94%B5%E8%84%91"><em>笔记本电脑</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%BB%8F%E5%8E%86"><em>经历</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-04-21-laptop.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/04/21/laptop.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/04/19/exam.html">
上一篇:关于制作考试(答题)系统的研究
</a>
</span>
<br />
<span class="next">
<a href="/2020/05/07/consume.html">
下一篇:合理消费
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/04/21/laptop', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/04/21/laptop.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

317
2020/05/07/consume.html Normal file
View File

@@ -0,0 +1,317 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>合理消费 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="合理消费" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="利己,就是合理。" />
<meta property="og:description" content="利己,就是合理。" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-05-07T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="合理消费" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-05-07T00:00:00+08:00","datePublished":"2020-05-07T00:00:00+08:00","description":"利己,就是合理。","headline":"合理消费","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/05/07/consume.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/05/07/consume.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/05/07/consume.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-05-07T00:00:00+08:00">7 May 2020</time> - 字数统计1139 - 阅读大约需要4分钟 - Hits: <span id="/2020/05/07/consume.html" class="visitors">Loading...</span></small>
<h1 class="p-name">合理消费</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Thu, 07 May 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讨论了作者关于合理消费的理解,强调个人主观判断的合理性,认为省钱为主,避免在投机和虚拟产品上花费,除非有把握保本。作者也倡导为了实现自己做不到的事情而愿意花钱,如请专业人士服务或购买实际需要的物品。最后,作者表明演讲内容是认真的,但对道德绑架式的批评保持开放态度,但不接受此类观点的争论。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#我认为的合理消费">我认为的合理消费</a></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>利己,就是合理。<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>由于我们语文老师想让我们做一次演讲,然后正好我也受到家人说我总在吃的东西花钱多的启发,所以我打算趁此机会再水一篇文章。 </p><p>
当然我至少是有演讲经验的而且这次演讲才5分钟<a href="/%E6%BC%94%E8%AE%B2%E7%A8%BF/2018/06/20/Coding.html">上次40分钟的演讲</a>完全不能比,另外这次也不需要对着人讲,只需要对着电脑讲就行了,所以相比来说应该会轻松一些。</p>
<h1 id="我认为的合理消费">
<a href="#我认为的合理消费"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 我认为的合理消费
</h1>
<p>什么是合理消费那么首先就要给合理下一个定义。对于一般人来说自己认为正确的对于自己来说就是合理的不过这种合理在实际生活中可能会让自己陷入困境。对于我来说我认为的合理肯定就是我认为正确的虽然我也说过如果只是想当然会出问题但是一般来说我肯定是不希望自己陷入困境的如果真的出现了这样的事情我肯定会改正所以我认为的就是合理的。说这么多只为一点那就是我说的就是正确的不接受杠精的反驳23333 </p><p>
那么接下来就让我谈一谈我的消费观念吧!</p>
<ol>
<li>合理消费以省钱为主 </p><p>
虽然先前投资很重要,但是我总感觉自己很非,像抽卡总是抽不到好的,<a href="/2020/04/21/laptop.html">买电脑也买不到称心如意的</a>QAQ……生活真是太艰难了……不过即使如此我们也要坚持下去。所以既然我我们知道投机取巧是不现实的那么就少在投机的事情上花钱吧当然也不是不能投机觉得保本的可能性大的话就去玩一玩吧。</li>
<li>不为虚拟的东西花一分钱 </p><p>
像我在虚拟的东西上基本上可以说是一分钱都没有花,像往游戏里充钱啥的根本不可能,软件也是。虽然我以后说不定也靠创作虚拟产品来搜刮用户的钱,但是对我来说我就是不愿意为此花钱。 </p><p>
另外在现实中对于周边我同样是一分钱也不愿意花虽然我也喜欢ACGN次文化比较喜欢但是我就是不愿意为此花钱因为为它们花钱就是买了虚拟的图案加上质量一般的产品很不值得。当然如果有人给我送的话我是很开心的我只是不愿意买罢了。<del>(别说了,都是穷😂)</del></li>
<li>自己花同样钱或精力做不到的事情就让别人来做 </p><p>
我们为什么要花钱我仔细想了想其实就是为了完成我们做不到的事情比如有些人是电脑小白不会装系统就需要花20CNY来请别人来装。有人说他们被坑了但是我不这么认为他们花50CNY也不一定能做来的事情花20CNY做不是很赚吗像我为什么愿意为吃的花钱就是因为我花100CNY也做不出来我想吃的东西但是我想吃的东西10CNY就能买来这时候就不要节约自己的钱了大胆的为自己的目标花钱吧</li>
</ol>
<p>其他更多的观点5分钟内也讲不完了那么以上就是我对合理消费的一些拙见Thanks for watching!</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>虽然这是个演讲,不过我说的也都是认真的哦,在现实中我就是按这样的标准来做的。 </p><p>
当然如果有人觉得有不合理的问题也可以说,但是如果有人用像“正大光明使用盗版”这种道德绑架的方式来喷我的话,那我建议最好按下<code class="language-plaintext highlighter-rouge">Ctrl+w</code>,就当没看过这篇文章。<del>(根本没人来看啊😂)</del></p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%BC%94%E8%AE%B2%E7%A8%BF"><em>演讲稿</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%B6%88%E8%B4%B9"><em>消费</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-05-07-consume.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/05/07/consume.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/04/21/laptop.html">
上一篇:记一次买笔电的经历
</a>
</span>
<br />
<span class="next">
<a href="/2020/05/20/memory.html">
下一篇Re:加装内存
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/05/07/consume', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/05/07/consume.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

313
2020/05/20/memory.html Normal file
View File

@@ -0,0 +1,313 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Re:加装内存 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="Re:加装内存" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="论头铁是什么感受" />
<meta property="og:description" content="论头铁是什么感受" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-05-20T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Re:加装内存" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-05-20T00:00:00+08:00","datePublished":"2020-05-20T00:00:00+08:00","description":"论头铁是什么感受","headline":"Re:加装内存","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/05/20/memory.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/05/20/memory.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/05/20/memory.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-05-20T00:00:00+08:00">20 May 2020</time> - 字数统计1286 - 阅读大约需要4分钟 - Hits: <span id="/2020/05/20/memory.html" class="visitors">Loading...</span></small>
<h1 class="p-name">Re:加装内存</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Wed, 20 May 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章主要讲述了作者两次尝试自行给电脑加装内存条的经历第一次导致笔记本充电功能损坏第二次因为店家发错货和内存频率不符引发了一系列问题如BIOS重置和密码消失。尽管过程坎坷最终作者还是成功加装了内存但对自己的决定表示懊悔并感叹购物过程中的不顺和价格波动。作者总结道加装内存的心得就是注意电池操作和内存安装方式以及认识到合理消费与运气都重要。</p>
<hr />
<ul><li><a href="#头铁的开端">头铁的开端</a></li><li><a href="#坎坷的装内存之旅">坎坷的装内存之旅</a></li><li><a href="#心得">心得</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>论头铁是什么感受<!--more--></p>
<h1 id="头铁的开端">
<a href="#头铁的开端"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 头铁的开端
</h1>
<p>在去年的8月份我给我的旧笔记本加装了一次内存条结果……<a href="/2019/08/17/memory.html">很悲惨</a>,把电脑的充电功能搞坏了。 </p><p>
几个月后的今天,我不记过去的痛苦,头铁的为我的<a href="/2019/08/17/memory.html">新笔记本电脑</a>加装了一次内存条…… </p><p>
本来我是打算用几年以后直接加32GiB的内存但是最近装了个虚拟机发现8GiB的内存不怎么够用Windows自己就占用了一半的内存结果我用Ubuntu虚拟机开动态内存需求是5GiB的内存。虽然心里很难受但是想了想还是加吧花钱让人难受但是花钱也是为了让人不难受啊…… </p><p>
不过现在问题不在花钱,在于自己手残,但是又不想请人来装。虽然<a href="/2020/05/07/consume.html">上一篇文章</a>我还在说自己花同样钱或精力做不到的事情就让别人来做,不过那就是个垃圾文章,我肯定是头坏了才会写出那种垃圾文章。现在我已经知道了,合不合理不在于省钱,而是脑子正不正常。 </p><p>
不过我想了想之前的笔记本之所以装坏了是因为它是商务本内存条在C面要装得把主板拆下来所以才搞出了问题。新电脑是游戏本不用拆掉主板也能加内存也许成功率会高一些吧……</p>
<h1 id="坎坷的装内存之旅">
<a href="#坎坷的装内存之旅"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 坎坷的装内存之旅
</h1>
<p>我上周就已经打算装已经在网上下单买内存了但是发生了很糟糕的事情店家给我发错了货我买的是3200MHz频率的内存条结果他们发成了2666MHz的……当然这个东西我直接看内存条其实是不会看的不装到电脑上我也不知道。 </p><p>
内存拿到手之后,我打算速战速决,后盖打开、电池拔掉、内存插上、电池插上,然后就直接装后盖了,真不知道该说是头铁还是智障,测试都没测试,觉得速战速决就能让电脑不坏吗?现实是残酷的,螺丝都拧好了然后按开机键没反应……没办法,我只能把后盖再拆开,然后重新试。 </p><p>
既然电脑已经拆了一回了就感觉什么东西破碎了第二次装的时候我就不再装后盖就直接开机电脑重启了三回第一回屏幕没反应第二回只有Logo第三回可算是开始引导系统结果BitLocker的界面出来了貌似是因为电池拔掉后BIOS重置安全启动自动关闭然后TPM就不认了。 </p><p>
这……算了反正前几周我还升过BIOS固件也遇到过相同的情况。不过这也太不安全了吧BIOS居然没有自带的电池我的BIOS密码也因此消失不见了那这个东西密码还有什么用后盖那么好拆电池一拔密码就没了…… </p><p>
我把安全启动的证书恢复了出厂设置系统总算是正常启动了看着16GiB的内存心里还是挺高兴的。这时候再看一眼频率2666MHz我怀疑是不是我装的有问题这时候我打开命令提示符输入<code class="language-plaintext highlighter-rouge">wmic memorychip</code>,一看两个内存的频率确实不一样,我感觉被坑了……这也许就是运气问题,合理不合理消费都是小事,运气不好咋也省不了钱。 </p><p>
还好店家倒也不是那种不讲理的人给我换了一条3200MHz的今天重新装上这也算是告一段落了。</p>
<h1 id="心得">
<a href="#心得"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 心得
</h1>
<p>加内存条倒也没啥心得就是注意一下拔电池内存斜着插进去就行了。唯一让我难受的就是我买东西真的是艰难本来想在更好的电脑上加内存结果好电脑没买上买了个垃圾一点的还是忍不住加内存结果一买还发错货了不仅如此换回来之后再一查其他家同款的降了10CNY…… </p><p>
生活真是艰难啊……糟糕的事情一出接着一出……</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%86%85%E5%AD%98"><em>内存</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-05-20-memory.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/05/20/memory.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/05/07/consume.html">
上一篇:合理消费
</a>
</span>
<br />
<span class="next">
<a href="/2020/05/29/encrypt.html">
下一篇写一个加密传输的Demo
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/05/20/memory', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/05/20/memory.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

466
2020/05/29/encrypt.html Normal file
View File

@@ -0,0 +1,466 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>写一个加密传输的Demo | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="写一个加密传输的Demo" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="非专业密码学,仅供娱乐!" />
<meta property="og:description" content="非专业密码学,仅供娱乐!" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-05-29T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="写一个加密传输的Demo" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-05-29T00:00:00+08:00","datePublished":"2020-05-29T00:00:00+08:00","description":"非专业密码学,仅供娱乐!","headline":"写一个加密传输的Demo","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/05/29/encrypt.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/05/29/encrypt.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/05/29/encrypt.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-05-29T00:00:00+08:00">29 May 2020</time> - 字数统计4777 - 阅读大约需要16分钟 - Hits: <span id="/2020/05/29/encrypt.html" class="visitors">Loading...</span></small>
<h1 class="p-name">写一个加密传输的Demo</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Fri, 29 May 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章是一个关于非专业密码学的Python实现示例作者是为了一个学校工程项目研究通信安全而写的简化的加密传输Demo。主要使用AES用于数据加密RSA用于加密AES的密钥以及MD5进行数据校验。作者选择这些技术主要是为了保证通信过程中的安全性虽然简化了RSA和TLS的握手过程以降低复杂性。传输方式则是通过文件而非TCP或Unix Domain Socket。虽然许多代码是从网上获取的但文章展示了如何使用Python的Crypto库进行加密和解密操作。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#实现思路">实现思路</a></li><li><a href="#代码">代码</a><ul><li><a href="#serverpy">server.py</a></li><li><a href="#clientpy">client.py</a></li></ul></li><li><a href="#感想">感想</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>非专业密码学,仅供娱乐!<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近我们学校搞了一个工程项目,要求是研究关于信息安全等级保护的一些东西,一开始我以为这就是搞个权限啥的,后来发现和云计算一样是个定义,话说我明明是网络工程专业的为啥还要了解信息安全…… </p><p>
当然这个什么等级保护的内容很多,我们不可能全都涉及,所以老师允许我们只选其中的一部分进行研究。我想了想,我之前还想搞什么<a href="/2019/07/02/encmail.html">加密邮件</a>啥的,所以我选了通信安全方面的板块,这样也可以对那个项目有些参考。</p>
<h1 id="实现思路">
<a href="#实现思路"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 实现思路
</h1>
<p>我本来是想按着TLS的标准来写后来看了看发现那样不太方便我写Demo也就是玩玩而已不用费那么大劲。 </p><p>
像正常来说,建立加密通道是要有握手环节的,但是那个实现起来实在是太麻烦,所以想了想就算了。 </p><p>
所以我的实现方式是生成一个随机数用AES以随机数为密码加密数据用RSA加密随机数。这样做的主要目的是利用RSA的特性保证传输内容不会被泄露但是RSA相对来说太慢所以用了AES来加密数据这样就能提高传输的效率。 </p><p>
传送方式我之前还想着要不要建一个TCP Socket或者是Unix Domain Socket来传输但是后来觉得这样太麻烦不如直接用文件的方式传这样还简单好理解。 <del>(就是嫌麻烦嘛)</del> </p><p>
另外在通信安全中还有一点是要求校验数据我想了想就用MD5吧正常来说得到MD5后还要数字签名啥的我觉得麻烦也就没搞所以最终传输的内容就是AES加密后的数据、原数据的MD5(Hash)以及用RSA加密的密钥。 </p><p>
虽然我学Python的时间不长不过我现在发现Python在做这些事情的时候远比Shell、PHP和JS简单所以这次的Demo也是用Python实现的。 </p><p>
不过我的Python并不怎么样所以大多数代码都是从网上Copy的像Crypto的库我不搜一下肯定是不会用嘛。 </p><p>
既然用到了Crypto库那么如果有人有兴趣执行下面的代码自然需要执行一下<code class="language-plaintext highlighter-rouge">pip3 install pycryptodome</code>才可以正常运行啦。</p>
<h1 id="代码">
<a href="#代码"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 代码
</h1>
<h2 id="serverpy">
<a href="#serverpy"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> server.py
</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># -*- coding: utf-8 -*-
</span>
<span class="kn">from</span> <span class="nn">Crypto.PublicKey</span> <span class="kn">import</span> <span class="n">RSA</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">PKCS1_v1_5</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">AES</span>
<span class="kn">import</span> <span class="nn">base64</span>
<span class="kn">import</span> <span class="nn">hashlib</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="n">private_key</span> <span class="o">=</span> <span class="s">"""-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDfEQ82qUrto7h4BL3TsA/DFXSdM44cbeY4kPccD7gLGhaZRClz
YKIh5zYdfjBGF+0HXfMa1u9b7GNs2AjVIsx8Kx0QLnMfmtkmGWGhOXz/9IDLKJOx
0weKv61gysKItgzVKn2mbLool4R/PQBc3AjDyHw+io1KpVz+3kRTaGs1fQIDAQAB
AoGAWB4kFWLA/6k6OOcemd4mC9mQ7HyuOdrMJDJX+5TWDkSrArajbTmSMrRkczgj
F71h3BQn8cVQXs695ARfUNrjTbi2Y0LjN7ScK7ExzTLdoMEFw5JsHggJZ0zBQY6w
mwOdGfqzA6tZPXgkn+jqEha+CD6GrwnTM1oDGJC/aKG2OmECQQDkO9IhUhFc/PSU
0zvGE6AOcqk5wlOuvMg+oAFHJHJZ9XW7+X/Nx0ZoVDFq/cZQj+46t+fiwUwhdW7l
IfCvNGKFAkEA+jRQmWGKrbf1ns4S0SezJvysd5O6otRGJXr+Ex2uDhc39ZTeUsyg
kjrLhp8STLMOmql+8g5fghct17EuCX1EmQJBAJz9BNnEkIrst/OSpH/nyeWGOx6u
q077LaXd+2MLD9kO/O/Se3V5B9YFa4STkJCjoBMloswXd51gIGpdgSeSmd0CQQCL
PrwwcGmWfo+ynqs4PajlpK9zKQMwhYS4bTejedwZOXDKOtx0Ji+i0hfcxwCPMQOK
rZPZsIgUxUOdC508aLvZAkBDkHxunCzDm0w4DdTUN7S9YSpVvQEjK/xUQiWaKV12
8QgskhU2DNdYK2NxifnWrKtx3uQmqMxX5aLuJZ4493yr
-----END RSA PRIVATE KEY-----"""</span>
<span class="c1"># 公钥解密
</span><span class="k">def</span> <span class="nf">rsa_decode</span><span class="p">(</span><span class="n">cipher_text</span><span class="p">,</span> <span class="n">private_key</span><span class="p">):</span>
<span class="n">rsakey</span> <span class="o">=</span> <span class="n">RSA</span><span class="p">.</span><span class="n">importKey</span><span class="p">(</span><span class="n">private_key</span><span class="p">)</span> <span class="c1"># 导入读取到的私钥
</span> <span class="n">cipher</span> <span class="o">=</span> <span class="n">PKCS1_v1_5</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="n">rsakey</span><span class="p">)</span> <span class="c1"># 生成对象
</span> <span class="c1"># 将密文解密成明文返回的是一个bytes类型数据需要自己转换成str
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">cipher</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">cipher_text</span><span class="p">),</span> <span class="s">"ERROR"</span><span class="p">)</span>
<span class="k">return</span> <span class="n">text</span><span class="p">.</span><span class="n">decode</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">PrpCrypt</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">key</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">MODE_CBC</span>
<span class="c1"># 解密后去掉补足的空格用strip() 去掉
</span> <span class="k">def</span> <span class="nf">decrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="n">plain_text</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">text</span><span class="p">))</span>
<span class="c1"># return plain_text.rstrip('\0')
</span> <span class="k">return</span> <span class="nb">bytes</span><span class="p">.</span><span class="n">decode</span><span class="p">(</span><span class="n">plain_text</span><span class="p">).</span><span class="n">rstrip</span><span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span><span class="p">)</span>
<span class="k">while</span> <span class="ow">not</span> <span class="nb">input</span><span class="p">(</span><span class="s">"按回车读取客户端的信息,输入其他内容结束"</span><span class="p">):</span>
<span class="n">cipher</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="n">msg</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">cipher</span><span class="p">.</span><span class="n">read</span><span class="p">())</span>
<span class="n">cipher</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">key</span> <span class="o">=</span> <span class="n">rsa_decode</span><span class="p">(</span><span class="n">msg</span><span class="p">[</span><span class="s">"key"</span><span class="p">],</span> <span class="n">private_key</span><span class="p">)</span>
<span class="n">aesc</span> <span class="o">=</span> <span class="n">PrpCrypt</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="n">message</span> <span class="o">=</span> <span class="n">aesc</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">msg</span><span class="p">[</span><span class="s">"message"</span><span class="p">])</span>
<span class="nb">hash</span> <span class="o">=</span> <span class="n">hashlib</span><span class="p">.</span><span class="n">md5</span><span class="p">(</span><span class="n">message</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">'UTF-8'</span><span class="p">)).</span><span class="n">hexdigest</span><span class="p">()</span>
<span class="k">if</span> <span class="nb">hash</span> <span class="o">==</span> <span class="n">msg</span><span class="p">[</span><span class="s">"hash"</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="s">"数据校验成功"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">"数据校验失败"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
</code></pre></div></div>
<h2 id="clientpy">
<a href="#clientpy"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> client.py
</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># -*- coding: utf-8 -*-
</span>
<span class="kn">import</span> <span class="nn">random</span>
<span class="kn">from</span> <span class="nn">Crypto.PublicKey</span> <span class="kn">import</span> <span class="n">RSA</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">PKCS1_v1_5</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">AES</span>
<span class="kn">import</span> <span class="nn">base64</span>
<span class="kn">import</span> <span class="nn">hashlib</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="n">public_key</span> <span class="o">=</span> <span class="s">"""-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfEQ82qUrto7h4BL3TsA/DFXSd
M44cbeY4kPccD7gLGhaZRClzYKIh5zYdfjBGF+0HXfMa1u9b7GNs2AjVIsx8Kx0Q
LnMfmtkmGWGhOXz/9IDLKJOx0weKv61gysKItgzVKn2mbLool4R/PQBc3AjDyHw+
io1KpVz+3kRTaGs1fQIDAQAB
-----END PUBLIC KEY-----
"""</span>
<span class="c1"># 公钥加密
</span><span class="k">def</span> <span class="nf">rsa_encode</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">public_key</span><span class="p">):</span>
<span class="n">rsakey</span> <span class="o">=</span> <span class="n">RSA</span><span class="p">.</span><span class="n">importKey</span><span class="p">(</span><span class="n">public_key</span><span class="p">)</span> <span class="c1"># 导入读取到的公钥
</span> <span class="n">cipher</span> <span class="o">=</span> <span class="n">PKCS1_v1_5</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="n">rsakey</span><span class="p">)</span> <span class="c1"># 生成对象
</span> <span class="c1"># 通过生成的对象加密message明文注意在python3中加密的数据必须是bytes类型的数据不能是str类型的数据
</span> <span class="n">cipher_text</span> <span class="o">=</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">cipher</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">message</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">)))</span>
<span class="c1"># 公钥每次加密的结果不一样跟对数据的padding填充有关
</span> <span class="k">return</span> <span class="n">cipher_text</span><span class="p">.</span><span class="n">decode</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">PrpCrypt</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">key</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">MODE_CBC</span>
<span class="c1"># 加密函数如果text不足16位就用空格补足为16位
</span> <span class="c1"># 如果大于16当时不是16的倍数那就补足为16的倍数。
</span> <span class="k">def</span> <span class="nf">encrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="c1"># 这里密钥key 长度必须为16AES-128,
</span> <span class="c1"># 24AES-192,或者32 AES-256Bytes 长度
</span> <span class="c1"># 目前AES-128 足够目前使用
</span> <span class="n">length</span> <span class="o">=</span> <span class="mi">16</span>
<span class="n">count</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="k">if</span> <span class="n">count</span> <span class="o">&lt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="n">count</span><span class="p">)</span>
<span class="c1"># \0 backspace
</span> <span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">count</span> <span class="o">&gt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="p">(</span><span class="n">count</span> <span class="o">%</span> <span class="n">length</span><span class="p">))</span>
<span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="c1"># 因为AES加密时候得到的字符串不一定是ascii字符集的输出到终端或者保存时候可能存在问题
</span> <span class="c1"># 所以这里统一把加密后的字符串转化为16进制字符串
</span> <span class="k">return</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64encode</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span><span class="p">)</span>
<span class="n">message</span><span class="o">=</span><span class="s">" "</span>
<span class="k">while</span> <span class="n">message</span><span class="p">:</span>
<span class="n">message</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">"请输入需要传输的信息(不输入则结束):"</span><span class="p">)</span>
<span class="nb">hash</span> <span class="o">=</span> <span class="n">hashlib</span><span class="p">.</span><span class="n">md5</span><span class="p">(</span><span class="n">message</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">'UTF-8'</span><span class="p">)).</span><span class="n">hexdigest</span><span class="p">()</span>
<span class="n">key</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">random</span><span class="p">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1000000000000000</span><span class="p">,</span><span class="mi">9999999999999999</span><span class="p">))</span>
<span class="n">cipher</span> <span class="o">=</span> <span class="n">rsa_encode</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">public_key</span><span class="p">)</span>
<span class="n">aesc</span> <span class="o">=</span> <span class="n">PrpCrypt</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="n">data</span><span class="o">=</span><span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"message"</span><span class="p">:</span><span class="n">aesc</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">message</span><span class="p">).</span><span class="n">decode</span><span class="p">(</span><span class="s">'utf8'</span><span class="p">),</span><span class="s">"hash"</span><span class="p">:</span><span class="nb">hash</span><span class="p">,</span><span class="s">"key"</span><span class="p">:</span><span class="n">cipher</span><span class="p">})</span>
<span class="k">print</span><span class="p">(</span><span class="n">data</span><span class="p">,</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">))</span>
<span class="k">print</span><span class="p">(</span><span class="s">"数据已发出!"</span><span class="p">)</span>
</code></pre></div></div>
<h1 id="感想">
<a href="#感想"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 感想
</h1>
<p>我在写这个代码的时候在网上搜到的资料也真的是算少了就像我当时打算写加密邮件那时一样基本上大多数的资料都有问题像有些代码还是Python2的还有时候经常遇到什么bytearray、json转换之类乱七八糟的问题。 </p><p>
希望中文网络环境能多一些大家遇到的冷门知识的解决方法啊…… </p><p>
对了,这个代码实际上只有防止中间人窥探信息的能力,并没有防篡改的能力,毕竟没有两端握手,没法做验证,所以这就是一个业余的加密传输代码,仅供参考。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%8A%A0%E5%AF%86"><em>加密</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=Demo"><em>Demo</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-05-29-encrypt.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/05/29/encrypt.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/05/20/memory.html">
上一篇Re:加装内存
</a>
</span>
<br />
<span class="next">
<a href="/2020/06/06/demoscene.html">
下一篇关于Demoscene的探索
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/05/29/encrypt', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/05/29/encrypt.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

325
2020/06/06/demoscene.html Normal file
View File

@@ -0,0 +1,325 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于Demoscene的探索 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于Demoscene的探索" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="大佬们的领域我们无法步入……" />
<meta property="og:description" content="大佬们的领域我们无法步入……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-06-06T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于Demoscene的探索" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-06-06T00:00:00+08:00","datePublished":"2020-06-06T00:00:00+08:00","description":"大佬们的领域我们无法步入……","headline":"关于Demoscene的探索","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/06/06/demoscene.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/06/06/demoscene.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/06/06/demoscene.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-06-06T00:00:00+08:00">6 June 2020</time> - 字数统计1799 - 阅读大约需要6分钟 - Hits: <span id="/2020/06/06/demoscene.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于Demoscene的探索</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sat, 06 Jun 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者对Demoscene这一计算机艺术亚文化的回顾。Demoscene或称演景是用很小的程序如64KiB、92KiB甚至4KiB来渲染出复杂且带音频的视频通常利用计算机硬件如显卡提高效率。它强调了Demoscene作品对数学和编程技巧的要求很高以C++、汇编等语言甚至JS编写。文章提到了一些著名作品和组织如Farbrausch和OMNISCENT以及一个4KiB的名为elevated的作品展示了其技术的精细和创新。作者虽然自认为没有能力参与但仍欣赏这种艺术形式。最后作者推荐了scene.org和js1k.com等网站供读者进一步探索。</p>
<hr />
<ul><li><a href="#前言">前言</a></li><li><a href="#什么是demoscene">什么是Demoscene</a></li><li><a href="#demoscene的实现方式">Demoscene的实现方式</a></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>大佬们的领域我们无法步入……<!--more--></p>
<h1 id="前言">
<a href="#前言"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 前言
</h1>
<p>最近闲来无事又在回顾自己的历史真是呜呼哀哉……14年左右的我是那么的有探索和研究精神怎么过了几年之后就成Five了呢…… </p><p>
在我过去留下的文件里,我找到了一些比较有意思的东西,比如当时网上传的很火的一个叫做<a href="http://www.theproduct.de/">.the .product</a>的一个64KiB的动画传说它用了外星压缩算法把1个多GiB的东西压缩成了64KiB真是令人感到不可思议还有一个叫做<a href="https://files.scene.org/view/parties/2004/breakpoint04/96kgame/kkrieger-beta.zip">kkrieger</a>的3D游戏同样也仅仅用了92KiB。 </p><p>
这两个作品都来自一个叫做Farbrausch的组织可能是这个组织的宣传做的比较好其他的Demoscene虽然做的也很不错但是并不怎么知名唯有这个组织的Demoscene在网上广为流传……不过也许是因为Breakpoint的Party知名度比较高 </p><p>
除此之外在Windows XP时代喜欢玩批处理的人也一定知道一个叫做<a href="https://files.scene.org/view/parties/1997/mekka97/in4k/snc_omni.zip">OMNISCENT</a>的动画把一串乱七八糟的东西放到debug程序里得出的一个只有4KiB的小程序就能播放出一个看起来好像在一个飞船里的一个3D动画。
以上所说的这些我当时不知道是什么东西。到了现在我才知道这些是一种叫做Demoscene的东西。</p>
<h1 id="什么是demoscene">
<a href="#什么是demoscene"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 什么是Demoscene
</h1>
<p>Demoscene根据百科所说是一种计算机艺术亚文化中文名叫做演景。玩这个的人就喜欢用计算机来渲染出一些看起来很有感觉的带音频的视频。因为这些画面都是直接渲染出来的所以占用的空间也非常的小。 </p><p>
这个道理就和位图和矢量图、波形音乐和MIDI音乐一样程序总比数据占用的空间小所以Demoscene通常来说都是用很小的程序来表现很复杂的场面。不过做过像svg的人应该也知道同一个图像做矢量图的难度要比制作位图的难度要大这也就是为什么Demoscene是只有大佬才会玩的东西。 </p><p>
虽然说这个东西说是计算机文化但是在我看来这个东西就是会写程序的数学家搞的玩意这就和NOI一样荒谬一堆数学题非得要叫个信息学比赛……</p>
<h1 id="demoscene的实现方式">
<a href="#demoscene的实现方式"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> Demoscene的实现方式
</h1>
<p>过去的Demoscene通常都是使用汇编写出来的虽然说汇编写出来的程序应该很小但是它因为过于复杂以至于有些硬件资源它无法很好的利用。 </p><p>
因为Demoscene主要表现的是音乐和视频那么这些事让显卡做的效率自然要比用CPU做的效率高很多。比如说我上面所说的OMNISCENT这个程序完全使用的是CPU的计算资源虽然使用了4KiB看起来很小但是事实上还是浪费了不少的空间。最近我在逛<a href="https://scene.org/">scene.org</a>的时候见到了一个更加厉害的Demoscene名字叫做<a href="https://files.scene.org/view/parties/2009/breakpoint09/in4k/rgba_tbc_elevated.zip">elevated</a>。它用了4KiB表现了一座山的春夏秋冬不仅画面更加精致而且时长也更长。 </p><p>
我看了一下,他们还放出了<a href="https://files.scene.org/view/resources/code/sources/rgba_tbc_elevated_source.zip">源代码</a>看起来是使用C++和汇编写出来的使用了微软的DirectX9来调用显卡。再看其他代码好多东西就只用了一句话来表示比如太阳就只需要一句<code class="language-plaintext highlighter-rouge">"+pow(saturate(mul(e,q[3])),16)*float3(.4,.3,.1)"</code>,云也只有一句<code class="language-plaintext highlighter-rouge">"+.1*f(s+q[3].w*.2,10)"</code>。这样看来难怪整个程序那么小,一个公式就表示了一个模型,这群伪装成程序员的数学家也真是有够强。 </p><p>
除此之外也有一些用数学界常有的复杂3D模型生成公式的比如什么Romanesco Broccoli还有分形之类乱七八糟的东西像这些就超出我的理解范围了 <del>(连线代都搞不懂还搞这个?)</del></p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>既然Demoscene对数学的要求如此之高对我来说自然是无缘步入了。但是欣赏他们的作品还是挺不错的。 </p><p>
除了上述的一些Demo(Intro)外我还找到了一些比较有意思的比如今年一个叫做Revision的Party里就有一个叫做<a href="https://files.scene.org/view/parties/2020/revision20/pc-4k-intro/synccord_nusanvalden.zip">SyncCord</a>的作品同样是4KiB效果也是非常的不错。 </p><p>
当然也不一定非要局限于4KiB还是64KiB更大的有更多的表现空间就比如07年的一个叫做<a href="https://files.scene.org/view/parties/2007/breakpoint07/demo/fr-041_debris.zip">debris</a>的作品堪称大片大小也仅仅只有177KiB另外这也是Farbrausch的作品。 </p><p>
更多的作品大家可以自己去<a href="https://scene.org/">scene.org</a>这里面有历年各位神仙做的各种各样的Demoscene。 </p><p>
另外除了这些程序之外也还有一些大佬拿JS写的只有1KiB的网页大家可以在<a href="https://js1k.com/">js1k.com</a>里找到当然这些和那些写真正程序的人完全不能比只是觉得1KiB的JS能做出那些东西也感觉很有意思。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=Demoscene"><em>Demoscene</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-06-06-demoscene.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/06/06/demoscene.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/05/29/encrypt.html">
上一篇写一个加密传输的Demo
</a>
</span>
<br />
<span class="next">
<a href="/2020/06/13/encrypt.html">
下一篇加密传输Demo V2
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/06/06/demoscene', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/06/06/demoscene.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

565
2020/06/13/encrypt.html Normal file
View File

@@ -0,0 +1,565 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>加密传输Demo V2 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="加密传输Demo V2" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="太业余总感觉不太好啊" />
<meta property="og:description" content="太业余总感觉不太好啊" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-06-13T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="加密传输Demo V2" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-06-13T00:00:00+08:00","datePublished":"2020-06-13T00:00:00+08:00","description":"太业余总感觉不太好啊","headline":"加密传输Demo V2","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/06/13/encrypt.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/06/13/encrypt.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/06/13/encrypt.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-06-13T00:00:00+08:00">13 June 2020</time> - 字数统计6457 - 阅读大约需要22分钟 - Hits: <span id="/2020/06/13/encrypt.html" class="visitors">Loading...</span></small>
<h1 class="p-name">加密传输Demo V2</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sat, 13 Jun 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章描述了一个加密传输Demo的升级版本原作者在上月制作了一个简单的单向加密通信Demo但觉得其业余且安全性不足。因此作者决定改进它实现完整的握手过程以确保双向通信并提高防中间人攻击的能力。实现方法是通过RSA加密一个随机数作为AES密钥密钥在连接建立后保持不变。作者还增加了防止冲突的机制并在Demo中加入了简单的登录系统允许自动化操作。代码展示了通信过程中的密钥交换、数据加密和解密的实现。</p>
<hr />
<ul><li><a href="#前言">前言</a></li><li><a href="#实现思路">实现思路</a></li><li><a href="#代码">代码</a><ul><li><a href="#serverpy">server.py</a></li><li><a href="#clientpy">client.py</a></li></ul></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>太业余总感觉不太好啊<!--more--></p>
<h1 id="前言">
<a href="#前言"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 前言
</h1>
<p>在上个月我写了一个<a href="/2020/05/29/encrypt.html">加密传输的Demo</a>,相当的业余,这个东西只能做到从客户端向服务端的单向传输,而且因为只有一次请求,所以中间人攻击也非常的容易。 </p><p>
虽然我觉得那个应该足够我完成作业了,但是我想了想,太业余总显得我很菜 <del>(难道不是吗?)</del> ,所以我打算还是努力一下把完整的握手也做出来吧。</p>
<h1 id="实现思路">
<a href="#实现思路"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 实现思路
</h1>
<p>和上次差不多同样我打算通过RSA加密一个随机数作为AES的密钥但是和上次不同这次的这个密钥将在通信建立之后密钥就不再变化传入传出都是这个密钥。 </p><p>
之前觉得握手阶段可能很麻烦,不过我画了一下图稍微理了理思路发现其实也没多复杂,也就是客户端生成密钥然后加密传输过来让服务端保存,完成之后之间的传输只要传被加密的数据就行了。这样我觉得应该也能起到一定的防止中间人攻击的作用吧…… </p><p>
不过我只用了一个文件作为传输的管道,为了避免冲突,我在每次写入数据的时候也都标明了数据的来源,这样就不会因为自己刚发完然后自己又重新接收自己发的东西了。 </p><p>
另外老师希望我的Demo有个简单的应用所以我又另外加了一个极其简单的登录系统在里面这样我就不用手动操作服务端了。</p>
<h1 id="代码">
<a href="#代码"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 代码
</h1>
<h2 id="serverpy">
<a href="#serverpy"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> server.py
</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># -*- coding: utf-8 -*-
</span><span class="k">print</span><span class="p">(</span><span class="s">"加密通道服务端演示开始"</span><span class="p">)</span>
<span class="kn">from</span> <span class="nn">Crypto.PublicKey</span> <span class="kn">import</span> <span class="n">RSA</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">PKCS1_v1_5</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">AES</span>
<span class="kn">import</span> <span class="nn">base64</span>
<span class="kn">import</span> <span class="nn">hashlib</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="n">private_key</span> <span class="o">=</span> <span class="s">"""-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDfEQ82qUrto7h4BL3TsA/DFXSdM44cbeY4kPccD7gLGhaZRClz
YKIh5zYdfjBGF+0HXfMa1u9b7GNs2AjVIsx8Kx0QLnMfmtkmGWGhOXz/9IDLKJOx
0weKv61gysKItgzVKn2mbLool4R/PQBc3AjDyHw+io1KpVz+3kRTaGs1fQIDAQAB
AoGAWB4kFWLA/6k6OOcemd4mC9mQ7HyuOdrMJDJX+5TWDkSrArajbTmSMrRkczgj
F71h3BQn8cVQXs695ARfUNrjTbi2Y0LjN7ScK7ExzTLdoMEFw5JsHggJZ0zBQY6w
mwOdGfqzA6tZPXgkn+jqEha+CD6GrwnTM1oDGJC/aKG2OmECQQDkO9IhUhFc/PSU
0zvGE6AOcqk5wlOuvMg+oAFHJHJZ9XW7+X/Nx0ZoVDFq/cZQj+46t+fiwUwhdW7l
IfCvNGKFAkEA+jRQmWGKrbf1ns4S0SezJvysd5O6otRGJXr+Ex2uDhc39ZTeUsyg
kjrLhp8STLMOmql+8g5fghct17EuCX1EmQJBAJz9BNnEkIrst/OSpH/nyeWGOx6u
q077LaXd+2MLD9kO/O/Se3V5B9YFa4STkJCjoBMloswXd51gIGpdgSeSmd0CQQCL
PrwwcGmWfo+ynqs4PajlpK9zKQMwhYS4bTejedwZOXDKOtx0Ji+i0hfcxwCPMQOK
rZPZsIgUxUOdC508aLvZAkBDkHxunCzDm0w4DdTUN7S9YSpVvQEjK/xUQiWaKV12
8QgskhU2DNdYK2NxifnWrKtx3uQmqMxX5aLuJZ4493yr
-----END RSA PRIVATE KEY-----"""</span>
<span class="c1"># 公钥解密
</span><span class="k">def</span> <span class="nf">rsa_decode</span><span class="p">(</span><span class="n">cipher_text</span><span class="p">,</span> <span class="n">private_key</span><span class="p">):</span>
<span class="n">rsakey</span> <span class="o">=</span> <span class="n">RSA</span><span class="p">.</span><span class="n">importKey</span><span class="p">(</span><span class="n">private_key</span><span class="p">)</span> <span class="c1"># 导入读取到的私钥
</span> <span class="n">cipher</span> <span class="o">=</span> <span class="n">PKCS1_v1_5</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="n">rsakey</span><span class="p">)</span> <span class="c1"># 生成对象
</span> <span class="c1"># 将密文解密成明文返回的是一个bytes类型数据需要自己转换成str
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">cipher</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">cipher_text</span><span class="p">),</span> <span class="s">"ERROR"</span><span class="p">)</span>
<span class="k">return</span> <span class="n">text</span><span class="p">.</span><span class="n">decode</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">PrpCrypt</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">key</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">MODE_CBC</span>
<span class="k">def</span> <span class="nf">encrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="c1"># 这里密钥key 长度必须为16AES-128,
</span> <span class="c1"># 24AES-192,或者32 AES-256Bytes 长度
</span> <span class="c1"># 目前AES-128 足够目前使用
</span> <span class="n">length</span> <span class="o">=</span> <span class="mi">16</span>
<span class="n">count</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="k">if</span> <span class="n">count</span> <span class="o">&lt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="n">count</span><span class="p">)</span>
<span class="c1"># \0 backspace
</span> <span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">count</span> <span class="o">&gt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="p">(</span><span class="n">count</span> <span class="o">%</span> <span class="n">length</span><span class="p">))</span>
<span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="c1"># 因为AES加密时候得到的字符串不一定是ascii字符集的输出到终端或者保存时候可能存在问题
</span> <span class="c1"># 所以这里统一把加密后的字符串转化为16进制字符串
</span> <span class="k">return</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64encode</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span><span class="p">)</span>
<span class="c1"># 解密后去掉补足的空格用strip() 去掉
</span> <span class="k">def</span> <span class="nf">decrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="n">plain_text</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">text</span><span class="p">))</span>
<span class="c1"># return plain_text.rstrip('\0')
</span> <span class="k">return</span> <span class="nb">bytes</span><span class="p">.</span><span class="n">decode</span><span class="p">(</span><span class="n">plain_text</span><span class="p">).</span><span class="n">rstrip</span><span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span><span class="p">)</span>
<span class="c1">#初始化pipe
</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">""</span><span class="p">,</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="c1">#协商密钥
</span><span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="n">pipe</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">pipe</span><span class="p">.</span><span class="n">read</span><span class="p">()</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">data</span> <span class="o">==</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">break</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">time</span><span class="p">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">""</span><span class="p">,</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">key</span> <span class="o">=</span> <span class="n">rsa_decode</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">"key"</span><span class="p">],</span> <span class="n">private_key</span><span class="p">)</span>
<span class="n">akey</span> <span class="o">=</span> <span class="n">PrpCrypt</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"成功获取密钥"</span><span class="p">,</span><span class="n">key</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"已建立连接"</span><span class="p">)</span>
<span class="n">userInfo</span><span class="o">=</span><span class="p">{</span><span class="s">"Name"</span><span class="p">:</span><span class="s">"Mayx"</span><span class="p">,</span><span class="s">"Passwd"</span><span class="p">:</span><span class="s">'25d55ad283aa400af464c76d713c07ad'</span><span class="p">,</span><span class="s">"Book"</span><span class="p">:</span><span class="s">"《会说话就多说点》,《在哪里能买到您的著作》"</span><span class="p">}</span>
<span class="c1">#处理阶段
#Waiting for Quest
</span><span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="n">pipe</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">pipe</span><span class="p">.</span><span class="n">read</span><span class="p">()</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">data</span> <span class="o">==</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">"from"</span><span class="p">]</span> <span class="o">==</span> <span class="s">"Client"</span><span class="p">:</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">break</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">time</span><span class="p">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"已收到请求"</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">akey</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">"data"</span><span class="p">]))</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">"name"</span><span class="p">]</span> <span class="o">==</span> <span class="n">userInfo</span><span class="p">[</span><span class="s">"Name"</span><span class="p">]</span> <span class="ow">and</span> <span class="n">data</span><span class="p">[</span><span class="s">"pwd"</span><span class="p">]</span> <span class="o">==</span> <span class="n">userInfo</span><span class="p">[</span><span class="s">"Passwd"</span><span class="p">]:</span>
<span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"from"</span><span class="p">:</span><span class="s">"Server"</span><span class="p">,</span><span class="s">"data"</span><span class="p">:</span><span class="n">akey</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="s">"登录成功,您的书单如下:"</span><span class="o">+</span><span class="n">userInfo</span><span class="p">[</span><span class="s">"Book"</span><span class="p">]).</span><span class="n">decode</span><span class="p">(</span><span class="s">"utf-8"</span><span class="p">)}),</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"from"</span><span class="p">:</span><span class="s">"Server"</span><span class="p">,</span><span class="s">"data"</span><span class="p">:</span><span class="n">akey</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="s">"登录失败"</span><span class="p">).</span><span class="n">decode</span><span class="p">(</span><span class="s">"utf-8"</span><span class="p">)}),</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">print</span><span class="p">(</span><span class="s">"请求已回应"</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"加密通道服务端演示结束"</span><span class="p">)</span>
</code></pre></div></div>
<h2 id="clientpy">
<a href="#clientpy"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> client.py
</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># -*- coding: utf-8 -*-
</span><span class="k">print</span><span class="p">(</span><span class="s">"加密通道客户端演示开始"</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">random</span>
<span class="kn">from</span> <span class="nn">Crypto.PublicKey</span> <span class="kn">import</span> <span class="n">RSA</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">PKCS1_v1_5</span>
<span class="kn">from</span> <span class="nn">Crypto.Cipher</span> <span class="kn">import</span> <span class="n">AES</span>
<span class="kn">import</span> <span class="nn">base64</span>
<span class="kn">import</span> <span class="nn">hashlib</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="n">public_key</span> <span class="o">=</span> <span class="s">"""-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfEQ82qUrto7h4BL3TsA/DFXSd
M44cbeY4kPccD7gLGhaZRClzYKIh5zYdfjBGF+0HXfMa1u9b7GNs2AjVIsx8Kx0Q
LnMfmtkmGWGhOXz/9IDLKJOx0weKv61gysKItgzVKn2mbLool4R/PQBc3AjDyHw+
io1KpVz+3kRTaGs1fQIDAQAB
-----END PUBLIC KEY-----
"""</span>
<span class="c1"># 公钥加密
</span><span class="k">def</span> <span class="nf">rsa_encode</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">public_key</span><span class="p">):</span>
<span class="n">rsakey</span> <span class="o">=</span> <span class="n">RSA</span><span class="p">.</span><span class="n">importKey</span><span class="p">(</span><span class="n">public_key</span><span class="p">)</span> <span class="c1"># 导入读取到的公钥
</span> <span class="n">cipher</span> <span class="o">=</span> <span class="n">PKCS1_v1_5</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="n">rsakey</span><span class="p">)</span> <span class="c1"># 生成对象
</span> <span class="c1"># 通过生成的对象加密message明文注意在python3中加密的数据必须是bytes类型的数据不能是str类型的数据
</span> <span class="n">cipher_text</span> <span class="o">=</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64encode</span><span class="p">(</span><span class="n">cipher</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">message</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">"utf-8"</span><span class="p">)))</span>
<span class="c1"># 公钥每次加密的结果不一样跟对数据的padding填充有关
</span> <span class="k">return</span> <span class="n">cipher_text</span><span class="p">.</span><span class="n">decode</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">PrpCrypt</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">key</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">MODE_CBC</span>
<span class="c1"># 加密函数如果text不足16位就用空格补足为16位
</span> <span class="c1"># 如果大于16当时不是16的倍数那就补足为16的倍数。
</span> <span class="k">def</span> <span class="nf">encrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="c1"># 这里密钥key 长度必须为16AES-128,
</span> <span class="c1"># 24AES-192,或者32 AES-256Bytes 长度
</span> <span class="c1"># 目前AES-128 足够目前使用
</span> <span class="n">length</span> <span class="o">=</span> <span class="mi">16</span>
<span class="n">count</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="k">if</span> <span class="n">count</span> <span class="o">&lt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="n">count</span><span class="p">)</span>
<span class="c1"># \0 backspace
</span> <span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">count</span> <span class="o">&gt;</span> <span class="n">length</span><span class="p">:</span>
<span class="n">add</span> <span class="o">=</span> <span class="p">(</span><span class="n">length</span> <span class="o">-</span> <span class="p">(</span><span class="n">count</span> <span class="o">%</span> <span class="n">length</span><span class="p">))</span>
<span class="c1"># text = text + ('\0' * add)
</span> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span> <span class="o">+</span> <span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span> <span class="o">*</span> <span class="n">add</span><span class="p">).</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
<span class="c1"># 因为AES加密时候得到的字符串不一定是ascii字符集的输出到终端或者保存时候可能存在问题
</span> <span class="c1"># 所以这里统一把加密后的字符串转化为16进制字符串
</span> <span class="k">return</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64encode</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">ciphertext</span><span class="p">)</span>
<span class="c1"># 解密后去掉补足的空格用strip() 去掉
</span> <span class="k">def</span> <span class="nf">decrypt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">):</span>
<span class="n">cryptor</span> <span class="o">=</span> <span class="n">AES</span><span class="p">.</span><span class="n">new</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">mode</span><span class="p">,</span> <span class="sa">b</span><span class="s">'0000000000000000'</span><span class="p">)</span>
<span class="n">plain_text</span> <span class="o">=</span> <span class="n">cryptor</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">text</span><span class="p">))</span>
<span class="c1"># return plain_text.rstrip('\0')
</span> <span class="k">return</span> <span class="nb">bytes</span><span class="p">.</span><span class="n">decode</span><span class="p">(</span><span class="n">plain_text</span><span class="p">).</span><span class="n">rstrip</span><span class="p">(</span><span class="s">'</span><span class="se">\0</span><span class="s">'</span><span class="p">)</span>
<span class="c1">#初始化阶段
</span><span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">pipe</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="k">except</span><span class="p">:</span>
<span class="n">time</span><span class="p">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="c1">#协商密钥
</span><span class="n">key</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">random</span><span class="p">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1000000000000000</span><span class="p">,</span><span class="mi">9999999999999999</span><span class="p">))</span>
<span class="n">akey</span> <span class="o">=</span> <span class="n">PrpCrypt</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="n">cipher</span> <span class="o">=</span> <span class="n">rsa_encode</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">public_key</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"key"</span><span class="p">:</span><span class="n">cipher</span><span class="p">})</span>
<span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">data</span><span class="p">,</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="n">pipe</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">pipe</span><span class="p">.</span><span class="n">read</span><span class="p">()</span> <span class="o">==</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">:</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">break</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">time</span><span class="p">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"成功发送密钥"</span><span class="p">,</span><span class="n">key</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"已建立连接"</span><span class="p">)</span>
<span class="c1">#处理阶段
#Single Quest
</span><span class="n">name</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">"请输入用户名:"</span><span class="p">)</span>
<span class="n">pwd</span> <span class="o">=</span> <span class="nb">input</span><span class="p">(</span><span class="s">"请输入密码:"</span><span class="p">)</span>
<span class="nb">hash</span> <span class="o">=</span> <span class="n">hashlib</span><span class="p">.</span><span class="n">md5</span><span class="p">(</span><span class="n">pwd</span><span class="p">.</span><span class="n">encode</span><span class="p">(</span><span class="n">encoding</span><span class="o">=</span><span class="s">'UTF-8'</span><span class="p">)).</span><span class="n">hexdigest</span><span class="p">()</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"from"</span><span class="p">:</span><span class="s">"Client"</span><span class="p">,</span><span class="s">"data"</span><span class="p">:</span><span class="n">akey</span><span class="p">.</span><span class="n">encrypt</span><span class="p">(</span><span class="n">json</span><span class="p">.</span><span class="n">dumps</span><span class="p">({</span><span class="s">"name"</span><span class="p">:</span><span class="n">name</span><span class="p">,</span><span class="s">"pwd"</span><span class="p">:</span><span class="nb">hash</span><span class="p">})).</span><span class="n">decode</span><span class="p">(</span><span class="s">"utf-8"</span><span class="p">)})</span>
<span class="nb">file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'pipe.txt'</span><span class="p">,</span><span class="s">'w'</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">data</span><span class="p">,</span><span class="nb">file</span> <span class="o">=</span> <span class="nb">file</span><span class="p">)</span>
<span class="nb">file</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">print</span><span class="p">(</span><span class="s">"已发出,等待回应"</span><span class="p">)</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="n">pipe</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">"pipe.txt"</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s">'r'</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">pipe</span><span class="p">.</span><span class="n">read</span><span class="p">()</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">data</span> <span class="o">==</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="s">"from"</span><span class="p">]</span> <span class="o">==</span> <span class="s">"Server"</span><span class="p">:</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">break</span>
<span class="n">pipe</span><span class="p">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">time</span><span class="p">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"已收到回应"</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">akey</span><span class="p">.</span><span class="n">decrypt</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">"data"</span><span class="p">])</span>
<span class="k">print</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">"加密通道客户端演示结束"</span><span class="p">)</span>
</code></pre></div></div>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>关于SSL/TLS的具体内容我也没有好好看一遍我打算回头有时间仔细看一看然后再回来看这个代码是有多么的糟糕🤪。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%8A%A0%E5%AF%86"><em>加密</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=Demo"><em>Demo</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-06-13-encrypt.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/06/13/encrypt.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/06/06/demoscene.html">
上一篇关于Demoscene的探索
</a>
</span>
<br />
<span class="next">
<a href="/2020/06/17/backup.html">
下一篇:论备份的重要性
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/06/13/encrypt', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/06/13/encrypt.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

421
2020/06/17/backup.html Normal file
View File

@@ -0,0 +1,421 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>论备份的重要性 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="论备份的重要性" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="只有事情发生到自己头上才想到要解决" />
<meta property="og:description" content="只有事情发生到自己头上才想到要解决" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-06-17T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="论备份的重要性" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-06-17T00:00:00+08:00","datePublished":"2020-06-17T00:00:00+08:00","description":"只有事情发生到自己头上才想到要解决","headline":"论备份的重要性","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/06/17/backup.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/06/17/backup.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/06/17/backup.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-06-17T00:00:00+08:00">17 June 2020</time> - 字数统计3822 - 阅读大约需要14分钟 - Hits: <span id="/2020/06/17/backup.html" class="visitors">Loading...</span></small>
<h1 class="p-name">论备份的重要性</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Wed, 17 Jun 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者在云服务器Vultr上遭遇数据丢失的经历由于服务器突然挂掉且回滚到的快照时间较早导致十几天的数据可能丢失。作者在服务器故障后发现Vultr未能有效恢复数据恢复仅能依靠旧的快照这让他反思了备份的重要性和供应商责任。他计划设置自动快照脚本以防止未来类似问题并考虑将数据备份到本地以增加安全度。作者认为个人不能完全依赖云服务商备份是保障数据安全的关键。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#难以想象的垃圾服务商vultr">难以想象的垃圾服务商Vultr</a></li><li><a href="#亡羊补牢">亡羊补牢</a><ul><li><a href="#自动快照的脚本">自动快照的脚本</a></li></ul></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>只有事情发生到自己头上才想到要解决<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>今天早上发生了一件很糟糕的事情,一打开聊天软件就发现有人在说我维护的花火学园挂掉了,错误信息是无法访问源站。我觉得挺奇怪,服务器又没啥负载,我也有一段时间没登进去了,怎么服务器就挂掉了? </p><p>
我试着用SSH连接同样无法连接我发现事情不太对劲然后就登到了Vultr里看了看。结果发现我的服务器在00:00之后就像一个死人一样CPU负载被拉成了一条直线就那样保持0%的位置。我以为是因为莫名其妙的原因服务器关机了,然而我重启以后仍然没有解决问题。 </p><p>
登录到终端一看,<code class="language-plaintext highlighter-rouge">No bootable device</code>就这样显示在屏幕上硬盘直接读不出来了这下可不得了了我赶紧去快照里看了一下发现最后一次快照的时间在5月30日也就是说如果没能恢复数据这十几天的所有信息都将消失</p>
<h1 id="难以想象的垃圾服务商vultr">
<a href="#难以想象的垃圾服务商vultr"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 难以想象的垃圾服务商Vultr
</h1>
<p>首先我要做的事情当然是想办法先恢复服务,虽然那个快照有点早,但是先顶上再说吧…… </p><p>
想一想我的防护应该做的也没啥问题而且一般成功入侵服务器的人也应该是删库然后留一条信息的那种直接干死硬盘的我还真没见过。于是我开始发Ticket给Vultr看看到底是怎么回事。 </p><p>
Vultr在我问完的4个小时后给出了最终的解决方案把我的服务器直接重置在上面安了新的操作系统然后给我赔了两个月的服务器费用……原文如下</p>
<blockquote>
<p>Hello,</p>
<p>In the past 24 hours, we sent notification of a node failure impacting your cloud server listed above.</p>
<p>Despite extensive efforts, our attempts to manually recover your cloud server were unsuccessful.</p>
<p>Our engineering team is currently deploying new instances with the same operating system and IP and you will receive login details in a separate message. You may also deploy a backup or snapshot on a new instance with a new IP if you prefer.</p>
<p>Our staff will be applying a two month account credit for the affected services shortly.</p>
<p>Regards, </p><p>
Bryan M. </p><p>
Systems Administrator</p>
</blockquote>
<p>这真是太糟糕了作为一家云服务器商就直接把客户的数据搞没了然后就赔2个月的费用要知道数据无价啊就这么不负责任的吗简直是不可思议啊 </p><p>
不过我也没什么好办法了也许他们不重装我还想着试试SystemRescueCD试试看能不能把整个磁盘复制出来但是他们既然已经直接重装那就彻底没救了……QAQ</p>
<h1 id="亡羊补牢">
<a href="#亡羊补牢"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 亡羊补牢
</h1>
<p>既然数据已经救不回来了,那我们也只能向前看,得想办法避免以后再出现这样的问题。因为我最近在期末阶段,比较忙,所以也不经常去打快照。虽然以前也出现过服务出问题的情况,像<a href="/2020/01/05/devops.html">MySQL挂了</a>、CDN挂了、还有一次好像是交换机出问题了但是无论如何数据从来没有丢失过。这一次数据都能丢了也真的是太糟糕了要不是有快照那就真成删库跑路了…… </p><p>
既然没时间打快照,我得想个办法搞一个自动打快照的东西。在网上搜了搜,还真有这样的脚本,于是我拿来改了改就装上去用了。</p>
<h2 id="自动快照的脚本">
<a href="#自动快照的脚本"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 自动快照的脚本
</h2>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">requests</span>
<span class="kn">from</span> <span class="nn">requests</span> <span class="kn">import</span> <span class="n">get</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="k">class</span> <span class="nc">__RPC</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">api_key</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">api_key</span> <span class="o">=</span> <span class="n">api_key</span>
<span class="bp">self</span><span class="p">.</span><span class="n">api_info</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="p">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
<span class="bp">self</span><span class="p">.</span><span class="n">errors</span> <span class="o">=</span> <span class="p">{</span>
<span class="mi">200</span><span class="p">:</span> <span class="s">"Function successfully executed."</span><span class="p">,</span>
<span class="mi">400</span><span class="p">:</span> <span class="s">"Invalid API location. Check the URL that you are using."</span><span class="p">,</span>
<span class="mi">403</span><span class="p">:</span> <span class="s">"Invalid or missing API key. Check that your API key is present and matches your assigned key."</span><span class="p">,</span>
<span class="mi">405</span><span class="p">:</span> <span class="s">"Invalid HTTP method. Check that the method (POST|GET) matches what the documentation indicates."</span><span class="p">,</span>
<span class="mi">412</span><span class="p">:</span> <span class="s">"Request failed. Check the response body for a more detailed description."</span><span class="p">,</span>
<span class="mi">500</span><span class="p">:</span> <span class="s">"Internal server error. Try again at a later time."</span><span class="p">,</span>
<span class="mi">503</span><span class="p">:</span> <span class="s">"Rate limit hit. API requests are limited to an average of 2/s. Try your request again later."</span>
<span class="p">}</span>
<span class="k">def</span> <span class="nf">api_info_initial</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">api_info</span> <span class="o">=</span> <span class="p">{</span><span class="s">"snapshot/create"</span><span class="p">:</span><span class="s">"POST"</span><span class="p">,</span><span class="s">"snapshot/destroy"</span><span class="p">:</span><span class="s">"POST"</span><span class="p">,</span><span class="s">"snapshot/list"</span><span class="p">:</span><span class="s">"GET"</span><span class="p">,</span><span class="s">"server/list"</span><span class="p">:</span><span class="s">"GET"</span><span class="p">}</span>
<span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">eval</span><span class="p">(</span><span class="s">"__RPC"</span><span class="p">)(</span><span class="bp">self</span><span class="p">.</span><span class="n">api_key</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">"/"</span> <span class="o">+</span> <span class="n">name</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_info</span><span class="p">:</span>
<span class="bp">self</span><span class="p">.</span><span class="n">api_info_initial</span><span class="p">()</span>
<span class="k">if</span> <span class="bp">self</span><span class="p">.</span><span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_info</span><span class="p">:</span>
<span class="k">raise</span> <span class="nb">ValueError</span><span class="p">(</span><span class="s">"The API is not exists."</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_info</span><span class="p">[</span><span class="bp">self</span><span class="p">.</span><span class="n">name</span><span class="p">]</span> <span class="o">==</span> <span class="s">"GET"</span><span class="p">:</span>
<span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">"https://api.vultr.com/v1/"</span> <span class="o">+</span> <span class="bp">self</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s">"API-Key"</span><span class="p">:</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_key</span><span class="p">},</span>
<span class="n">params</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_info</span><span class="p">[</span><span class="bp">self</span><span class="p">.</span><span class="n">name</span><span class="p">]</span> <span class="o">==</span> <span class="s">"POST"</span><span class="p">:</span>
<span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">post</span><span class="p">(</span><span class="s">"https://api.vultr.com/v1/"</span> <span class="o">+</span> <span class="bp">self</span><span class="p">.</span><span class="n">name</span><span class="p">,</span> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s">"API-Key"</span><span class="p">:</span> <span class="bp">self</span><span class="p">.</span><span class="n">api_key</span><span class="p">},</span> <span class="n">data</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">if</span> <span class="n">res</span><span class="p">.</span><span class="n">status_code</span> <span class="o">==</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">return</span> <span class="n">res</span><span class="p">.</span><span class="n">status_code</span><span class="p">,</span> <span class="n">res</span><span class="p">.</span><span class="n">text</span><span class="p">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">elif</span> <span class="n">res</span><span class="p">.</span><span class="n">status_code</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">.</span><span class="n">errors</span><span class="p">.</span><span class="n">keys</span><span class="p">():</span>
<span class="k">return</span> <span class="n">res</span><span class="p">.</span><span class="n">status_code</span><span class="p">,</span> <span class="bp">self</span><span class="p">.</span><span class="n">errors</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">res</span><span class="p">.</span><span class="n">status_code</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">res</span><span class="p">.</span><span class="n">raise_for_status</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">Vultr</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">api_key</span><span class="p">):</span>
<span class="bp">self</span><span class="p">.</span><span class="n">api_key</span> <span class="o">=</span> <span class="n">api_key</span>
<span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">eval</span><span class="p">(</span><span class="s">"__RPC"</span><span class="p">)(</span><span class="bp">self</span><span class="p">.</span><span class="n">api_key</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="n">vultr</span> <span class="o">=</span> <span class="n">Vultr</span><span class="p">(</span><span class="s">"API Key"</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s">'SUBID'</span><span class="p">:</span> <span class="s">'实例ID'</span><span class="p">}</span>
<span class="n">status_code</span><span class="p">,</span> <span class="n">resp</span> <span class="o">=</span> <span class="n">vultr</span><span class="p">.</span><span class="n">snapshot</span><span class="p">.</span><span class="n">create</span><span class="p">(</span><span class="o">**</span><span class="n">data</span><span class="p">)</span>
<span class="n">requests</span><span class="p">.</span><span class="n">post</span><span class="p">(</span><span class="s">"https://sc.ftqq.com/SCKEY.send"</span><span class="p">,</span><span class="n">data</span> <span class="o">=</span><span class="p">{</span><span class="s">"text"</span><span class="p">:</span><span class="s">"快照已创建"</span><span class="p">,</span><span class="s">"desp"</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">status_code</span><span class="p">)</span><span class="o">+</span><span class="n">resp</span><span class="p">})</span>
<span class="c1"># 删除旧快照
</span><span class="n">status_code</span><span class="p">,</span> <span class="n">resp</span> <span class="o">=</span> <span class="n">vultr</span><span class="p">.</span><span class="n">snapshot</span><span class="p">.</span><span class="nb">list</span><span class="p">()</span> <span class="c1"># /v1/snapshot/list
</span><span class="k">if</span> <span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">'获取快照列表失败'</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">status_code</span><span class="p">)</span> <span class="o">+</span> <span class="n">resp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">'成功获取到快照列表'</span><span class="p">)</span>
<span class="n">data_list</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">json</span><span class="p">.</span><span class="n">loads</span><span class="p">(</span><span class="n">resp</span><span class="p">).</span><span class="n">values</span><span class="p">())</span>
<span class="n">data_list</span><span class="p">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="p">[</span><span class="s">'date_created'</span><span class="p">])</span> <span class="c1"># 默认时间排序,由近到远
</span> <span class="n">data_list_del</span> <span class="o">=</span> <span class="n">data_list</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">][</span><span class="mi">9</span><span class="p">:]</span> <span class="c1"># 取超过9个之后的快照
</span> <span class="k">for</span> <span class="n">data_del</span> <span class="ow">in</span> <span class="n">data_list_del</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s">'SNAPSHOTID'</span><span class="p">:</span> <span class="n">data_del</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">'SNAPSHOTID'</span><span class="p">)}</span>
<span class="n">status_code</span><span class="p">,</span> <span class="n">resp</span> <span class="o">=</span> <span class="n">vultr</span><span class="p">.</span><span class="n">snapshot</span><span class="p">.</span><span class="n">destroy</span><span class="p">(</span><span class="o">**</span><span class="n">data</span><span class="p">)</span> <span class="c1"># /v1/snapshot/destroy
</span> <span class="k">if</span> <span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">'删除旧快照失败'</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">'成功删除一个旧快照'</span><span class="p">)</span>
</code></pre></div></div>
<p>把这个脚本放到Crontab里每天执行一次就行了。</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>相信服务器厂商是完全靠不住的事情自己还得想办法做好备份。我甚至在想阿三把Intel和微软都占领了会不会有一个阿三也跑到Vultr里然后对着我的硬盘大喊“把你变成咖喱”之类的23333。 </p><p>
现在不过是权宜之计,以后还是得想办法把整个论坛下载到本地,至少能搞个数据库的差异备份啥的也行啊……</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%A4%87%E4%BB%BD"><em>备份</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-06-17-backup.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/06/17/backup.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/06/13/encrypt.html">
上一篇加密传输Demo V2
</a>
</span>
<br />
<span class="next">
<a href="/2020/07/29/card.html">
下一篇如何制作一个PCB名片
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/06/17/backup', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/06/17/backup.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

325
2020/07/29/card.html Normal file
View File

@@ -0,0 +1,325 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>如何制作一个PCB名片 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="如何制作一个PCB名片" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="感觉设计PCB也挺有意思的" />
<meta property="og:description" content="感觉设计PCB也挺有意思的" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-07-29T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="如何制作一个PCB名片" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-07-29T00:00:00+08:00","datePublished":"2020-07-29T00:00:00+08:00","description":"感觉设计PCB也挺有意思的","headline":"如何制作一个PCB名片","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/07/29/card.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/07/29/card.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/07/29/card.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-07-29T00:00:00+08:00">29 July 2020</time> - 字数统计1603 - 阅读大约需要5分钟 - Hits: <span id="/2020/07/29/card.html" class="visitors">Loading...</span></small>
<h1 class="p-name">如何制作一个PCB名片</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Wed, 29 Jul 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者在假期期间学习并制作PCB名片的过程。作者初衷是对这个创意感兴趣但没有电路设计基础。开始时作者通过在线找到了立创EDA软件虽然对软件界面感到困惑但凭借设计师的直觉逐步了解并开始设计主要是将图片和简单的线条组合添加了线圈元素。制作过程中作者发现PCB并非在铜板上直接刻划而是塑料板上打印线路。初次设计的错误导致成本不高5元人民币能打5张最终作者从价格和兴趣角度认为值得一试。同时作者对快递速度表达了不满上一次使用京东快递体验较差这次尝试换成顺丰寄送。</p>
<hr />
<ul><li><a href="#前言">前言</a></li><li><a href="#收集资料">收集资料</a></li><li><a href="#开始设计">开始设计</a></li><li><a href="#制造结果">制造结果</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>感觉设计PCB也挺有意思的<!--more--></p>
<h1 id="前言">
<a href="#前言"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 前言
</h1>
<p>这个月虽然依然是假期,但是总感觉比其他月做了更多的事,毕竟是到了期末,考试的准备不说,为其他人完成期末作业这也费了不少精力,因此也赚了几百块钱。 </p><p>
除了期末我还要为科目三的考试做准备。虽然练车每天不过1小时但是回来之后就啥也不想干了……再过几天我就要去考试了希望能顺利通过。 </p><p>
在假期间我在网上看到了一个很有趣的东西叫做PCB名片就是把电路板做的像名片一样。看起来挺有意思的不过我从来没学过电路设计网络工程的人怎么会去学习电路设计呢所以虽然看起来很有意思但是我一窍不通啊…… </p><p>
说是这么说,但是只要想做,有搜索引擎什么做不到?于是接下来我就开始了学习电路设计的路程。</p>
<h1 id="收集资料">
<a href="#收集资料"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 收集资料
</h1>
<p>据那些做PCB名片的人所说他们是使用AD(Altium Designer)进行设计然后发到一个叫嘉立创的网站进行制造。首先我肯定是先去下AD不过看了一下大小之后就不想下了那个软件要2-3GiB大……我想我可能也就做一次PCB又不会经常用所以也不想下这么大的软件。 </p><p>
像电路设计也不可能只有AD一个软件于是我就开始搜还有什么其他的EDA软件可以用。搜着搜着发现了有一个可以在线设计PCB的网站叫做立创EDA这不是正合我意嘛想不到这个在线设计的网站和制造PCB的那个公司是一家的这样倒是也方便。</p>
<h1 id="开始设计">
<a href="#开始设计"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 开始设计
</h1>
<p>既然整个流程大概都搞明白了,接下来就该设计了。当然从来没学过电路设计自然也不知道怎么用这个软件,接下来我打开了教程,然而我的表情是这样的: </p><p>
<img src="/images/emoticon1.jpg" alt="emoticon1" /> </p><p>
像教程这种东西实在是一点用也没有,大多数教程都是给能看懂教程的人写的,像我完全不了解的人就根本不会看这种东西。那怎么办呢?不会用还不看教程,怎么才能用这个软件呢? </p><p>
这时候就用到了作为设计师的本能了,设计师都是心意相通的,所以只要是按着为用户着想的设计理念做出来的软件,我基本上都会用。 <del>Adobe公司做的垃圾软件就没有符合这个理念</del> </p><p>
这个软件可以直接用浏览器打开也有客户端客户端是Electron做的。我不太喜欢Electron因为感觉它的效率比较低因此VSCode我也没有装。但是这个网页版在Edge上的兼容性不太好所以我只好使用它的客户端了……倒是也不大不到100MiB还是挺不错的。 </p><p>
打开了这个软件之后随便按了按,大概的按键我倒是都搞明白了,有几个划线的按钮,分别可以画直线和弧线,然后就是打孔的选项,还有一个画矩形和多边形的。除此之外还能插入图片和文字,总体来看和画图软件差不多,只是它好像有一堆奇奇怪怪的层。 </p><p>
一开始这些层我完全搞不清楚是干啥用的啥阻焊层还是什么丝印层乱七八糟的我根本搞不清楚。还好它有一个3D预览可以看一下最终做出来的大概效果通过这个我大概明白了丝印层就是在电路板表面印的白色的字阻焊层就是电路板表面涂的有颜色的漆。只是设计的时候是把那层东西挖空。 </p><p>
了解了这些之后我就开始设计了,把喜欢的图片导入,然后按照喜欢的方式进行布置。虽然说一般电路板应该是要实现功能的,但是我不会做,做出来也是为了玩,所以我最多也只是在上面加了一个线圈,其他的什么功能也没有。</p>
<h1 id="制造结果">
<a href="#制造结果"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 制造结果
</h1>
<p>我一开始做的时候不清楚PCB的本质以为它是在铜板上划出电路结果今天我取到货之后才发现完全不是这样PCB其实是在塑料板上打印铜线所以我在第一次设计的时候没搞清楚这个问题我把有些阻焊层去掉之后下面就直接露出了塑料板不怎么好看所以今天我明白之后修改了一下图纸又上传上去让他们制造了。 </p><p>
打印5张这样的PCB名片倒是挺便宜的5张一共才5CNY虽然说真正的名片5CNY可能能打100张但是制作一次也不过是相当于喝了一大瓶饮料而已所以再打一次也没关系。 </p><p>
另外我想吐槽一下快递的速度制作板子花3天时间可以理解但是快递送4天就有点过分了最终下单一周之后才取到。上次我用的是京东快递真的是体验极差这次我换成了顺丰的希望它能快一点。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=PCB"><em>PCB</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%90%8D%E7%89%87"><em>名片</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%88%B6%E4%BD%9C"><em>制作</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-07-29-card.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/07/29/card.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/06/17/backup.html">
上一篇:论备份的重要性
</a>
</span>
<br />
<span class="next">
<a href="/2020/08/21/sth2.html">
下一篇:假期总结第二弹
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/07/29/card', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/07/29/card.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

310
2020/08/21/sth2.html Normal file
View File

@@ -0,0 +1,310 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>假期总结第二弹 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="假期总结第二弹" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="这个假期还真是“长”啊……" />
<meta property="og:description" content="这个假期还真是“长”啊……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-21T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="假期总结第二弹" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-08-21T00:00:00+08:00","datePublished":"2020-08-21T00:00:00+08:00","description":"这个假期还真是“长”啊……","headline":"假期总结第二弹","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/08/21/sth2.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/08/21/sth2.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/08/21/sth2.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-08-21T00:00:00+08:00">21 August 2020</time> - 字数统计567 - 阅读大约需要2分钟 - Hits: <span id="/2020/08/21/sth2.html" class="visitors">Loading...</span></small>
<h1 class="p-name">假期总结第二弹</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Fri, 21 Aug 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章提到作者感叹假期漫长且无所作为,描述了思维能力下降,比喻为思考能力像被疯狂切割。作者考取驾照后并无特别感受,意识到自己缺乏目标和动力。此外,提到了假期中因飞机票改签事宜而两次购买的经历,以及意识到自己对未来的计划能力有限。整篇文章反映了作者的迷茫与自我反思。</p>
<hr />
<ul><li><a href="#依旧什么也没做">依旧什么也没做</a></li><li><a href="#也许不完全什么都没做">也许不完全什么都没做</a></li><li><a href="#想要做的事情">想要做的事情</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>这个假期还真是“长”啊……<!--more--></p>
<h1 id="依旧什么也没做">
<a href="#依旧什么也没做"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 依旧什么也没做
</h1>
<p>去年我写了一篇<a href="/2019/08/24/sth.html">假期总结</a>,什么也没做,今年比去年更糟糕,更加的什么都没做。 </p><p>
最近我感觉我的思维就像是一块蛋糕,被万恶的资本家疯狂的切割,不是那种平均分的切法,而是一刀下去先切一半,第二次在其中一块上切三刀,第三次切四刀……总而言之我也不知道我在说什么,意思就是思考能力就如同抛物线那样下降,大概就是这样。 </p><p>
在这个假期我总算是把驾照考下来了,不过考下来之后我感觉好像也没啥,什么感觉都没有,不过是有了开车的资格罢了。 </p><p>
如此长的假期,将近有半年,在上课期间,每天在床上打开手机,什么也不做…… </p><p>
感觉我的处境还是有点危险的,没有目标,不是真的没有目标,而是没有实现目标的意义……做事情给谁看呢? </p><p>
以上就是被切割成为2<sup>n</sup>的感受思考能力下降的很严重就好像一块装有服务器的CPU的电脑安装了很老的家庭版系统不支持多核心每个核心的频率还很低……</p>
<h1 id="也许不完全什么都没做">
<a href="#也许不完全什么都没做"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 也许不完全什么都没做
</h1>
<p>我想不起来这个假期我还做了什么,也许之前的文章里都有写,但是最近确实啥都没做。 </p><p>
唯一我想到的事情是学校推迟了几天开学,可是我提前买了机票。然后发现改签还不如退票重买便宜,然后就重新买了。所以以后如果遇到了类似的事情,再看看那一天机票的价格吧。</p>
<h1 id="想要做的事情">
<a href="#想要做的事情"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 想要做的事情
</h1>
<p>我没有能力思考更多的事情了,正好手头有一个好几年前的旧山寨机,想想我能用它做什么更多的事情吧。 </p><p>
😢</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%81%87%E6%9C%9F"><em>假期</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%80%BB%E7%BB%93"><em>总结</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-08-21-sth2.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/08/21/sth2.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/07/29/card.html">
上一篇如何制作一个PCB名片
</a>
</span>
<br />
<span class="next">
<a href="/2020/08/28/banned.html">
下一篇网站被Ban怎么办
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/08/21/sth2', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/08/21/sth2.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

330
2020/08/28/banned.html Normal file
View File

@@ -0,0 +1,330 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>网站被Ban怎么办 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="网站被Ban怎么办" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="虽然不是第一次,但是这事终于落到我头上了" />
<meta property="og:description" content="虽然不是第一次,但是这事终于落到我头上了" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-28T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="网站被Ban怎么办" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-08-28T00:00:00+08:00","datePublished":"2020-08-28T00:00:00+08:00","description":"虽然不是第一次,但是这事终于落到我头上了","headline":"网站被Ban怎么办","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/08/28/banned.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/08/28/banned.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/08/28/banned.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-08-28T00:00:00+08:00">28 August 2020</time> - 字数统计1417 - 阅读大约需要5分钟 - Hits: <span id="/2020/08/28/banned.html" class="visitors">Loading...</span></small>
<h1 class="p-name">网站被Ban怎么办</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Fri, 28 Aug 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讨论了网站say-huahuo.com受到DNS污染导致的访问问题作者作为维护者面临流量骤降和百度权重下降等问题。他们通过更换域名、使用Nginx的sub_filter模块和修改Discuz、UCenter配置来应对。文章强调了防火长城对用户访问的影响尽管有DNS污染的解决方案但对于大部分电脑操作不熟练的用户来说难度较大。作者从中吸取教训认识到准备充分的重要性包括备用域名和不将网站与域名过于紧密绑定以应对可能的未来风险。最后作者建议要谨慎处理子域名和网站结构以减少因域名变化带来的问题。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#解决方案">解决方案</a></li><li><a href="#永远要考虑用户">永远要考虑用户</a></li><li><a href="#如何使用国外的服务器检测dns污染">如何使用国外的服务器检测DNS污染</a></li><li><a href="#总结">总结</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>虽然不是第一次,但是这事终于落到我头上了<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>在一年前,我写了一篇<a href="/2019/04/27/antiban.html">Anti-Ban</a>的文章主要讲的是如何避免由于网站被Ban导致的无法访问。 </p><p>
然而现在身份换了我不再是被Ban网站的访问者而是维护者这时候我们应该怎么办</p>
<h1 id="解决方案">
<a href="#解决方案"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 解决方案
</h1>
<p>我维护的网站就是花火学园前两天网站的域名say-huahuo.com包括其子域名都被DNS污染了。污染的当天访问量直接下降3/4简直是太恐怖了而且这还只是防火长城的最低级别的攻击。 </p><p>
被污染的两天后百度权重骤降直接预估流量暴降10倍……我以前还挺自信的让网站与域名耦合度很高这么一搞我以后是不敢再在内链里搞URL了最多就是绝对路径然后像我之前还搞什么图床之类的现在出现这么个事也不敢再搞子域名了。 </p><p>
当然域名被污染这个也不是什么大事在我维护前貌似也出现过类似的事情那时候的用户量远比现在低解决方案也很简单就是换域名只是我以前太自大了好多配置的地方都用的是带域名的URL所以直接换就会出现好多问题。 </p><p>
还好Nginx有一个叫做<code class="language-plaintext highlighter-rouge">sub_filter</code>的模块我可以直接使用这个模块把页面中所有涉及say-huahuo.com的部分全部替换成现在的say-huahuo.me。虽然这样会增大服务器的压力但是也没有啥更好的办法了以后有机会再把数据库里的所有链接替换一下应该就没问题了吧。 </p><p>
不过那也只是个辅助的方案大多数情况还是要Discuz里面调整。首先要在后台把所有有关应用域名的东西全部关掉然后在配置文件里把cookie域删掉另外还要改一下UCenter的配置文件要把UC_API的地址改成/uc_server不然头像就会调用带域名的URL然后就会出问题。</p>
<h1 id="永远要考虑用户">
<a href="#永远要考虑用户"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 永远要考虑用户
</h1>
<p>其实对于我来说换不换域名都是次要的因为防火长城最低级别的攻击DNS污染使用DoH、DoT、DNSCrypt等一大堆避免被污染的方案就可以解决实在不行用hosts文件手动设置IP也行嘛。 </p><p>
虽然这么说,但是访问网站的一大批用户全是电脑小白,那些人能把手放在鼠标上能用键盘打几个字已经很了不起了,像复杂的事情他们也不会懂。虽然我维护的网站没有广告,流量对我来说毫无意义,但是维护一个没有人访问的网站也很无聊啊,没有人访问网站开着有什么意义?</p>
<h1 id="如何使用国外的服务器检测dns污染">
<a href="#如何使用国外的服务器检测dns污染"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 如何使用国外的服务器检测DNS污染
</h1>
<p>一般防火长城都是在国际网络出入口设立的,所以如果是国内访问国内还是国外访问国外都是不通过防火长城的。所以怎么样才能在国外检测某域名在国内的状态呢? </p><p>
我之前也不清楚这个问题后来发现只要用国内的DNS来解析不就好了嘛23333在国外也可以用<code class="language-plaintext highlighter-rouge">nslookup</code>使用国内的DNS这样就会经过防火长城而实现检测的功能了。</p>
<h1 id="总结">
<a href="#总结"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 总结
</h1>
<p>通过这件事,我明白了防火长城再垃圾也是能防住大量用户的,毕竟大量用户都是小白,而且域名一旦被他们认证,终身也别想解禁,所以一般情况下还是不要惹他们比较好。 </p><p>
另外只搞了备用域名没搞发布地址也确实是考虑的不够周全,不过也确实是我太自大了,怎么会认为那样的网站不会被防火长城屏蔽?虽然这个域名活了将近两年,但是确实我们做的准备不够充分。 </p><p>
还有就是尽可能不要滥用子域名虽然说有些静态资源放到子域名可以不传cookie可以让速度更快一些但是这种事对我们来说没有意义另外就是不要让网站与域名耦合万一哪一天要换域名麻烦事就出来了。像我的博客用的基本上都是绝对路径这样就能避免由于GitHub Pages域名出问题之后换域名困难的问题了。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%BD%91%E7%AB%99"><em>网站</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=Ban"><em>Ban</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-08-28-banned.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/08/28/banned.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/08/21/sth2.html">
上一篇:假期总结第二弹
</a>
</span>
<br />
<span class="next">
<a href="/2020/09/10/site.html">
下一篇:如何建立一个校园内部网站
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/08/28/banned', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/08/28/banned.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

334
2020/09/10/site.html Normal file
View File

@@ -0,0 +1,334 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>如何建立一个校园内部网站 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="如何建立一个校园内部网站" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="其实我感觉大学生活也挺好的。" />
<meta property="og:description" content="其实我感觉大学生活也挺好的。" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-09-10T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="如何建立一个校园内部网站" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-09-10T00:00:00+08:00","datePublished":"2020-09-10T00:00:00+08:00","description":"其实我感觉大学生活也挺好的。","headline":"如何建立一个校园内部网站","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/09/10/site.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/09/10/site.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/09/10/site.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-09-10T00:00:00+08:00">10 September 2020</time> - 字数统计2181 - 阅读大约需要7分钟 - Hits: <span id="/2020/09/10/site.html" class="visitors">Loading...</span></small>
<h1 class="p-name">如何建立一个校园内部网站</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Thu, 10 Sep 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章描述的是作者利用大学社团的服务器资源经历了一系列挫折后建立校园内部网站的过程。作者从最初打算安装ESXi和Hyper-V到尝试安装Ubuntu和CentOS遇到的困难如驱动问题和版本不匹配。最终选择了Cockpit面板方便管理并借助DDNS解决方案处理动态IP问题。作者还提到利用服务器资源进行了World Community Grid的志愿计算项目以合理利用计算能力。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#服务器的折腾之旅">服务器的折腾之旅</a></li><li><a href="#如何公开自建服务器">如何公开自建服务器</a></li><li><a href="#给网站加个域名">给网站加个域名</a></li><li><a href="#合理利用资源">合理利用资源</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>其实我感觉大学生活也挺好的。<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>去年我进入大学后加入了一个专门研究云计算以及网络(名义上)的社团,不过那时候我才是大一新生,加入后没有权限。到了第二年,我成功的进入了管理层,这次我就可以好好的看看这个社团有什么有意思的东西了。 </p><p>
首先社团内有专属于自己的网络社团办公室内有一个交换机是连接所在教学楼的网络的。另外还有一个树莓派看起来好像是一次都没有用过系统也是全新的RPiOS。 </p><p>
除此之外,社团内有一台机架式服务器,看起来好像好长时间没有用了,第一次启动直接报内存错误,我只好把内存条拆出来擦了擦才能正常开机。 </p><p>
我以前觉得服务器应该配置相当高不来个双路TR3990X再整个一堆上TiB的内存根本不能称作服务器。不过这台垃圾服务器改变了我的想法。这是一台主板型号为S5500HCV的服务器有双路CPU和4条4GiB的内存条硬盘500GiB还是机械的。仔细看了看这双路的CPU怎么加起来才8个核心而且还不支持超线程这配置还不如我新买的笔记本电脑然后大小还特别大比一般的机箱大得多而且开机速度又慢风扇还不支持调速真是有够垃圾的。 </p><p>
不过垃圾就垃圾吧毕竟还是个服务器最起码还能支持24/7工作制365天全年不断电应该是可以保证的。既然有了这样的资源我觉得应该搞点什么在服务器上面不然这么大的东西闲置也挺浪费的。</p>
<h1 id="服务器的折腾之旅">
<a href="#服务器的折腾之旅"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 服务器的折腾之旅
</h1>
<p>最开始我是打算装ESXi的因为自从有Hyper-V之后我基本上就没用过VMWare了而且这俩还是互斥的。以前看到ESXi之后挺想在我的Hyper-V虚拟机里装一个可惜ESXi这个系统实在是太垃圾安装必须要网卡驱动然后它支持的驱动还特别少所以这次有了真正的服务器自然是想试一下装个ESXi玩玩。 </p><p>
首先我装的是ESXi7打开后结果又是没有显卡驱动所以我只好下ESXi6试试看打开之后确实可以装了但是装好之后却没办法引导了这就很奇怪所以我只好放弃安装ESXi的想法。 </p><p>
之后我就想着要不然就正常的安个服务器操作系统吧Ubuntu用的多了干脆安个CentOS好了。不过安CentOS有不少坑因为我安装没办法用光盘装一般都是先录到U盘里再装但是不知道为啥CentOS的引导是用的是卷标名然后U盘只能用11位的卷标名安装程序就没法引导。 </p><p>
除了这个坑之外还有一个就是8和8-stream版本的不同。因为直接把整个CentOS下下来很麻烦我就直接下的是网络安装版的。安装程序我下的是8-stream的但是我当时不知道用哪个源结果搞成了8的源装到一半就出错退出了很难受之后仔细检查才发现原来是版本搞错了。 </p><p>
安好之后就是如何管理服务器的问题了虽然直接用SSH或者用自带的Cockpit也挺不错显得很专业但是我觉得麻烦就直接用了某删库塔面板了反正是在内网里也没谁会攻击而且安装配置确实方便想做的事情一键就能搞定。 </p><p>
虽然这个服务器挺垃圾但是至少要比一般的云服务器强同配置的云服务器要不少钱我肯定是不会租当然也没用过。所以像什么Gitlab之类的我可以随便装反正有16GiB内存也不担心。 </p><p>
另外就是网页服务器的环境了,面板确实方便,轻轻松松就能装一个博客、论坛加网盘了。既然网站建好了,就要考虑如何访问的问题了。</p>
<h1 id="如何公开自建服务器">
<a href="#如何公开自建服务器"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 如何公开自建服务器
</h1>
<p>正常情况下我们用的网络都是经过路由器的然后就会有NAT就没法从外面访问里面的服务。一般情况下解决这个问题就是用内网穿透比如frp之类的。不过我们的网站不太适合暴露到外网上毕竟开了一大堆服务又没有防火墙密码还超级简单万一服务器被外面的人攻破了学校内网估计也得凉。 </p><p>
不能暴露在外网的话至少学校内网能访问也不错啊不过服务器前面连了一个路由器经过了一次转换然后就没办法在学校内访问了。还好路由器可以设置DMZ主机把服务器的内部IP设成静态的然后开DMZ主机就能解决这个问题了另外路由器连接的校园内网也没有NAT所以在校内就可以直接运行了。</p>
<h1 id="给网站加个域名">
<a href="#给网站加个域名"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 给网站加个域名
</h1>
<p>虽然通过上面的方法可以让大家访问服务器但是有一个问题就是动态IP的问题。我可以改在社团的路由器但是不能改学校的交换机所以IP地址没办法固定虽然也可以直接在服务器上改成固定IP但是我担心这样会造成IP冲突之类的问题。这种情况就很麻烦因为好多网站内链都是带站点地址的URL我建的网站都是通过引擎建的改又不好改这就很麻烦。 </p><p>
这个问题比较好的解决方案就是使用域名域名解析的结果不一定必须是一个外网地址内网地址同样可以解析。这样我回头可以买个域名然后解析如果发生断电之类的问题导致IP改变我就可以直接改一次就行了。DDNS也是个不错的解决方案不过这种事发生次数不多所以就懒得搞了。</p>
<h1 id="合理利用资源">
<a href="#合理利用资源"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 合理利用资源
</h1>
<p>虽然建了网站但是平时也没有人访问……而且就算有人访问服务器运行网站服务程序基本上没什么压力这样服务器运行基本上就是空转了。既然我打算让它持续运行肯定不能让它空转我肯定要搞点啥利用好这个运算资源。挖矿是个不错的选择但是我不屑于去做不如搞点为人类发展做出贡献的事情像World Community Grid这样的志愿计算项目就挺不错。 </p><p>
于是我就在上面安装了BOINC这种程序虽然会占用大量的运算资源但是它的运行优先级很低所以网站运行完全没有影响这样就能合理的运用好这些计算资源了。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E7%BD%91%E7%AB%99"><em>网站</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%A0%A1%E5%9B%AD"><em>校园</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-09-10-site.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/09/10/site.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/08/28/banned.html">
上一篇网站被Ban怎么办
</a>
</span>
<br />
<span class="next">
<a href="/2020/09/27/vm.html">
下一篇:关于虚拟化的学习记录
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/09/10/site', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/09/10/site.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

342
2020/09/27/vm.html Normal file
View File

@@ -0,0 +1,342 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于虚拟化的学习记录 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于虚拟化的学习记录" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="虚拟机……感觉有点哲学。" />
<meta property="og:description" content="虚拟机……感觉有点哲学。" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-09-27T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于虚拟化的学习记录" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-09-27T00:00:00+08:00","datePublished":"2020-09-27T00:00:00+08:00","description":"虚拟机……感觉有点哲学。","headline":"关于虚拟化的学习记录","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/09/27/vm.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/09/27/vm.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/09/27/vm.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-09-27T00:00:00+08:00">27 September 2020</time> - 字数统计2492 - 阅读大约需要8分钟 - Hits: <span id="/2020/09/27/vm.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于虚拟化的学习记录</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 27 Sep 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章是关于作者的虚拟化学习经历从早期的PC虚拟机软件VMware Workstation和Hyper-V的比较到手机上的虚拟机如DOSBox Turbo、Bochs、qemu和VMOS的使用以及对虚拟化概念的哲学思考。作者提到虚拟机技术的发展包括资源管理和隔离性同时提到了操作系统、BIOS和虚拟化的界限指出虚拟化并非简单的资源复制而涉及到复杂的逻辑和实际运行环境的问题如虚拟化集群中的通信挑战。</p>
<hr />
<ul><li><a href="#mayx的虚拟化学习史">Mayx的虚拟化学习史</a><ul><li><a href="#pc上的虚拟机使用史">PC上的虚拟机使用史</a></li><li><a href="#手机的虚拟机使用史">手机的虚拟机使用史</a></li><li><a href="#其他平台的虚拟机">其他平台的虚拟机</a></li></ul></li><li><a href="#对虚拟化概念的探索">对虚拟化概念的探索</a></li><li><a href="#未解决的问题">未解决的问题</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>虚拟机……感觉有点哲学。<!--more--></p>
<h1 id="mayx的虚拟化学习史">
<a href="#mayx的虚拟化学习史"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> Mayx的虚拟化学习史
</h1>
<h2 id="pc上的虚拟机使用史">
<a href="#pc上的虚拟机使用史"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> PC上的虚拟机使用史
</h2>
<p>在我小的时候我就玩过虚拟机那时候Windows10还没有出来用的还是WindowsXP的系统那时候我使用的虚拟机软件是VMWare Workstation。过去的VMWare和现在的感觉区别不大十年过去了感觉加的功能也不多非要说哪个功能有更新的话可能也就是随着现在的物理机更新一样增加了一些比如UEFI之类的功能吧。 </p><p>
后来我用上了Windows10那时候我还是第一批用上Windows10的人正式版还没有出来我就已经用上了技术预览版不过直到正式版出来我依然使用的是VMWare做虚拟机。后来我在系统里乱逛的时候发现了Hyper-V那是一个比VMWare更轻量更底层的一个虚拟机不需要下载其他程序就能在Windows10里直接打开非常方便。 </p><p>
自从我知道了Hyper-V后就再不用VMWare了除了两个不能共存的原因之外还有就是Hyper-V感觉更稳定速度更快而且与Windows的结合更好。不过有一个缺点就是没有办法挂载USB设备这个就很麻烦…… </p><p>
以前我在用VMWare的时候经常遇到一个问题就是有时候虚拟机里面的系统卡死了但是我点关机的时候用的是客户机关机然后VMWare就卡死了。这时候就算结束掉它用来获取计算资源的进程<code class="language-plaintext highlighter-rouge">vmware-vmx.exe</code>也没用就算是注销也不行只能关机重启之后也经常会因为锁的原因而出现打不开的问题就很麻烦。但是自从我用了Hyper-V之后就再也没有遇到过这种情况大概是因为Hyper-V对资源的管控更好吧基本上不会出现虚拟机把物理机怼死的情况。 </p><p>
说到这里就让我想起最近我安装的ESXi了由于我的主电脑用的是Hyper-V垃圾ESXi没有Hyper-V网卡的驱动然后就怎么装都装不上然后没办法我就只能用我的旧电脑安结果安好之后发生了一个很神奇的事情就是用ESXi创建一个虚拟机然后启动之后物理机就直接断电重启了这就有点不太合适了虚拟机无论怎么搞能影响到物理机就不太合格了啊。 </p><p>
总的来说可以发现PC机虚拟化的软件基本上都是依靠CPU内置的虚拟化指令来运行的所以效率很高。</p>
<h2 id="手机的虚拟机使用史">
<a href="#手机的虚拟机使用史"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 手机的虚拟机使用史
</h2>
<p>手机上我也安装过不少种类的虚拟机最早我用的手机性能很差好像还是清华紫光的CPU。那个垃圾手机当时我还拿来当服务器使。虽然我也知道其他的虚拟机但是那个手机带不起来我记得最早我用的是DOSBox Turbo在那个上面我安装了一个Windows3.2的系统。不过这个软件除了这一个虚拟机就不能再开别的系统了,而且基本上没有隔离,它可以直接访问手机里的文件,这就不太好。 </p><p>
后来我用上了一个稍微好一点的手机那时候我知道了Bochs不过那个系统不是我自己装的那个软件的配置文件对那时候的我来说太复杂了我看不懂所以是直接用的贴吧上的镜像。 </p><p>
知道了Bochs之后我就了解到了Limbo那是一个基于qemu的虚拟机用起来要比Bochs简单很多不用写配置文件就可以直接使用。所以这个东西只要不是用的需要一些特别的指令都没问题我试着装了WindowsXP以及MenuetOS、KolibriOS、TempleOS等等基本上都可以正常运行。 </p><p>
后来我还试了试别的软件比如VMOS好像也是一个基于qemu的虚拟机不过它是ARM指令集的安装的是Android系统在很多时候运行一些有可能有问题的软件很方便。 </p><p>
还有一个是ExaGear是基于Wine制作的它只能在一定程度上运行Windows的程序而且因为它也是跨指令集的其实效率不这么高。 </p><p>
以上我们可以发现手机上的虚拟机基本上都是软件模拟的指令集都不一样想怎么搞虚拟化指令虽然ARM的CPU应该支持硬件虚拟化但是目前我的了解是没发现有类似的软件。</p>
<h2 id="其他平台的虚拟机">
<a href="#其他平台的虚拟机"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 其他平台的虚拟机
</h2>
<p>除了在电脑和手机上的虚拟机还有在浏览器上运行的虚拟机真就JS创造宇宙呗。qemu的作者Fabrice Bellard曾经写过一个叫做<a href="https://bellard.org/jslinux/">JSLinux</a>的项目可以运行比如x86指令集的系统相当厉害。</p>
<h1 id="对虚拟化概念的探索">
<a href="#对虚拟化概念的探索"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 对虚拟化概念的探索
</h1>
<p>说完对虚拟化平台的使用,我觉得虚拟机的概念和实现还是比较神奇的。什么是虚拟机?我觉得应该只要是在逻辑上提供运算及存储资源的东西都可以称作是虚拟机,包括人也可以作为一种虚拟化平台。我以前听说过一个故事讲的是图灵下国际象棋,他写了一个下国际象棋的程序,但是那时候还没有电脑。于是他自己就模拟电脑的执行方式和朋友下完了象棋。我觉得他在执行这个程序的时候就相当于开了一个虚拟机,在逻辑上构造了一台可以运行他程序的机器,毕竟图灵是人,不是机器,所以我觉得应该可以叫做虚拟机。 </p><p>
但是这么来说的话,只要不是实模式的操作系统我觉得应该都算是虚拟机,因为程序没有真正享用到电脑的所有运算与存储资源,它们的资源都是由操作系统所分配,这么来看操作系统岂不是也是虚拟机?那么这种虚拟机的意义就和实际的虚拟机意义不相符了,我觉得应该再加一些限制条件。 </p><p>
操作系统的特点是BIOS将代码载入到内存中程序的特点则是操作系统将代码载入到内存中。这么来看的话我觉得就可以得出需要BIOS载入代码并提供运算和存储资源的东西应该才能叫虚拟机……但是BIOS又算什么呢……emmmm所以就是这种原因导致了我感觉虚拟机有些哲学。 </p><p>
除此之外还有像沙箱、Docker这些对资源再次分配的程序它们只是进行资源限制但是程序的代码不是由它们载入的……这就更迷了……</p>
<h1 id="未解决的问题">
<a href="#未解决的问题"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 未解决的问题
</h1>
<p>一般我们认为虚拟化是将一台电脑的资源合理分配把一台电脑当作很多台来用但是我听说有一种叫做虚拟化集群的东西可以把一大堆电脑模拟成一台电脑来用。但是这时候我觉得就会有一些问题比如一般程序会有比如进程间通讯之类的功能但是两个进程假如放在了不同的两个电脑它们的通讯岂不是要通过网线正常情况下应该是通过内存进行通讯吧这个速度估计得差几千倍就算是多CPU的服务器之间也是通过总线连接。拿网线连接真的能用吗这就让我对虚拟化集群这个感到有些迷惑不知道那些虚拟化软件是怎么搞的。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%99%9A%E6%8B%9F%E5%8C%96"><em>虚拟化</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%AE%B0%E5%BD%95"><em>记录</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-09-27-vm.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/09/27/vm.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/09/10/site.html">
上一篇:如何建立一个校园内部网站
</a>
</span>
<br />
<span class="next">
<a href="/2020/10/24/try.html">
下一篇Mayx的产品测评
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/09/27/vm', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/09/27/vm.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

267
2020/10/24/try.html Normal file

File diff suppressed because one or more lines are too long

310
2020/11/24/createctf.html Normal file
View File

@@ -0,0 +1,310 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>记一次组织CTF的经历 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="记一次组织CTF的经历" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="不会打我也能搞CTF(:-P)" />
<meta property="og:description" content="不会打我也能搞CTF(:-P)" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-11-24T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="记一次组织CTF的经历" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-11-24T00:00:00+08:00","datePublished":"2020-11-24T00:00:00+08:00","description":"不会打我也能搞CTF(:-P)","headline":"记一次组织CTF的经历","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/11/24/createctf.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/11/24/createctf.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/11/24/createctf.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-11-24T00:00:00+08:00">24 November 2020</time> - 字数统计1243 - 阅读大约需要4分钟 - Hits: <span id="/2020/11/24/createctf.html" class="visitors">Loading...</span></small>
<h1 class="p-name">记一次组织CTF的经历</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Tue, 24 Nov 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了作者作为协会部门部长参与组织一次CTF比赛的经历。虽然作者原本对CTF感兴趣并计划将其做成游戏但实际负责运维时发现所使用的FBCTF平台存在很多问题如已不维护、存在安全限制、部署复杂性需要hhvm环境以及国际化和数据库字符集设置上的问题。尽管过程中遇到了bug和新需求PHP老师还是在短期内完成了额外任务。作者表示比赛还在进行可能会有更多意想不到的事情发生。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#感受">感受</a></li><li><a href="#经历">经历</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>不会打我也能搞CTF(:-P)<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>在一年前,我<a href="/2019/12/16/ctf.html">体验了一次CTF</a>,感觉挺有意思的,而且为此我甚至计划做一个以此为基础的<a href="/2019/12/17/game.html">游戏</a>。可惜人不行了,除了会咕咕咕其他什么都不行。 </p><p>
想不到就在最近我不用参加CTF而是直接去给其他人玩CTF的机会。最近我所在的协会要承包一次CTF的比赛我作为协会部门的部长自然也要参与其中。我最擅长的就是运维所以在这次比赛我就成为负责维护这次CTF平台的运维了。</p>
<h1 id="感受">
<a href="#感受"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 感受
</h1>
<p>成为了维护CTF系统的人之后我对CTF的了解更深了CTF系统的本质就是一个计分板加一台靶机然后题就那么几种像Web、PWN这种题需要靶机其他的Crypto、Reverse、Misc啥的就只需要把题目放到一个文件服务器里就行了。另外计分板也非常的简单就只需要一个判断结果是不是等于设定好的flag就完事了然后根据答题情况给分就行了。 </p><p>
一般正式的赛事中好像flag都是动态的每一个队伍的flag都不一样然后每个队伍打的靶机也全部都是用docker隔离开的像我们举行的这个CTF并不算专业只能算是比较业余的。</p>
<h1 id="经历">
<a href="#经历"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 经历
</h1>
<p>在这次CTF中我本来是不想管平台的事情如果我来搭建这个平台我可能会选择<a href="https://github.com/CTFd/CTFd">CTFd</a>作为本次CTF的平台。不过这个CTF在我来之前举办过几次他们使用的是由Facebook开发的<a href="https://github.com/facebookarchive/fbctf">FBCTF</a>作为整个比赛的平台。我作为运维,肯定也不会去管程序上的事情,就干脆让他们去搞相关的事情了。 </p><p>
不过现实证明这是一个错误的决定这个平台已经不维护了虽然看起来确实挺好看但是BUG也多在这次比赛中给我们维护组带来了不少的压力。就比如说这个平台里的<a href="https://github.com/facebookarchive/fbctf/blob/4ec9b6be404fce1bed6d1066fccf10c4255767bb/database/countries.sql#L161">这一句话</a>,给我们带来了很多麻烦。就这样的短短一句话,搞的正在运行的平台直接被迫停止运行。为什么呢?很简单,因为我所在的学校是中国啊,不允许这样的事情发生…… </p><p>
另外这个FBCTF也很迷看代码不过就是普通的PHP而已但是部署的时候用的软件和方式都和平时不一样。正常来说这种东西一个LEMP或者LAMP就能解决问题而它非得要一个什么hhvm的环境不过环境不是我搭的它用啥我倒是不在乎。然而它的i18n有问题<a href="https://github.com/facebookarchive/fbctf/blob/4ec9b6be404fce1bed6d1066fccf10c4255767bb/src/controllers/IndexController.php#L598">这一行</a>没有加<code class="language-plaintext highlighter-rouge">tr</code>的那个函数然后注册的时候显示就会出问题。有问题倒是没关系大不了改了就行了可是这个破玩意改了之后居然没反应我搞了半天都没有搞好后来发现因为它用了hhvm这个东西会把php代码编译然后直接修改代码就啥反应都没有必须用<code class="language-plaintext highlighter-rouge">hhvm-repo-mode</code>才能更新代码😓…… </p><p>
其他的就是数据库,那个部署的人当时居然没改字符集,用的还是拉丁文的字符集,然后存储中文的时候就会各种乱码,怎么搞都搞不回来,不过程序里面好像没有受影响,所以也就算了。 </p><p>
还有就是领导的新需求这也算是提前体验公司生活了领导说要加一个功能我肯定不会想着去接这个大坑最后这个任务被派给了我们的PHP老师不过老师确实专业花了4个小时最终真的就搞成了水平确实了的。 </p><p>
目前这次的比赛还没有结束,不知道还会出什么新的莫名其妙的事情,敬请期待吧~</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=CTF"><em>CTF</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E8%AE%B0%E5%BD%95"><em>记录</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-11-24-createctf.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/11/24/createctf.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/10/24/try.html">
上一篇Mayx的产品测评
</a>
</span>
<br />
<span class="next">
<a href="/2020/12/07/picore.html">
下一篇在树莓派上体验piCore
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/11/24/createctf', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/11/24/createctf.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

344
2020/12/07/picore.html Normal file
View File

@@ -0,0 +1,344 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>在树莓派上体验piCore | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="在树莓派上体验piCore" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="麻雀虽小,五脏俱全" />
<meta property="og:description" content="麻雀虽小,五脏俱全" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-12-07T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="在树莓派上体验piCore" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-12-07T00:00:00+08:00","datePublished":"2020-12-07T00:00:00+08:00","description":"麻雀虽小,五脏俱全","headline":"在树莓派上体验piCore","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/12/07/picore.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/12/07/picore.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/12/07/picore.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-12-07T00:00:00+08:00">7 December 2020</time> - 字数统计1998 - 阅读大约需要6分钟 - Hits: <span id="/2020/12/07/picore.html" class="visitors">Loading...</span></small>
<h1 class="p-name">在树莓派上体验piCore</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Mon, 07 Dec 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章介绍了在树莓派上体验piCore的操作系统选择和安装过程。作者原本考虑用树莓派作为网络资源共享设备转向使用Tiny Core Linux的piCore发行版因为它的安装包只有23MiB非常适合资源有限的设备。piCore虽基于内存但提供了解决数据持久化的方法通过写入特殊文件。文章详细讲述了如何使用fdisk调整分区如何用tce-ab简易安装软件包括配置Wifi以及与Raspberry Pi OS lite的对比尽管体积小且功能类似piCore因其小型、快速和特定的探索性质更适合作者的使用需求。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#使用方法">使用方法</a><ul><li><a href="#扩大分区">扩大分区</a></li><li><a href="#安装软件">安装软件</a></li><li><a href="#配置wifi">配置Wifi</a></li></ul></li><li><a href="#与raspberry-pi-os-lite的对比">与Raspberry Pi OS lite的对比</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>麻雀虽小,五脏俱全<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近想让协会的打印机共享到网络上,但是又没有什么好的方法,如果用电脑的话体积有点太大了,所以我就考虑用树莓派来共享。 </p><p>
我手头有一个吃灰多年的树莓派有一个问题是我应该在上面装什么操作系统比较好一般来说在树莓派上肯定是装官方的Raspberry Pi OS会更好一些但是官方的系统很大下载也有点慢所以就想找个小一点的系统来处理。 </p><p>
最终我找到了一个叫做Tiny Core Linux的发行版它有一个专门为树莓派开发的一个叫做piCore的发行版下载下来只需要23MiB可以说是非常不错了毕竟就算是Raspberry Pi OS lite也要400多MiB。 </p><p>
另外,点击<a href="http://www.tinycorelinux.net/12.x/aarch64/releases/RPi/piCore64-12.0.zip">这里</a>就可以下载安装包了。</p>
<h1 id="使用方法">
<a href="#使用方法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 使用方法
</h1>
<p>总体来说piCore还是挺不错的文档写的也还可以该有的功能基本上都有了。安装很简单和树莓派一样直接把镜像写入MicroSD卡就可以直接使用了。不过有一个问题是它的系统不是直接挂载分区使用的它的根目录是在内存里面的所以如果直接断电所作的操作没有办法保存。 </p><p>
不过他们提供了一种方案来解决这个问题,在对根目录下的文件进行操作后,可以执行<code class="language-plaintext highlighter-rouge">filetool.sh -b</code>把修改写到一个特别的文件里面,之后每一次开机系统都会读那个特别的文件来保持重启后数据不会丢失。 </p><p>
第一次启动的时候系统会自动生成SSH的Key所以第一次启动就要执行上面的命令。这些事情在README都有写。另外就是使用完整分区的问题根据这个发行版的设计所有的操作会写到第二个分区里面但是默认情况下第二个分区只有16MiB所以要扩大这个分区的大小。 </p><p>
顺便一说这个系统的默认用户名是tc密码是piCore。 </p><p>
扩大的方法在README里面也有写但是全英文而且写的也不太清晰让我很难受而且在国内貌似几乎没有人使用piCore导致我第一次搞这个东西的时候很痛苦所以我还是在这里记录一下吧。</p>
<h2 id="扩大分区">
<a href="#扩大分区"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 扩大分区
</h2>
<p>首先第一步执行<code class="language-plaintext highlighter-rouge">sudo fdisk -u /dev/mmcblk0</code>然后输入p查看分区接下来记住第二个分区的StartLBA。记好以后输入d删除第二分区并且输入n重新创建分区。其中出现First Sector的时候输入刚刚记住的数字其他的就默认就行了。最后输入w保存。 </p><p>
很神奇的是用fdisk操作分区的时候并不会让被操作分区的数据丢失貌似它只会修改分区表也许这才是fdisk真正做的事情吧…… </p><p>
在此之后需要重启一次,然后执行<code class="language-plaintext highlighter-rouge">resize2fs /dev/mmcblk0p2</code>让文件系统获得真正的大小就OK了。</p>
<h2 id="安装软件">
<a href="#安装软件"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 安装软件
</h2>
<p>这个系统安装软件也很神奇,由于它的系统在内存中,安装软件肯定也不能直接安装到指定的位置。他们设计了一种很神奇的安装方法,就是把程序写到一个镜像里面,然后使用的时候挂载就可以用了。直接操作可能会比较麻烦,所以他们设计了一个脚本让任何人都可以随便安装软件。 </p><p>
像debian系列的发行版都使用的是<code class="language-plaintext highlighter-rouge">apt</code>来管理软件的piCore也整了一个类似的东西叫做<code class="language-plaintext highlighter-rouge">tce-ab</code>,用起来比<code class="language-plaintext highlighter-rouge">apt</code>还要方便,它是一个可交互的脚本,想安装软件可以直接在里面搜索。方便确实很方便,而且清华源里也提供了这个系统的镜像源,还是挺不错的。 </p><p>
不过卸载的时候就有点麻烦了,它貌似没有卸载的命令,需要自己手动去<code class="language-plaintext highlighter-rouge">/mnt/mmcblk0p2/tce/optional/</code>这个路径把软件删掉。不过其实还好,文件都在一起,倒是也没有特别的麻烦。</p>
<h2 id="配置wifi">
<a href="#配置wifi"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 配置Wifi
</h2>
<p>因为piCore默认没有Wifi的驱动我还以为它不能用Wifi不过还好这个安装软件的功能可以直接安装Wifi的管理软件和驱动用起来挺方便的直接搜索wifi就可以安装不过我在里面又找到了一个叫做<code class="language-plaintext highlighter-rouge">firmware-rpi-wifi</code>的包,虽然不知道需不需要安装,但是看起来好像需要的样子就安上了。 </p><p>
还有一个问题就是即使安好后也不能自动连接Wifi这个问题处理起来也很简单第一次连Wifi是用的一个叫做<code class="language-plaintext highlighter-rouge">wifi.sh</code>的脚本,连好以后就可以在<code class="language-plaintext highlighter-rouge">/opt/bootlocal.sh</code>文件里写一句<code class="language-plaintext highlighter-rouge">wifi.sh -a</code>这样它以后每次启动都会自动连接Wifi了。不过还有一点需要注意在做完这些配置之后都需要执行<code class="language-plaintext highlighter-rouge">filetool.sh -b</code>来保证修改能在下一次重启的时候被应用。</p>
<h1 id="与raspberry-pi-os-lite的对比">
<a href="#与raspberry-pi-os-lite的对比"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 与Raspberry Pi OS lite的对比
</h1>
<p>这样一波操作下来感觉基本上Raspberry Pi OS lite和piCore在功能上也没啥区别了吧piCore不仅更快还更小从安装包来看piCore要比Raspberry Pi OS lite小20倍 </p><p>
这样看来还是piCore更好啊为什么国内连相关的文章都搜不到呢也许是因为piCore需要自己探索吧大家一般都用的是树莓派官方的系统而且因为Raspberry Pi OS lite用的是apt管理更方便所以就没人用piCore了吧…… </p><p>
不过树莓派不就是用来折腾的嘛所以我还是更支持piCore😀</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%A0%91%E8%8E%93%E6%B4%BE"><em>树莓派</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=piCore"><em>piCore</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-12-07-picore.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/12/07/picore.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/11/24/createctf.html">
上一篇记一次组织CTF的经历
</a>
</span>
<br />
<span class="next">
<a href="/2020/12/13/nat.html">
下一篇:关于内网穿透的笔记
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/12/07/picore', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/12/07/picore.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>

357
2020/12/13/nat.html Normal file
View File

@@ -0,0 +1,357 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于内网穿透的笔记 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于内网穿透的笔记" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="为了更好的运用资源,内网穿透是必要的。" />
<meta property="og:description" content="为了更好的运用资源,内网穿透是必要的。" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-12-13T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于内网穿透的笔记" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-12-13T00:00:00+08:00","datePublished":"2020-12-13T00:00:00+08:00","description":"为了更好的运用资源,内网穿透是必要的。","headline":"关于内网穿透的笔记","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/12/13/nat.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/12/13/nat.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2020/12/13/nat.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1770173707" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Wed, 04 Feb 2026 10:55:07 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2020-12-13T00:00:00+08:00">13 December 2020</time> - 字数统计1902 - 阅读大约需要6分钟 - Hits: <span id="/2020/12/13/nat.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于内网穿透的笔记</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 13 Dec 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了内网穿透的必要性和原理主要介绍了解决没有外网IP但又需要利用服务器资源的问题。作者介绍了几种方法1) 利用NAT技术实现的数据主动转发如内网穿透软件如UPnP和隧道技术如通过SSH创建隧道2) 利用VPNs建立安全隧道3) 使用frp等服务的代理技术方便用户直接访问4) 端口映射虽然需要路由器管理权限但提供不限速的连接。最后作者选择了通过端口映射的方式并计划用于IDC服务或贡献算力。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#内网穿透的原理">内网穿透的原理</a></li><li><a href="#一些实现的方案">一些实现的方案</a><ul><li><a href="#利用vpn创建隧道">利用VPN创建隧道</a></li><li><a href="#ssh隧道">SSH隧道</a></li><li><a href="#某些服务商提供的frp">某些服务商提供的frp</a></li><li><a href="#端口映射">端口映射</a></li></ul></li><li><a href="#后记">后记</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>为了更好的运用资源,内网穿透是必要的。<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近我的学校给我分配了一些服务器资源大概在市场上价格基本上在1wCNY/mo的样子。这些资源非常好但是有一个问题那就是没有外网IP想要运用这些资源必须要到机房。像机房那样的地方又冷又吵不过我不在意可惜问题不在这里问题在于它只能在机房用我又不能常常待在机房那我到底应该怎么办呢 </p><p>
其实解决方案很简单,那就是搞内网穿透。现在内网穿透的技术已经很多了,不过总体来说主要还是一个东西,那就是隧道。</p>
<h1 id="内网穿透的原理">
<a href="#内网穿透的原理"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 内网穿透的原理
</h1>
<p>我大概查了一下相关的资料一般来说内网是路由器自己划分出来的局域网。正常来说如果想让所有的机器都登上外网可以把路由器换成交换机可惜换不得毕竟外网IPv4的资源是有限的就是插了交换机也需要ISP分配IP地址给机器。 </p><p>
根据我的了解局域网和广域网进行通信的时候会用到一个叫做NAT的技术大概原理就是路由器在内网访问外网时能把自己伪装成一般的电脑向其他服务器发送数据发送过去的时候路由器会记住是哪个内网设备发送的数据最终传回的数据路由器也会按原路转发回请求的主机通过这样就可以把内网和外网联系起来。 </p><p>
这时候就会有一个问题那就是在这个过程中路由器和其他的电脑没有什么区别假如在广域网的机器想要访问局域网的机器那么正常来说就是直接访问那个路由器所在的IP就可以了但是内网并没有发请求给广域网路由器也不知道要把数据传给谁它就会把这个数据丢掉。 </p><p>
这个问题应该怎么解决?其实很简单,那就是连之前先由局域网的机器向想要访问这个机器的外网机器发送数据,这样外网机器就能顺理成章的连到内网的机器里面了,这确实是一个不错的解决方案,事实上现在几乎所有的内网穿透都是使用的这个方案。 </p><p>
除此之外还有一个叫做UPnP的协议貌似也可以穿透P2P应该都是用的这种方法不过需要路由器支持才行。这种协议好像可以自动进行端口映射大概是通过某种协议让路由器可以在内网机器没有主动发送数据的情况下把数据发送给内网机器吧具体我也不是很清楚。 </p><p>
另外如果有内网与外网相连的路由器的管理权限,也同样可以做到内网穿透,直接搞端口映射就完事,这种就更加简单了,但是一般情况下我们肯定没有路由器的管理权,不然也不至于这么苦恼了。</p>
<h1 id="一些实现的方案">
<a href="#一些实现的方案"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一些实现的方案
</h1>
<p>现在内网穿透的技术有很多,不过因为内网机器直接主动连外网这种方法比较简单,所以接下来说到的方法基本上都是通过这种方式的。</p>
<h2 id="利用vpn创建隧道">
<a href="#利用vpn创建隧道"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 利用VPN创建隧道
</h2>
<p>VPN的原理是通过由主机主动向VPN服务器连接隧道并通过虚拟一个路由器组成VLAN的一种技术通过这个介绍也能很明显看出来这是由主机主动发出的吧通过这种方式即使不在内网中也可以让内网的电脑连自己的VPN来连接内网的电脑以此再继续连到内网电脑所能连接的网络里面。 </p><p>
这种方法算是比较简单而且很安全的方式不过可惜中国的好多ISP都屏蔽VPN用这种方式不是很稳当。</p>
<h2 id="ssh隧道">
<a href="#ssh隧道"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> SSH隧道
</h2>
<p>SSH这个软件很强大有的功能也很多。既然VPN被屏蔽了那22端口总不至于屏蔽吧总不能把运维的饭都给抢了吧通过SSH隧道的方式使用起来也很简单在公网服务器上打开sshd的GatewayPorts功能内网设备通过执行类似于<code class="language-plaintext highlighter-rouge">ssh -fN -R 10022:localhost:22 远程用户@远程主机</code>这样的命令启动隧道,然后其他电脑就可以通过这个公网服务器连这个内网设备了。 </p><p>
这种方法很不错但是还是有一个问题那就是需要租服务器刚才的VPN同样需要所以可以还有更好的方案。</p>
<h2 id="某些服务商提供的frp">
<a href="#某些服务商提供的frp"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 某些服务商提供的frp
</h2>
<p>frp从名字上就能听出来它是一种代理吧这种东西目前有很多服务商都有提供比如SakuraFrp还有花生壳啥的当然如果手头有服务器也可以自己搭。这种的和前面几种不一样的是它反代出来的服务可以让其他用户直接用很方便不过有一个限制就是一台服务器最多只能反代出64551个服务不考虑tcp和udp的区别正常人都是够用了。</p>
<h2 id="端口映射">
<a href="#端口映射"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 端口映射
</h2>
<p>这是最好的方案,毕竟这样做可以保证不限速,而且也不需要外网服务器,但是路由器的管理权限很难搞,这确实没办法。</p>
<h1 id="后记">
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
</h1>
<p>所以最后我用了哪种方案呢既然端口映射最好那当然是用这个啦但是有一个问题是我没有路由器管理权怎么办呢没关系这个路由器以前有人做过端口映射只是现在没人用了而已于是我就跟着这个配置把服务器设置成和被映射主机一样的IP然后就可以用了。 </p><p>
另外就是运用资源的问题了这么多资源我自己用都想不出来干什么比较好所以我考虑要不然搞IDC总之在资源利用起来之前先让它们为世界做点贡献吧这些服务器算力确实猛在WCGrid里目前我的每日排名都能达到世界前200确实厉害。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F"><em>内网穿透</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-12-13-nat.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2020/12/13/nat.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2020/12/07/picore.html">
上一篇在树莓派上体验piCore
</a>
</span>
<br />
<span class="next">
<a href="/2021/01/04/summary.html">
下一篇:年终总结
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2020/12/13/nat', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2020/12/13/nat.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-02-04 10:55:07<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>