<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>葡萄树 On The Road</title>
	<atom:link href="http://www.am82.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.am82.com</link>
	<description>我的时光，停留在了你的角落...~</description>
	<lastBuildDate>Mon, 14 May 2012 11:37:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>程序员的常见健康问题</title>
		<link>http://www.am82.com/6216/</link>
		<comments>http://www.am82.com/6216/#comments</comments>
		<pubDate>Mon, 14 May 2012 11:33:27 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[挨踢消息]]></category>
		<category><![CDATA[健康]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6216</guid>
		<description><![CDATA[其实这些问题不仅见于程序员，其他长期经常坐在电脑前的职场人士（比如：网络编辑、站长等），都会有其中的某些健康问题。希望从事这些行业的朋友，对自己的健康问题，予以重视。以下是全文。

我最近在写《Learn Python The Hard Way》的最后几节课，我还要加一课：关于程序员在其职业生涯中普遍的健康问题。我发现诸多代码人在敲代码的时候好像不在乎他们的身体状况， 很可能是太过于全神贯注。我希望人们可以通过知晓一些与程序员相关的健康问题而获益，并可以避免曾经发生在我身上，而且就我知道也发生在很多人身上的问 题。

我可能不会把这篇博文全部放进该书里，因为........]]></description>
			<content:encoded><![CDATA[<p id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">转自：<a name="source" href="http://article.yeeyan.org/view/93116/124637" target="_blank"></a><a href="http://article.yeeyan.org/view/93116/124637">原文链接</a></p>
<p>原始出处： <a href="http://sheddingbikes.com/posts/1281257293.html" target="_blank">英文链接</a></p>
<p id="">其实这些问题不仅见于程序员，其他长期经常坐在电脑前的职场人士（比如：网络编辑、站长等），都会有其中的某些健康问题。希望从事这些行业的朋友，对自己的健康问题，予以重视。以下是全文。</p>
<p>我最近在写《Learn Python The Hard Way》的最后几节课，我还要加一课：关于程序员在其职业生涯中普遍的健康问题。我发现诸多代码人在敲代码的时候好像不在乎他们的身体状况， 很可能是太过于全神贯注。我希望人们可以通过知晓一些与程序员相关的健康问题而获益，并可以避免曾经发生在我身上，而且就我知道也发生在很多人身上的问 题。</p>
<p>我可能不会把这篇博文全部放进该书里，因为有点多。但我会写个缩减版。请您惠知喜好，或有我可以引用的附加资源。</p>
<h3><strong>我的背景和资历</strong></h3>
<p>我以前是一等合格美国士兵，并学习过多种武术。近年来我未像过去学武术一样奋力工作，而是专注于瑜伽、入定和一些简单的活动。我小时候是异常健康的，现在依然如故，这归功于我早已根深蒂固的锻炼习惯。</p>
<p>&nbsp;</p>
<p>首先先列一下我学过的武术：忍术（Ninjitsu），合气道（Aikido），柔术（Judo），泰拳（Muay Thai），咏春（Wing Tsung），卡波耶拉（Capoeira），阿尼斯（Arnis），其排序不分先后。我要讲只有泰拳我是连贯学习的，大概有六年时间。其他的用了一到两 年时间。我去了很多地方，因此学习之道就是那儿有什么便学什么。</p>
<p>而且，在部队里我是体能测试优秀，几乎是连续两年满分通过的。如没记错，这其中有几乎每天两至四小时的训练，这在部队里不算什么。除此之外，别无他事可做。</p>
<p>然后，不论我干不干活，我如今一直保持着同样的体重、灵敏及力量。所以我无法告诉你怎么减肥。我很可能先天基因就是如此。这意味着你要根据自身情况来调整我的建议。</p>
<p>有着前述的体魄，当我渐老我更喜欢侵略性弱以及更灵活的一些运动。瑜伽是不错的，常被误认为很难。我同样把票投给普拉提（Pilates），游泳，舞蹈等一切对我身体无直接影响的运动。我尤其注意我的手，缘由我也会说到。</p>
<p>好，写这么多是让你知道我还有点能耐，但是更重要的是，在干这些的同时，我是一个职业编程者。在退役后，我平均每天学习八到十六个小时。 我使用盲打而且玩吉他，我还避免了腕道综合征，以及重复性劳损问题。</p>
<p>希望我保健的经验能帮你恢复或保持健康。</p>
<h3><strong>程序员的常见健康问题</strong></h3>
<p>编程乍一看是个耗人的领域，一方面似乎你没有做很多，另外和很多代码人对待其身体的态度有关。 你要一贯地保持健康，因为身体好时会减少对精神的摩擦损害，而将注意力集中到要事上，而不是你生理上的小毛病。</p>
<p>显然建议就是大多人说的饮食，外出活动。我这里不会教你怎么吃或健身，或者哪种武术。如你对这些感兴趣，找一个职业的来帮助你锻炼。</p>
<p>这里要说的程序员们平日的职业病。他们相当明显而且平常，由于某些原因他们并不在意这些本不该发生的事情：</p>
<p>▲ 腕部疼痛（重复性劳损）</p>
<p>▲ 盯着看移动的打印进度以及其后的句点造成的眼部问题</p>
<p>▲ 姿势不当造成的背部不适，尤其是背下侧，肩上侧。</p>
<p>▲ 肠道和尿道的问题（不能正常大小便）</p>
<p>▲ 摄入太多咖啡因，而且喝水少造成的脱水</p>
<p>▲ 坐姿保持太久，造成男性的痔疮或前列腺问题（我一会再细说）</p>
<p>▲ 光照不足造成维生素D缺乏</p>
<p>▲ 熬夜或者喝咖啡过多导致的睡眠失调</p>
<p>▲ 缺乏伸展导致普遍的僵硬和疼痛</p>
<p>我一直跟这些问题作抗争，因为编程，弹吉他，或者举重时误伤。每当我重获健康的时候，我就知道了此后怎样避免。只有一小部分问题是周期性的。你可能觉得这里的某些问题无关紧要，但请相信我，许多程序员都有这样那样的问题，且原因不一，即使你还没有。</p>
<h3><strong>普遍原因</strong></h3>
<p>一般来说，可以总结成嗜编程为命。你可能想成为个中翘楚，就像我一样，因此除了生活除了编程别无其他。你不去卫生间，你勇猛地进行10小时连续编程。而且你饮食不规，只神笃“真正的代码人”这一信条。</p>
<p>事实是真正的编程者都是有点傻蛋。他们从来吃不到正点，ML也没有准。跑步从来都气喘吁吁，他们的内脏有一些严重问题，但不是疾病原因。真的，在你精通某件事之前，灭了自己可不是很值。</p>
<p>所以，在你看到这些问题以及我怎么解决的时候，记住这都是为了有一个均衡的生活习惯，而不是沉溺于编码或者其他什么事。相信我你会实实在在地好起来，如果你给你自己减负并且保持健康。</p>
<h3>腕部疼痛</h3>
<p>这个可能是我用心最多的。因为频繁且长时间地编码、拨弦，我的腕部有着周期性的疼痛。那年我22岁，刚开始职业性地编码。但是我一直有一个合气道的功课，这样我的腕部就会恢复如初。</p>
<p>你知道，合气道有着绝佳的腕部练习，从而让你的腕部变得结实又柔软。他们创造的这些练习可以避免伤害，原本的许多技巧就有扭、撕扯、手臂和肩关节的脱节。</p>
<p>这些练习治好了我的所有关节错位和疼痛，并让我长时间编程且没有任何大问题。我唯一可能出现问题是因为我要把现在的键盘换成新的古怪布局的键盘，但如果我练习一周合气道我就有可以重返代码并依然强健。</p>
<p>现在如果你有严重的腕道综合征或者其他类型的重复性劳损问题，先咨询你的医师再行尝试这里的技巧。如你要做的话，开始时要轻慢，不要让你感到疼。伸展应该不会疼，只会轻度有点不适。如果你感觉疼，是过度拉伸了。.</p>
<p>你实际想每次伸展运动得到放松。这有点难解释，但不是强迫你的关节在某个固定位置，而是先到达一个位置，想一想放松而后再到更远的位置。</p>
<p>记住这一点，怎么做练习则有很多视频：</p>
<p>▲ 翻转手腕 （Youtube的视频，须翻墙）</p>
<p>▲ 扭腕</p>
<p>▲ 手腕外侧弯曲</p>
<p>▲ 手腕内侧弯曲</p>
<p>下面介绍当你坐下来打字的时候怎么去做锻炼（每次都要这样）：</p>
<p>1. 首先要热身，将手伸向前方在空中尽可能快速地抓20次。然后甩手，再做手腕单侧弯曲10次，然后换方向弯曲10次。</p>
<p>2. 用你最擅长的，以中速做5至10次。</p>
<p>3. 继续做各项动作，但甩手和甩胳膊，弯曲手腕后到要归位。这些动作会移动手腕中的骨头，甩的时候它们就会归位。</p>
<p>4. 千万不要做过头，让你手腕感到损伤。要适度恰好，并放松。那个“没有付出就没有收获”只会伤害你。</p>
<p>每次敲代码前做这系列动作，每天要做，而且停下来的时候也做一次。用不了多长时间，一段时间的不适之后你的手腕就会开始适应并回到正常，并感到好许多。</p>
<p>还有：在做这些之前先咨询一下医生。你做这些可是自己冒风险，所以自己不小心搞坏了手腕不要来起诉我。 这些是千年武术中的家常便饭，所以我知道它们不会有危险，但各人情况不同。如果你做法不对可能后果严重，如果感到疼痛立即停止并咨询医师。</p>
<h3><strong>吉他手更糟糕</strong></h3>
<p>在吉他手或贝司手跟前，程序员的重复性劳损可是小菜。这起因是诸多愚蠢的理由，许多著名的音乐家讲一天八小时或十六小时学习法。正因如此，吉他手们糟践自己，最后不能演奏。</p>
<p>吉他对于手来讲是硬乐器，所以有一点点疼痛你就歇菜了。我在学校的时候，像个傻比一样轻信我的老师自己一天练八个小时的琴。我字面理解就是一下子就八个小时，我这样折磨自己一个月然后就崩了。</p>
<p>我的拇指有了赘骨，其他的指头疼痛难止。我的手腕还耐得住，但指头已经不行了。 二逼呵呵的我没有听那句话，任何新的运动需要循序渐进。</p>
<p>我解决这个的唯一办法，而且用了一年半，是做以下的事情：</p>
<p>1. 找把不伤手的吉他。说你啥样吉他都能玩是屁话。去找个最好的不伤你手的吉他。</p>
<p>2. 做上面的锻炼，我的指头做得更多。</p>
<p>3. 通过做练习，慢慢开始恢复指头的力度并注意放松。</p>
<p>4. 在弹的时候注意放松，拨弦的时候更轻巧。</p>
<p>5. 避免弯曲，这些曾导致我的手受伤。</p>
<p>6. 变换姿势和演奏风格，不抓紧吉他就能快速移动，舒服地把拇指压在琴颈背面。</p>
<p>7. 调整吉他高度，让我的肩和手都觉得舒服。</p>
<p>8. 站着，很少长时间坐下，长时间摆一个姿势是很别扭的。</p>
<p>去年做完这些后我的手最终痊愈了，并且感觉良好。我还没有不让我弄伤自己的好习惯。我已经老大不小了，所以这些对我很重要，但这也意味着我不能做那些可能弄伤我手的活计。</p>
<p>我的手现在是我的命根子，所以不能再打拳了，或者其他我还想学习的事情。因为打沙袋我手上已经有多处凹陷了。</p>
<h3><strong>眼疲劳</strong></h3>
<p>我觉得这对我不是问题，但你最好悠着点。我年轻的时候比20/20还要好，但用了几十年电脑有点偏了，曾经用过眼镜矫正，我用得着的时候一直戴着，没有它们看周围的世界真是恼人的模糊。</p>
<p>在黑暗时期，我们天天还瞅的是CRT显示器，烦人的闪烁已经把一些人的眼睛整垮了。现在的问题是多数LCD屏幕对字体的糟糕渲染。 我想归功于苹果公司的专利，多数LCD屏都不能正常渲染字体。尽管有人认为苹果的字体看起来毛茸茸的，所以对于你的好处将很难说。</p>
<p>我想每天两个小时不看电脑。要么我去玩吉他不用费眼力，要么去公园散步。我可能不是整整两个小时都去这样干，但是加起来要保持两个小时。</p>
<p>这对于你可能有的头痛有助益。多数时候程序员可能会想玩电脑的时候开着灯导致了头痛，但其实是因为体位不对，还有糟糕的字体，饮水不足，而且是跟电脑打持久战。</p>
<p>不是把你房间的灯都关掉，只需要合理的照明，选择适合你液晶屏和室内灯光的色彩方案。 即融合室内照明，液晶屏亮度和字体，以及让你感觉更舒服的色彩方案。</p>
<p>但还是先休息一下吧。</p>
<h3><strong>背部问题</strong></h3>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>我挺走运的，背一直还可以。尽管如此，我相当多时间是坐办公室，并保持着灵活强健的脊背。</p>
<p>我的问题是背的上半部分，脖子，肩部。我习惯猫在键盘上，所以必须强迫自己坐直。事实是，刚刚敲这段话的时候我就没坐直，才想起矫正一下。</p>
<p>现在选择你的座椅很重要，我喜欢艾伦椅（Aeron），那种硬质小凳子或长凳。现在非常热衷我的40美元的钢琴凳，过去我坐着它弹钢琴的。因为没有后背，凳子会时时逼迫你坐端正 ，并调用我的核心肌肉（肚子和背部）。</p>
<p>我的肩部完全处于压/迫状态。我习惯于在我全神贯注的时候收紧双肩，这样让我的整个背上部感到疼痛，一直蔓延到脖子和头部。当我长时间玩吉他的时候问题更糟。</p>
<p>我发现最有效的解决办法是伸展上肢，做俯卧撑。伸展办法很简单，抓住门框，然后双臂同向或反向拉伸。你觉得身体有点僵硬的时候试试下面这些招数：</p>
<p>1. 用一只手抓紧门框，手心朝向你的身体，然后向前挺胸，越过肩位。</p>
<p>2. 用另一只手握紧门框，胳膊交叉在前，手心继续朝里，然后伸展肩部，使背部得到伸展。</p>
<p>3. 两只手都抓住门框，高举过头，稍向后站呈倾斜，然后来回拉伸。（就像站着做俯卧撑）</p>
<p>如果你做了，同时做抡臂，摇摆，你就会觉得好一些。或许在你开始干活之前加一些腕部伸展。</p>
<p>另外就是做真正的俯卧撑了。我工作的时候并不做这个，因为它会让你很累，难于工作。在睡前我做十次，这十下足以对付胸、背、肩、腕。 不要过快，要慢，注意在做的时候使身体平衡。</p>
<h3><strong>脱水</strong></h3>
<p>这个问题不大，我时常有点内疚。我发现我一天狂喝咖啡，正因为这样我想我也该喝点水。如果我没有头疼那倒有点不对。脱水的问题很难发觉，直到你发现的时候已经晚了。</p>
<p>我的建议（我也要多做的）是，喝其他非纯净水的饮料时也喝一杯水。同样请勿喝苏打水。它们只是一堆伪糖，让你变胖导致糖尿病，还有它并没有给你产生水。喝纯黑咖啡吧，它们真他妈好，记着再喝些水。</p>
<h3><strong>肠道及尿道问题</strong></h3>
<p>好吧，接下来的两个问题确实不雅，所以就不提发生在我身上的事了，但我要说这句话：“<strong>上厕所的时候他妈赶紧去，别犹豫。</strong>”</p>
<p>你不知道这条提示有多有用，我真希望我年轻的时候知道这句话。因为我是一个拼命汉从不间断，跳过上厕所，憋相当长时间。 肠道问题就是你的机体不再告诉你你该拉屎了，只是愈积愈多。</p>
<p>这样的话最后会导致便秘，这将终结你的健康状态。对于尿道倒次要，但是你依然可能会有感染和其他令你惊奇的事情。</p>
<p>如果你已经搞砸了，你去弄一些纤维片，待在家里然后吃掉，不要去外面，因为后果很囧的。</p>
<p>然后，你觉得是时候了，拾起身去拥抱上帝吧。我告诉你，在你拉完屎之后你的伟大想法才会自然迸发。</p>
<h3><strong>痔疮和前列腺问题</strong></h3>
<p>另外一个不上厕所会导致的就是痔疮。我知道够恶心的，我保证只提这一次。但是，许多编程者有这个问题，并羞于启齿，他们并不知道为什么。下面听我一一道来，我做过下述所有事情，但是只得过一两次痔疮：</p>
<p>1. 长时间坐着。</p>
<p>2. 举重东西，不用辅助。</p>
<p>3. 该去解决内急的时候不去。</p>
<p>4. 强迫自己去拉屎，实际上不需要。</p>
<p>5. 最糟糕的：坐在厕所里看书。</p>
<p>最后一条就是罪魁祸首。如果你不是必须要大C，可别老泡在那。这相当于将你整个身体和肠子的重量压进已经泻完的直肠上，并试图挤出来。恶心至极！这导致痔疮因为你的血管中的血压不自然地升高。</p>
<p>确实臭哄哄的，但潜在危害很大。恩，危急情形是血流一地，这时候谁都知道去看大夫。你可能需要手术，但做无妨。我没有做但也差点：有一年我在举重，然后在库房工作，不间断编程，没有用过厕所。</p>
<p>是，我是个大笨蛋。你可别学我。为了你的屁屁的健康，请做以下的事：</p>
<p>1. 多吃果蔬，至少吃点纤维片。</p>
<p>2. 该解决个人问题时赶紧的！</p>
<p>3. 任何情况下不要压/迫直肠。</p>
<p>还有一个导致前列腺的问题，如果整天坐在屁股上的话。站起来转转就可以。如果尿血或者排尿困难，去看医生，否则会更危险。</p>
<h3><strong>维生素D不足</strong></h3>
<p>维生素D有点怪。的确只能通过晒太阳产生，但你并不必去专门为此去暴露在阳光下。5到30分钟就好，取决于光照的强度。还与你的钙水平和磷缺乏程度有关。但你要是饮食规律，并非只吃些薯片的话，就问题不大。</p>
<p>还有一些事比如消沉，搞坏的牙齿，一些奇怪部位的疼痛比如臂肘的骨头，肌肉痉挛，总体来讲就是跟烂泥一样。同样，如果你觉得不行的话去看医生，正常情况下在日头正盛的时候，去外面溜达半个小时足矣。</p>
<p>事实上，我觉得一个问题是硅谷里很多刚起步公司提供的餐饮。因为你要泡在办公室，经常吃残汤剩饭，而且照明也不好，太阳高照的时候你也不出去晒下。加上你的睡眠习惯你的维生素D状况就糟糕透了。</p>
<p>不要吃盒饭，在中午去外面吃一顿。好处你自知，而且外面的食物好多了。</p>
<p>我在温哥华和西雅图的时候有轻微的维生素D缺乏，那儿光照不足，对于我来说简直要我命。有人能搞定，但是像我这样青年时代在热带岛屿上度过的人，不足的光照确实就是杀手。</p>
<p>所以，你趁有太阳的时候出去晒晒。</p>
<h3><strong>睡眠失调</strong></h3>
<p>我的睡眠时间一向很灵活，跟季节和地域有关。有时候我如猫头鹰附体，熬夜熬到很晚才睡。最近搬到旧金山后开始早睡，不再晚睡了，最近感觉很好。</p>
<p>有时候，我不确定为何在夜里创作音乐或编程倒多产。我认为在一个疲惫的状态下我的大脑确是在休息的。我还觉得是因为夜里更安静，没有滋扰。</p>
<p>不管怎样，早睡晚睡已经把我的睡眠机制搞砸了。当我渐长我更喜欢早起，我觉得白天更清醒更放松。熬夜后再睡往往觉得自己有遗留反应，而且头疼。</p>
<p>如果你也有睡眠问题，我有一些简单的调适方法助你入睡。需要实践，但很有效。</p>
<p>首先，花你的血本买个好床，2000+美元不算多。我买了2200块的Tempur-Pedic。 的确很值。</p>
<p>有了床，开始练习助睡法，有点自我催眠的意味：</p>
<p>1. 关掉你房内的所有灯光和音响。</p>
<p>2. 躺下，让手放在让你舒服的位置。</p>
<p>3. 缓慢地深呼吸，并想象空气流进身体及逸散出体外的场景。</p>
<p>4. 当你能注意到你的呼吸之时，想象你在看窗外辽阔的太空，悬星满布。</p>
<p>5. 然后伴随呼吸幻想自己漂浮在空中，渐入巨幅的星系，一切星辰，皆伴随你左右。</p>
<p>6. 持续幻想，感觉你的床也在漂浮，直到皆不见。</p>
<p>你或许在四五点睡觉，但不是要出去的话，就幻想自己漂浮直到你真感觉融化了。</p>
<p>如果你有重度失眠，还请咨询医师。但还是试下这招，一天做一到两个小时。练习后绝对会让你入睡。</p>
<h3><strong>刚柔并济</strong></h3>
<p>如果浑身不适难于活动，这时就该做下伸展运动。当然最好莫过于去瑜伽馆每周做练习，并回家自己练习。如果没有时间，可以买书或在图书馆借N多教程。入门级就可以，你真的不需要太多。</p>
<p>我想如果你晚上入睡前做5-6个大幅的伸展练习就够了。你会觉得相当放松，你的健康状况和自我感觉也会有提升。</p>
<p>伸展身体的时候同样要放松大脑，增长创造性的一大妙法就是做瑜伽或半个小时的伸展运动，然后早晨冲澡。 伴随禅定你就会精神自适并发觉个中未曾体验之奥妙。</p>
<p>我也不知为何，但是精神之松弛对于突发的灵感多有助益。</p>
<h3><strong>迈出第一步</strong></h3>
<p>上面的内容可能对于你有点多，我当然希望你不会都有这些问题缠身。然而我建议，尽管你可能没有那些毛病，但要避免它们的发生。如果你要开始编码，请采用“编前热身”。</p>
<p>下面就是我在敲代码前要干的，或者玩吉他前，以及我变僵需要休息的时候。</p>
<p>1. 活动身体各关节，只需将腕、臂、颈、臀转摇几下。比如正向五次，然后反向五次。</p>
<p>2. 在各部分前做一些腕部练习，摇一下手腕。</p>
<p>3. 将臂举过头顶尽可能高，然后向后伸展尽可能远，然后伸到身体前面来。</p>
<p>4. 最后，小心地用手扶着头分别向右、左、前、后摇几下。</p>
<p>如果你做这些的话，将避免一些编程会带来的伤害。因为编程并不会大伤体能，避免受伤还是很容易的，因此上述部分就够了。</p>
<p>然而，如果有特殊问题的话，继续去咨询医疗师，如果得到他们允许可以试试我的这些方法。我这儿说的无过激或奇异的方法，只是些基本的练习和一些常识，因此是个医生都会许可的。我告诉你要咨询别人是只是因为我不想吃官司。</p>
<p>真希望这些能让你变好，如果没有的话，记下建议，以防出现这些状况。如果你够好运，连一个问题都不会有，但我觉得是个程序员都有或多或少的问题。</p>
<p>如果对上述的事情持有疑问，可以给我发邮件，我会给你一些建议。</p>
<p>保重。</p>
<p><strong>作者Zed Shaws</strong>是一位作家、软件开发人员、音乐人（下文中提到吉他手），于2010年发布《Learn Python The Hard Way》一书，他也是 Mongrel Web 服务器系统的作者之一。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6216/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>第二梦</title>
		<link>http://www.am82.com/6213/</link>
		<comments>http://www.am82.com/6213/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 14:05:58 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[三八纯情]]></category>
		<category><![CDATA[第二梦]]></category>
		<category><![CDATA[苍井空]]></category>
		<category><![CDATA[视频]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6213</guid>
		<description><![CDATA[再说一次，这才是实实在在的德艺双馨.........]]></description>
			<content:encoded><![CDATA[<p>再说一次，这才是实实在在的德艺双馨&#8230;&#8230;&#8230;</p>
<p><embed src="http://www.tudou.com/v/ql6w2dq9H04/&#038;resourceId=0_05_02_99&#038;autoPlay=true/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6213/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>曾轶可-勇敢一点(钢琴live版)</title>
		<link>http://www.am82.com/6211/</link>
		<comments>http://www.am82.com/6211/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 15:49:51 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[胡思乱想]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6211</guid>
		<description><![CDATA[勇敢一点.......]]></description>
			<content:encoded><![CDATA[<p><embed src="http://www.tudou.com/v/k83QZdkeE0Y/&#038;resourceId=0_05_05_aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6211/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>从openssh函数看ssh连接建立过程【zZ】</title>
		<link>http://www.am82.com/6207/</link>
		<comments>http://www.am82.com/6207/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 08:12:56 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[技术专题]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6207</guid>
		<description><![CDATA[如果咱去面试的时候，别人问咱：请描述你通过ssh登陆linux系统的过程。这个问题挺不错的，可以从回答的内容看出来面试者对网络，系统，加密的熟悉程度，想问深一些可以加上一句“窃取ssh1协议登陆密码的方式叫什么？在上述哪个过程实现的？”。我记得http://shallwe.net说过他刚毕业去谷歌面试，其中一个题目就是：请描述你访问谷歌网站的过程。水平如何一试见高低。

这个咱心里有谱吗？看了ncrack出品的这个文章就可以很好很深入的回答这个问题，要喷起来，可以喷个15分钟吧。当然了，纯粹从网络和应用逻辑交互过程来描述（具体见 oreilly ssh the secure shell一书），也是一个让人满意的答案，但如果从代码层喷，能让人另眼相看了，说不定被认为是一个code hacker。另外........]]></description>
			<content:encoded><![CDATA[<p id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">from：<a href="http://baoz.net/%E4%BB%8Eopenssh%E5%87%BD%E6%95%B0%E7%9C%8Bssh%E8%BF%9E%E6%8E%A5%E5%BB%BA%E7%AB%8B%E8%BF%87%E7%A8%8B/">http://baoz.net/%E4%BB%8Eopenssh%E5%87%BD%E6%95%B0%E7%9C%8Bssh%E8%BF%9E%E6%8E%A5%E5%BB%BA%E7%AB%8B%E8%BF%87%E7%A8%8B/</a></p>
<p>如果咱去面试的时候，别人问咱：请描述你通过ssh登陆linux系统的过程。这个问题挺不错的，可以从回答的内容看出来面试者对网络，系统，加密的熟悉程度，想问深一些可以加上一句“窃取ssh1协议登陆密码的方式叫什么？在上述哪个过程实现的？”。我记得http://shallwe.net说过他刚毕业去谷歌面试，其中一个题目就是：请描述你访问谷歌网站的过程。水平如何一试见高低。</p>
<p id="">这个咱心里有谱吗？看了ncrack出品的这个文章就可以很好很深入的回答这个问题，要喷起来，可以喷个15分钟吧。当然了，纯粹从网络和应用逻辑交互过程来描述（具体见 oreilly ssh the secure shell一书），也是一个让人满意的答案，但如果从代码层喷，能让人另眼相看了，说不定被认为是一个code hacker。另外说下，ncrack是一个非常优秀的远程密码审计工具，有兴趣的请自行围观 http://nmap.org/ncrack/ 不要用它做坏事啊。</p>
<p>&nbsp;</p>
<p>原文在 http://sock-raw.org/papers/openssh_library，如果不想了解ssh破解，看第2部分即可。</p>
<div id="crayon-4f7ff0eb852de" data-settings=" scroll-mouseover">
<div><span style="font-family: monospace;"><span style="line-height: normal; white-space: pre-wrap;"><br />
</span></span></div>
<div>
<table>
<tbody>
<tr>
<td data-settings="hide">
<div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
<div>27</div>
<div>28</div>
<div>29</div>
<div>30</div>
<div>31</div>
<div>32</div>
<div>33</div>
<div>34</div>
<div>35</div>
<div>36</div>
<div>37</div>
<div>38</div>
<div>39</div>
<div>40</div>
<div>41</div>
<div>42</div>
<div>43</div>
<div>44</div>
<div>45</div>
<div>46</div>
<div>47</div>
<div>48</div>
<div>49</div>
<div>50</div>
<div>51</div>
<div>52</div>
<div>53</div>
<div>54</div>
<div>55</div>
<div>56</div>
<div>57</div>
<div>58</div>
<div>59</div>
<div>60</div>
<div>61</div>
<div>62</div>
<div>63</div>
<div>64</div>
<div>65</div>
<div>66</div>
<div>67</div>
<div>68</div>
<div>69</div>
<div>70</div>
<div>71</div>
<div>72</div>
<div>73</div>
<div>74</div>
<div>75</div>
<div>76</div>
<div>77</div>
<div>78</div>
<div>79</div>
<div>80</div>
<div>81</div>
<div>82</div>
<div>83</div>
<div>84</div>
<div>85</div>
<div>86</div>
<div>87</div>
<div>88</div>
<div>89</div>
<div>90</div>
<div>91</div>
<div>92</div>
<div>93</div>
<div>94</div>
<div>95</div>
<div>96</div>
<div>97</div>
<div>98</div>
<div>99</div>
<div>100</div>
<div>101</div>
<div>102</div>
<div>103</div>
<div>104</div>
<div>105</div>
<div>106</div>
<div>107</div>
<div>108</div>
<div>109</div>
<div>110</div>
<div>111</div>
<div>112</div>
<div>113</div>
<div>114</div>
<div>115</div>
<div>116</div>
<div>117</div>
<div>118</div>
<div>119</div>
<div>120</div>
<div>121</div>
<div>122</div>
<div>123</div>
<div>124</div>
<div>125</div>
<div>126</div>
<div>127</div>
<div>128</div>
<div>129</div>
<div>130</div>
<div>131</div>
<div>132</div>
<div>133</div>
<div>134</div>
<div>135</div>
<div>136</div>
<div>137</div>
<div>138</div>
<div>139</div>
<div>140</div>
<div>141</div>
<div>142</div>
<div>143</div>
<div>144</div>
<div>145</div>
<div>146</div>
<div>147</div>
<div>148</div>
<div>149</div>
<div>150</div>
<div>151</div>
<div>152</div>
<div>153</div>
<div>154</div>
<div>155</div>
<div>156</div>
<div>157</div>
<div>158</div>
<div>159</div>
<div>160</div>
<div>161</div>
<div>162</div>
<div>163</div>
<div>164</div>
<div>165</div>
<div>166</div>
<div>167</div>
<div>168</div>
<div>169</div>
<div>170</div>
<div>171</div>
<div>172</div>
<div>173</div>
<div>174</div>
<div>175</div>
<div>176</div>
<div>177</div>
<div>178</div>
<div>179</div>
<div>180</div>
<div>181</div>
<div>182</div>
<div>183</div>
<div>184</div>
<div>185</div>
<div>186</div>
<div>187</div>
<div>188</div>
<div>189</div>
<div>190</div>
<div>191</div>
<div>192</div>
<div>193</div>
<div>194</div>
<div>195</div>
<div>196</div>
<div>197</div>
<div>198</div>
<div>199</div>
<div>200</div>
<div>201</div>
<div>202</div>
<div>203</div>
<div>204</div>
<div>205</div>
<div>206</div>
<div>207</div>
<div>208</div>
<div>209</div>
<div>210</div>
<div>211</div>
<div>212</div>
<div>213</div>
<div>214</div>
<div>215</div>
<div>216</div>
<div>217</div>
<div>218</div>
<div>219</div>
<div>220</div>
<div>221</div>
<div>222</div>
<div>223</div>
<div>224</div>
<div>225</div>
<div>226</div>
<div>227</div>
<div>228</div>
<div>229</div>
<div>230</div>
<div>231</div>
<div>232</div>
<div>233</div>
<div>234</div>
<div>235</div>
<div>236</div>
<div>237</div>
<div>238</div>
<div>239</div>
<div>240</div>
<div>241</div>
<div>242</div>
<div>243</div>
<div>244</div>
<div>245</div>
<div>246</div>
<div>247</div>
<div>248</div>
<div>249</div>
<div>250</div>
<div>251</div>
<div>252</div>
<div>253</div>
<div>254</div>
<div>255</div>
<div>256</div>
<div>257</div>
<div>258</div>
<div>259</div>
<div>260</div>
<div>261</div>
<div>262</div>
<div>263</div>
<div>264</div>
<div>265</div>
<div>266</div>
<div>267</div>
<div>268</div>
<div>269</div>
<div>270</div>
<div>271</div>
<div>272</div>
<div>273</div>
<div>274</div>
<div>275</div>
<div>276</div>
<div>277</div>
<div>278</div>
<div>279</div>
<div>280</div>
<div>281</div>
<div>282</div>
<div>283</div>
<div>284</div>
<div>285</div>
<div>286</div>
<div>287</div>
<div>288</div>
<div>289</div>
<div>290</div>
<div>291</div>
<div>292</div>
<div>293</div>
<div>294</div>
<div>295</div>
<div>296</div>
<div>297</div>
<div>298</div>
<div>299</div>
<div>300</div>
<div>301</div>
<div>302</div>
<div>303</div>
<div>304</div>
<div>305</div>
<div>306</div>
<div>307</div>
<div>308</div>
<div>309</div>
<div>310</div>
<div>311</div>
<div>312</div>
<div>313</div>
<div>314</div>
<div>315</div>
<div>316</div>
<div>317</div>
<div>318</div>
<div>319</div>
<div>320</div>
<div>321</div>
<div>322</div>
<div>323</div>
<div>324</div>
<div>325</div>
<div>326</div>
<div>327</div>
<div>328</div>
<div>329</div>
<div>330</div>
<div>331</div>
<div>332</div>
<div>333</div>
<div>334</div>
<div>335</div>
<div>336</div>
<div>337</div>
<div>338</div>
<div>339</div>
<div>340</div>
<div>341</div>
<div>342</div>
<div>343</div>
<div>344</div>
<div>345</div>
<div>346</div>
<div>347</div>
<div>348</div>
<div>349</div>
<div>350</div>
<div>351</div>
<div>352</div>
<div>353</div>
<div>354</div>
<div>355</div>
<div>356</div>
<div>357</div>
<div>358</div>
<div>359</div>
<div>360</div>
<div>361</div>
<div>362</div>
<div>363</div>
<div>364</div>
<div>365</div>
<div>366</div>
<div>367</div>
<div>368</div>
<div>369</div>
<div>370</div>
<div>371</div>
<div>372</div>
<div>373</div>
<div>374</div>
<div>375</div>
<div>376</div>
<div>377</div>
<div>378</div>
<div>379</div>
<div>380</div>
<div>381</div>
<div>382</div>
<div>383</div>
<div>384</div>
<div>385</div>
<div>386</div>
<div>387</div>
<div>388</div>
<div>389</div>
<div>390</div>
<div>391</div>
<div>392</div>
<div>393</div>
<div>394</div>
<div>395</div>
<div>396</div>
<div>397</div>
<div>398</div>
<div>399</div>
<div>400</div>
<div>401</div>
<div>402</div>
<div>403</div>
<div>404</div>
<div>405</div>
<div>406</div>
<div>407</div>
<div>408</div>
<div>409</div>
<div>410</div>
<div>411</div>
<div>412</div>
<div>413</div>
<div>414</div>
<div>415</div>
<div>416</div>
<div>417</div>
<div>418</div>
<div>419</div>
<div>420</div>
<div>421</div>
<div>422</div>
<div>423</div>
<div>424</div>
<div>425</div>
<div>426</div>
<div>427</div>
<div>428</div>
<div>429</div>
<div>430</div>
<div>431</div>
<div>432</div>
<div>433</div>
<div>434</div>
<div>435</div>
<div>436</div>
<div>437</div>
<div>438</div>
<div>439</div>
<div>440</div>
<div>441</div>
<div>442</div>
<div>443</div>
<div>444</div>
<div>445</div>
<div>446</div>
<div>447</div>
<div>448</div>
<div>449</div>
<div>450</div>
<div>451</div>
<div>452</div>
<div>453</div>
<div>454</div>
<div>455</div>
<div>456</div>
<div>457</div>
<div>458</div>
<div>459</div>
<div>460</div>
<div>461</div>
<div>462</div>
<div>463</div>
<div>464</div>
<div>465</div>
<div>466</div>
<div>467</div>
<div>468</div>
<div>469</div>
<div>470</div>
<div>471</div>
<div>472</div>
<div>473</div>
<div>474</div>
<div>475</div>
<div>476</div>
<div>477</div>
<div>478</div>
<div>479</div>
<div>480</div>
<div>481</div>
<div>482</div>
<div>483</div>
<div>484</div>
<div>485</div>
<div>486</div>
<div>487</div>
<div>488</div>
<div>489</div>
<div>490</div>
<div>491</div>
<div>492</div>
<div>493</div>
<div>494</div>
<div>495</div>
<div>496</div>
<div>497</div>
<div>498</div>
<div>499</div>
<div>500</div>
<div>501</div>
<div>502</div>
<div>503</div>
<div>504</div>
<div>505</div>
<div>506</div>
<div>507</div>
<div>508</div>
<div>509</div>
<div>510</div>
<div>511</div>
<div>512</div>
<div>513</div>
<div>514</div>
<div>515</div>
<div>516</div>
<div>517</div>
<div>518</div>
<div>519</div>
<div>520</div>
<div>521</div>
<div>522</div>
<div>523</div>
<div>524</div>
<div>525</div>
<div>526</div>
<div>527</div>
<div>528</div>
<div>529</div>
<div>530</div>
<div>531</div>
<div>532</div>
<div>533</div>
<div>534</div>
<div>535</div>
<div>536</div>
<div>537</div>
<div>538</div>
<div>539</div>
<div>540</div>
<div>541</div>
<div>542</div>
<div>543</div>
<div>544</div>
<div>545</div>
<div>546</div>
<div>547</div>
<div>548</div>
<div>549</div>
<div>550</div>
<div>551</div>
<div>552</div>
<div>553</div>
<div>554</div>
<div>555</div>
<div>556</div>
<div>557</div>
<div>558</div>
<div>559</div>
<div>560</div>
<div>561</div>
<div>562</div>
<div>563</div>
<div>564</div>
<div>565</div>
<div>566</div>
<div>567</div>
<div>568</div>
<div>569</div>
<div>570</div>
<div>571</div>
<div>572</div>
<div>573</div>
<div>574</div>
<div>575</div>
<div>576</div>
<div>577</div>
<div>578</div>
<div>579</div>
<div>580</div>
<div>581</div>
<div>582</div>
<div>583</div>
<div>584</div>
<div>585</div>
<div>586</div>
<div>587</div>
<div>588</div>
<div>589</div>
<div>590</div>
<div>591</div>
<div>592</div>
<div>593</div>
<div>594</div>
<div>595</div>
<div>596</div>
<div>597</div>
<div>598</div>
<div>599</div>
<div>600</div>
<div>601</div>
<div>602</div>
<div>603</div>
<div>604</div>
<div>605</div>
<div>606</div>
<div>607</div>
<div>608</div>
<div>609</div>
<div>610</div>
<div>611</div>
<div>612</div>
<div>613</div>
<div>614</div>
<div>615</div>
<div>616</div>
</div>
</td>
<td>
<div>
<div id="crayon-4f7ff0eb852de-1">&#8212;- [ Hacking the OpenSSH library for Ncrack ] &#8212;-</div>
<div id="crayon-4f7ff0eb852de-2"></div>
<div id="crayon-4f7ff0eb852de-3">by ithilgore &#8211; ithilgore.ryu.l@gmail.com</div>
<div id="crayon-4f7ff0eb852de-4">sock-raw.org</div>
<div id="crayon-4f7ff0eb852de-5"></div>
<div id="crayon-4f7ff0eb852de-6">30 July, 2009</div>
<div id="crayon-4f7ff0eb852de-7">Version: 1.0</div>
<div id="crayon-4f7ff0eb852de-8"></div>
<div id="crayon-4f7ff0eb852de-9">&#8212;[ Contents</div>
<div id="crayon-4f7ff0eb852de-10"></div>
<div id="crayon-4f7ff0eb852de-11">1 - Introduction</div>
<div id="crayon-4f7ff0eb852de-12"></div>
<div id="crayon-4f7ff0eb852de-13">2 - OpenSSH overview</div>
<div id="crayon-4f7ff0eb852de-14">2.1 - Initialization and Identification Exchange</div>
<div id="crayon-4f7ff0eb852de-15">2.2 - Algorithm negotiation</div>
<div id="crayon-4f7ff0eb852de-16">2.3 - Diffie-Hellman Key Exchange</div>
<div id="crayon-4f7ff0eb852de-17">2.4 - User Authentication</div>
<div id="crayon-4f7ff0eb852de-18">2.5 - Packet handling</div>
<div id="crayon-4f7ff0eb852de-19"></div>
<div id="crayon-4f7ff0eb852de-20">3 - Ncrack OpenSSH library</div>
<div id="crayon-4f7ff0eb852de-21">3.1 - One Struct Fits All</div>
<div id="crayon-4f7ff0eb852de-22">3.2 - Main Changes Outlined</div>
<div id="crayon-4f7ff0eb852de-23"></div>
<div id="crayon-4f7ff0eb852de-24">4 - SSH bruteforcing</div>
<div id="crayon-4f7ff0eb852de-25"></div>
<div id="crayon-4f7ff0eb852de-26">5 - Conclusion</div>
<div id="crayon-4f7ff0eb852de-27"></div>
<div id="crayon-4f7ff0eb852de-28">6 - References</div>
<div id="crayon-4f7ff0eb852de-29"></div>
<div id="crayon-4f7ff0eb852de-30">1. Introduction</div>
<div id="crayon-4f7ff0eb852de-31">================</div>
<div id="crayon-4f7ff0eb852de-32"></div>
<div id="crayon-4f7ff0eb852de-33">The purpose of this document is to outline the process of building a SSH</div>
<div id="crayon-4f7ff0eb852de-34">library leveraged by the corresponding module of Ncrack. The code used</div>
<div id="crayon-4f7ff0eb852de-35">is largely based on the latest version of OpenSSH (currently 5.2) which</div>
<div id="crayon-4f7ff0eb852de-36">makes it more secure and flexible, being audited by the OpenBSD team and</div>
<div id="crayon-4f7ff0eb852de-37">being able to handle and adapt to many different implementations of SSH</div>
<div id="crayon-4f7ff0eb852de-38">out there. First we are going to give a brief overview of the OpenSSH</div>
<div id="crayon-4f7ff0eb852de-39">code mainly focusing on everything related to the authentication phase,</div>
<div id="crayon-4f7ff0eb852de-40">since that is what concerns us most. Then we are going to mention what</div>
<div id="crayon-4f7ff0eb852de-41">different hacks were made in order to convert that code into a library</div>
<div id="crayon-4f7ff0eb852de-42">suitable for use by Ncrack's architecture. Finally, we are going to discuss</div>
<div id="crayon-4f7ff0eb852de-43">some issues concerning SSH bruteforcing.</div>
<div id="crayon-4f7ff0eb852de-44"></div>
<div id="crayon-4f7ff0eb852de-45">2. OpenSSH overview</div>
<div id="crayon-4f7ff0eb852de-46">====================</div>
<div id="crayon-4f7ff0eb852de-47"></div>
<div id="crayon-4f7ff0eb852de-48">The OpenSSH package bundles together code for both the client-side and the</div>
<div id="crayon-4f7ff0eb852de-49">server-side of SSH, as many C files are generic enough to be able to handle</div>
<div id="crayon-4f7ff0eb852de-50">both situations. It also contains an internal library but that has no</div>
<div id="crayon-4f7ff0eb852de-51">relation with the library that was built for Ncrack as it is too restricted</div>
<div id="crayon-4f7ff0eb852de-52">and suitable only for the needs of OpenSSH itself. Since, Ncrack's SSH</div>
<div id="crayon-4f7ff0eb852de-53">module only needs to test the authentication credentials for a target</div>
<div id="crayon-4f7ff0eb852de-54">server, we are going to concentrate our analysis on the client part of</div>
<div id="crayon-4f7ff0eb852de-55">OpenSSH and only for the subsystem of authentication. The SSH protocol is a</div>
<div id="crayon-4f7ff0eb852de-56">very complex one, being outlined in about 12 RFCs [0] and thus for clarity</div>
<div id="crayon-4f7ff0eb852de-57">reasons we are going to point out the important details and intricacies of</div>
<div id="crayon-4f7ff0eb852de-58">it as we go through the OpenSSH client code. Keep in mind, that only SSH</div>
<div id="crayon-4f7ff0eb852de-59">version 2 will be studied. The reader is also advised to take a look</div>
<div id="crayon-4f7ff0eb852de-60">specifically at RFC 4253 [1], since that covers a great deal of what we are</div>
<div id="crayon-4f7ff0eb852de-61">going to see in the following sections.</div>
<div id="crayon-4f7ff0eb852de-62"></div>
<div id="crayon-4f7ff0eb852de-63">&#8212;- [ 2.1 Initialization and Identification Exchange</div>
<div id="crayon-4f7ff0eb852de-64"></div>
<div id="crayon-4f7ff0eb852de-65">The client begins from the ssh.c file calling ssh_login() function after a</div>
<div id="crayon-4f7ff0eb852de-66">connection has been established through ssh_connect(). ssh_login(), which</div>
<div id="crayon-4f7ff0eb852de-67">resides at sshconnect.c, starts a dialogue with the server and tries to</div>
<div id="crayon-4f7ff0eb852de-68">authenticate the user following the SSH procotocol specification. It does</div>
<div id="crayon-4f7ff0eb852de-69">that by first exchanging version identification strings through</div>
<div id="crayon-4f7ff0eb852de-70">ssh_exchange_identification() which is defined in the same file. This</div>
<div id="crayon-4f7ff0eb852de-71">function is responsible for reading the opposite side's identification</div>
<div id="crayon-4f7ff0eb852de-72">string, which is something along the lines of "SSH-2.0-OpenSSH_5.2\n", as</div>
<div id="crayon-4f7ff0eb852de-73">well as sending the client's own identification string with the same</div>
<div id="crayon-4f7ff0eb852de-74">format. This is actually more important than it seems, since these version</div>
<div id="crayon-4f7ff0eb852de-75">numbers are extracted by OpenSSH and further processed in order to find</div>
<div id="crayon-4f7ff0eb852de-76">possible misbehaviours that were caused by bugs in certain older</div>
<div id="crayon-4f7ff0eb852de-77">implementations. This is done by compat_datafellows() at compat.c which</div>
<div id="crayon-4f7ff0eb852de-78">makes OpenSSH adapt its own behaviour to account for these bugs. This</div>
<div id="crayon-4f7ff0eb852de-79">provides perfect backwards compatibility and flexibility for almost every</div>
<div id="crayon-4f7ff0eb852de-80">server out there. Note that protocol version exchange is part of the</div>
<div id="crayon-4f7ff0eb852de-81">official SSH specification (RFC 4253).</div>
<div id="crayon-4f7ff0eb852de-82"></div>
<div id="crayon-4f7ff0eb852de-83">---- [ 2.2 Algorithm negotiation</div>
<div id="crayon-4f7ff0eb852de-84"></div>
<div id="crayon-4f7ff0eb852de-85">The next phase is the process of key algorithm negotiation. This begins by</div>
<div id="crayon-4f7ff0eb852de-86">calling ssh_kex2() inside ssh_login(). ssh_kex2() is defined at sshconnect2.c</div>
<div id="crayon-4f7ff0eb852de-87">and its main job is to setup a proposal of key exchange methods supported by</div>
<div id="crayon-4f7ff0eb852de-88">the client. A Kex structure is used for that and contains a set of lists</div>
<div id="crayon-4f7ff0eb852de-89">describing which algorithms are supported client-to-server and which for</div>
<div id="crayon-4f7ff0eb852de-90">server-to-client. Algorithms include server host key algorithms, encryption</div>
<div id="crayon-4f7ff0eb852de-91">algorithms, mac algorithms, compression algorithms and optionally</div>
<div id="crayon-4f7ff0eb852de-92">additional languages supported. Server host key algorithms are responsible</div>
<div id="crayon-4f7ff0eb852de-93">for public key encryption and/or signature. Examples are ssh-dss and</div>
<div id="crayon-4f7ff0eb852de-94">ssh-rsa. Encryption algorithms are actually the ciphers that will encrypt</div>
<div id="crayon-4f7ff0eb852de-95">the packets with the secret session key that will be created later. These</div>
<div id="crayon-4f7ff0eb852de-96">include aes128-ctr, aes198-ctr, aes256-ctr, 3des-cbc, blowfish-cbc and many</div>
<div id="crayon-4f7ff0eb852de-97">more. Data integrity is protected by mac algorithms like hmac-md5,</div>
<div id="crayon-4f7ff0eb852de-98">hmac-sha1 etc. Compression is optionally used for network performance</div>
<div id="crayon-4f7ff0eb852de-99">reasons (mainly provided by the zlib algorithm). The kex proposal is</div>
<div id="crayon-4f7ff0eb852de-100">sent by kex_setup() at kex.c which calls kex_send_kexinit(). This function</div>
<div id="crayon-4f7ff0eb852de-101">uses the packet_* wrapper functions which we are going to analyse later,</div>
<div id="crayon-4f7ff0eb852de-102">since they deserve a section for their own given their importance.</div>
<div id="crayon-4f7ff0eb852de-103">kex_reset_dispatch() leverages the dispatch_* functions which are a clever</div>
<div id="crayon-4f7ff0eb852de-104">way of providing temporary callback handlers for various kinds of messages.</div>
<div id="crayon-4f7ff0eb852de-105">dispatch.c is the host of their definitions and they are used for</div>
<div id="crayon-4f7ff0eb852de-106">situations where OpenSSH is not expecting a certain message so that a</div>
<div id="crayon-4f7ff0eb852de-107">central function could handle it by itself. Such is the case here, where</div>
<div id="crayon-4f7ff0eb852de-108">the server might return some other transport message (note that SSH uses</div>
<div id="crayon-4f7ff0eb852de-109">certain code number at the beginnig of the ssh packet to denote the kind of</div>
<div id="crayon-4f7ff0eb852de-110">the message that is contained in it) other than SSH2_MSG_KEXINIT in which</div>
<div id="crayon-4f7ff0eb852de-111">case that would be handled as an error by kex_protocol_error(). If</div>
<div id="crayon-4f7ff0eb852de-112">everything goes well, however, kex_input_kexinit() will be called. Note</div>
<div id="crayon-4f7ff0eb852de-113">that the key exchange is a completely asynchronous phase meaning that the</div>
<div id="crayon-4f7ff0eb852de-114">client message might arrive first to the server or the server's proposal</div>
<div id="crayon-4f7ff0eb852de-115">might reach the client first. This will vary according to the load of each</div>
<div id="crayon-4f7ff0eb852de-116">side at the time. Ncrack sends the kex message immediately after sending its</div>
<div id="crayon-4f7ff0eb852de-117">own client version string, in order to speed things up. To sum up, the KEX</div>
<div id="crayon-4f7ff0eb852de-118">message contains the following:</div>
<div id="crayon-4f7ff0eb852de-119"></div>
<div id="crayon-4f7ff0eb852de-120">byte SSH_MSG_KEXINIT</div>
<div id="crayon-4f7ff0eb852de-121">byte[16] cookie (random bytes)</div>
<div id="crayon-4f7ff0eb852de-122">name-list kex_algorithms</div>
<div id="crayon-4f7ff0eb852de-123">name-list server_host_key_algorithms</div>
<div id="crayon-4f7ff0eb852de-124">name-list encryption_algorithms_client_to_server</div>
<div id="crayon-4f7ff0eb852de-125">name-list encryption_algorithms_server_to_client</div>
<div id="crayon-4f7ff0eb852de-126">name-list mac_algorithms_client_to_server</div>
<div id="crayon-4f7ff0eb852de-127">name-list mac_algorithms_server_to_client</div>
<div id="crayon-4f7ff0eb852de-128">name-list compression_algorithms_client_to_server</div>
<div id="crayon-4f7ff0eb852de-129">name-list compression_algorithms_server_to_client</div>
<div id="crayon-4f7ff0eb852de-130">name-list languages_client_to_server</div>
<div id="crayon-4f7ff0eb852de-131">name-list languages_server_to_client</div>
<div id="crayon-4f7ff0eb852de-132">boolean first_kex_packet_follows</div>
<div id="crayon-4f7ff0eb852de-133">uint32 0 (reserved for future extension)</div>
<div id="crayon-4f7ff0eb852de-134"></div>
<div id="crayon-4f7ff0eb852de-135">After the client gets the server&#8217;s proposal, kex_input_kexinit() will be</div>
<div id="crayon-4f7ff0eb852de-136">called as we mentioned earlier. Some packet sanity checks will take place</div>
<div id="crayon-4f7ff0eb852de-137">there and then kex_kexinit_finish() will essentially finish this phase by</div>
<div id="crayon-4f7ff0eb852de-138">issuing a call to kex_choose_conf(). This function now compares the two</div>
<div id="crayon-4f7ff0eb852de-139">proposals and searches for the best match of algorithms supported by both</div>
<div id="crayon-4f7ff0eb852de-140">sides. This is done by a series of helper functions defined in kex.c . The</div>
<div id="crayon-4f7ff0eb852de-141">same procedure takes place on the server side too so by the end of this</div>
<div id="crayon-4f7ff0eb852de-142">phase both ends know how to further communicate.</div>
<div id="crayon-4f7ff0eb852de-143">To get a visual representation of what has happened so far here&#8217;s a small</div>
<div id="crayon-4f7ff0eb852de-144">function call invocation diagram:</div>
<div id="crayon-4f7ff0eb852de-145"></div>
<div id="crayon-4f7ff0eb852de-146">ssh_connect()</div>
<div id="crayon-4f7ff0eb852de-147">ssh_login()</div>
<div id="crayon-4f7ff0eb852de-148">|</div>
<div id="crayon-4f7ff0eb852de-149">|&#8211;&amp;gt; ssh_exchange_identification()</div>
<div id="crayon-4f7ff0eb852de-150">| |</div>
<div id="crayon-4f7ff0eb852de-151">|&#8211;&amp;gt; ssh_kex2() |&#8211;&amp;gt; compat_datafellows(), etc</div>
<div id="crayon-4f7ff0eb852de-152">|</div>
<div id="crayon-4f7ff0eb852de-153">|&#8211;&amp;gt; kex_setup()</div>
<div id="crayon-4f7ff0eb852de-154">|</div>
<div id="crayon-4f7ff0eb852de-155">|&#8211;&amp;gt; kex_send_kexinit()</div>
<div id="crayon-4f7ff0eb852de-156">|</div>
<div id="crayon-4f7ff0eb852de-157">|&#8211;&amp;gt; kex_reset_dispatch()</div>
<div id="crayon-4f7ff0eb852de-158">|</div>
<div id="crayon-4f7ff0eb852de-159">|&#8211;&amp;gt; kex_input_kexinit()</div>
<div id="crayon-4f7ff0eb852de-160">|</div>
<div id="crayon-4f7ff0eb852de-161">|&#8211;&amp;gt; kex_kexinit_finish()</div>
<div id="crayon-4f7ff0eb852de-162">|</div>
<div id="crayon-4f7ff0eb852de-163">|&#8211;&amp;gt; kex_choose_conf()</div>
<div id="crayon-4f7ff0eb852de-164"></div>
<div id="crayon-4f7ff0eb852de-165">&#8212;- [ 2.3 Diffie-Hellman Key Exchange</div>
<div id="crayon-4f7ff0eb852de-166"></div>
<div id="crayon-4f7ff0eb852de-167">This procedure is going to create the secret session keys that are going to</div>
<div id="crayon-4f7ff0eb852de-168">encrypt the rest of the packets during that connection. It involves some</div>
<div id="crayon-4f7ff0eb852de-169">prime number and mod maths about which you can read at Section 8 of RFC</div>
<div id="crayon-4f7ff0eb852de-170">4253 [2]. In summary, both hosts create a common shared secret that cannot be</div>
<div id="crayon-4f7ff0eb852de-171">determined by either party alone. This phase also provides server</div>
<div id="crayon-4f7ff0eb852de-172">authentication if that is needed. Of course, this normally requires a</div>
<div id="crayon-4f7ff0eb852de-173">priori knowledge of the server&#8217;s public host key. In Ncrack&#8217;s case, the server</div>
<div id="crayon-4f7ff0eb852de-174">authentication step is skipped.</div>
<div id="crayon-4f7ff0eb852de-175"></div>
<div id="crayon-4f7ff0eb852de-176">Continuing from above, we were analysing kex_kexinit_finish() which chooses</div>
<div id="crayon-4f7ff0eb852de-177">the matching proposals. This doesn&#8217;t end there however, since before it</div>
<div id="crayon-4f7ff0eb852de-178">finishes it also calls the appropriate Diffie-Hellman (DH) handler to</div>
<div id="crayon-4f7ff0eb852de-179">initiate the DH key exchange. This is done by dereferencing a function</div>
<div id="crayon-4f7ff0eb852de-180">pointer inside the Kex structure:</div>
<div id="crayon-4f7ff0eb852de-181"></div>
<div id="crayon-4f7ff0eb852de-182">static void</div>
<div id="crayon-4f7ff0eb852de-183">kex_kexinit_finish(Kex *kex)</div>
<div id="crayon-4f7ff0eb852de-184">{</div>
<div id="crayon-4f7ff0eb852de-185">    if (!(kex-&amp;gt;flags &amp;amp; KEX_INIT_SENT))</div>
<div id="crayon-4f7ff0eb852de-186">        kex_send_kexinit(kex);</div>
<div id="crayon-4f7ff0eb852de-187"></div>
<div id="crayon-4f7ff0eb852de-188">    kex_choose_conf(kex);</div>
<div id="crayon-4f7ff0eb852de-189"></div>
<div id="crayon-4f7ff0eb852de-190">    if (kex-&amp;gt;kex_type &amp;gt;= 0 &amp;amp;&amp;amp; kex-&amp;gt;kex_type &amp;lt; KEX_MAX &amp;amp;&amp;amp;</div>
<div id="crayon-4f7ff0eb852de-191">   kex-&amp;gt;kex[kex-&amp;gt;kex_type] != NULL) {</div>
<div id="crayon-4f7ff0eb852de-192">        (kex-&amp;gt;kex[kex-&amp;gt;kex_type])(kex);</div>
<div id="crayon-4f7ff0eb852de-193">    } else {</div>
<div id="crayon-4f7ff0eb852de-194">        fatal(“Unsupported key exchange %d”, kex-&amp;gt;kex_type);</div>
<div id="crayon-4f7ff0eb852de-195">    }</div>
<div id="crayon-4f7ff0eb852de-196">}</div>
<div id="crayon-4f7ff0eb852de-197"></div>
<div id="crayon-4f7ff0eb852de-198">These were initialized during the ssh_kex2() function:</div>
<div id="crayon-4f7ff0eb852de-199"></div>
<div id="crayon-4f7ff0eb852de-200">void</div>
<div id="crayon-4f7ff0eb852de-201">ssh_kex2(char *host, struct sockaddr *hostaddr)</div>
<div id="crayon-4f7ff0eb852de-202">{</div>
<div id="crayon-4f7ff0eb852de-203">    Kex *kex;</div>
<div id="crayon-4f7ff0eb852de-204"></div>
<div id="crayon-4f7ff0eb852de-205">&#8230;</div>
<div id="crayon-4f7ff0eb852de-206"></div>
<div id="crayon-4f7ff0eb852de-207">    /* start key exchange */</div>
<div id="crayon-4f7ff0eb852de-208">    kex = kex_setup(myproposal);</div>
<div id="crayon-4f7ff0eb852de-209">    kex-&amp;gt;kex[KEX_DH_GRP1_SHA1] = kexdh_client;</div>
<div id="crayon-4f7ff0eb852de-210">    kex-&amp;gt;kex[KEX_DH_GRP14_SHA1] = kexdh_client;</div>
<div id="crayon-4f7ff0eb852de-211">    kex-&amp;gt;kex[KEX_DH_GEX_SHA1] = kexgex_client;</div>
<div id="crayon-4f7ff0eb852de-212">    kex-&amp;gt;kex[KEX_DH_GEX_SHA256] = kexgex_client;</div>
<div id="crayon-4f7ff0eb852de-213">    kex-&amp;gt;client_version_string=client_version_string;</div>
<div id="crayon-4f7ff0eb852de-214">    kex-&amp;gt;server_version_string=server_version_string;</div>
<div id="crayon-4f7ff0eb852de-215">    kex-&amp;gt;verify_host_key=&amp;amp;verify_host_key_callback;</div>
<div id="crayon-4f7ff0eb852de-216"></div>
<div id="crayon-4f7ff0eb852de-217">&#8230;</div>
<div id="crayon-4f7ff0eb852de-218">}</div>
<div id="crayon-4f7ff0eb852de-219"></div>
<div id="crayon-4f7ff0eb852de-220">As you see, there are 2 different functions that are registered:</div>
<div id="crayon-4f7ff0eb852de-221">kexdh_client() residing at kexdhc.c and kexgex_client() residing at</div>
<div id="crayon-4f7ff0eb852de-222">kexgexc.c . The first is a handler for the diffie-hellman-group14-sha1</div>
<div id="crayon-4f7ff0eb852de-223">method which uses a SHA-1 as hash and 2048-bit MODP Group, while the</div>
<div id="crayon-4f7ff0eb852de-224">latter which is probably the most common one and supported by all known</div>
<div id="crayon-4f7ff0eb852de-225">implementations is a handler for the diffie-hellman-group1-sha1 which also</div>
<div id="crayon-4f7ff0eb852de-226">uses a SHA-1 as hash but a 1024-bit MODP Group. Both of these are explained</div>
<div id="crayon-4f7ff0eb852de-227">in RFC3256 and RFC2409 correspondingly.</div>
<div id="crayon-4f7ff0eb852de-228"></div>
<div id="crayon-4f7ff0eb852de-229">kexgex_client() starts by sending a SSH2_MSG_KEX_DH_GEX_REQUEST message,</div>
<div id="crayon-4f7ff0eb852de-230">expects to get back a SSH2_MSG_KEX_DH_GEX_GROUP, then sends a</div>
<div id="crayon-4f7ff0eb852de-231">SSH2_MSG_KEX_DH_GEX_INIT and expects back a SSH2_MSG_KEX_DH_GEX_REPLY.</div>
<div id="crayon-4f7ff0eb852de-232">These messages mainly contain the prime numbers and math-stuff that we</div>
<div id="crayon-4f7ff0eb852de-233">mentioned earlier. With the last message received, the client can</div>
<div id="crayon-4f7ff0eb852de-234">authenticate the server using &#8216;kex-&amp;gt;verify_host_key(server_host_key)&#8217; and</div>
<div id="crayon-4f7ff0eb852de-235">then proceed on creating the cipher session key as the last step with:</div>
<div id="crayon-4f7ff0eb852de-236">&#8216;kex_derive_keys(kex, hash, hashlen, shared_secret)&#8217; (defined at kex.c)</div>
<div id="crayon-4f7ff0eb852de-237">Finally, kex_finish() is called to complete this phase by sending a</div>
<div id="crayon-4f7ff0eb852de-238">SSH2_MSG_NEWKEYS message and also expecting back the same kind of message</div>
<div id="crayon-4f7ff0eb852de-239">from the server. When these two have been exchanged, the rest of the</div>
<div id="crayon-4f7ff0eb852de-240">packets are encrypted using the derived keys.</div>
<div id="crayon-4f7ff0eb852de-241"></div>
<div id="crayon-4f7ff0eb852de-242">Moving back in the call graph, after all these functions have finished</div>
<div id="crayon-4f7ff0eb852de-243">their work, ssh_kex2() finally returns. It is time to move on to</div>
<div id="crayon-4f7ff0eb852de-244">ssh_userauth2() and the user authentication part.</div>
<div id="crayon-4f7ff0eb852de-245"></div>
<div id="crayon-4f7ff0eb852de-246">&#8212;- [ 2.4 User Authentication</div>
<div id="crayon-4f7ff0eb852de-247"></div>
<div id="crayon-4f7ff0eb852de-248">ssh_userauth2() begins by issuing a "ssh-userauth" service request to the</div>
<div id="crayon-4f7ff0eb852de-249">server. It is possible, for any reason, that the server denies this request</div>
<div id="crayon-4f7ff0eb852de-250">in which case the client terminates. If this SSH2_MSG_SERVICE_REQUEST</div>
<div id="crayon-4f7ff0eb852de-251">message is, however, replied with a SSH2_MSG_SERVICE_ACCEPT one, then the</div>
<div id="crayon-4f7ff0eb852de-252">client moves on to the real authentication part. There are a number of</div>
<div id="crayon-4f7ff0eb852de-253">choices here as far as the authentication methods are concerned. "none",</div>
<div id="crayon-4f7ff0eb852de-254">"publickey", "password" and "hostbased" are what SSH officially specifies</div>
<div id="crayon-4f7ff0eb852de-255">with "publickey" being the only one that all implementations *must* always</div>
<div id="crayon-4f7ff0eb852de-256">support. The "none" method is special in that it is normally used by ssh</div>
<div id="crayon-4f7ff0eb852de-257">clients as a way to get the server to list all the available authentication</div>
<div id="crayon-4f7ff0eb852de-258">methods it supports. What is interesting, is that RFC 4252 Section 9 [5]</div>
<div id="crayon-4f7ff0eb852de-259">mentions that the server can also return a SSH_MSG_USERAUTH_SUCCESS if no</div>
<div id="crayon-4f7ff0eb852de-260">authentication is needed for the user! However, that would probably be</div>
<div id="crayon-4f7ff0eb852de-261">non-applicable for most SSH servers out there (not for telnet servers though).</div>
<div id="crayon-4f7ff0eb852de-262"></div>
<div id="crayon-4f7ff0eb852de-263">OpenSSH tries to get that list of supported methods by sending a “none”</div>
<div id="crayon-4f7ff0eb852de-264">method request and then moving on to try the best available way to</div>
<div id="crayon-4f7ff0eb852de-265">authenticate. ssh_userauth2() then registers with the dispatch_* functions</div>
<div id="crayon-4f7ff0eb852de-266">a number of callback functions for all kind of possible replies:</div>
<div id="crayon-4f7ff0eb852de-267">SSH2_MSG_USERAUTH_SUCCESS, SSH2_MSG_USERAUTH_FAILURE and</div>
<div id="crayon-4f7ff0eb852de-268">SSH2_MSG_USERAUTH_BANNER which are pretty self-explanatory. Each</div>
<div id="crayon-4f7ff0eb852de-269">authentication attempt includes all relevant information (username,</div>
<div id="crayon-4f7ff0eb852de-270">password etc) in a SSH2_MSG_USERAUTH_REQUEST message.</div>
<div id="crayon-4f7ff0eb852de-271"></div>
<div id="crayon-4f7ff0eb852de-272">It is important to note here, that SSH does not allow the client to change</div>
<div id="crayon-4f7ff0eb852de-273">the username in the same connection. It can surely, try different passwords</div>
<div id="crayon-4f7ff0eb852de-274">(if using the “password” method) but if the client sends a new</div>
<div id="crayon-4f7ff0eb852de-275">SSH2_MSG_USERAUTH_REQUEST with a username other than the one that it</div>
<div id="crayon-4f7ff0eb852de-276">initially sent in that particular connection, then the server terminates</div>
<div id="crayon-4f7ff0eb852de-277">the connection immediately. This has called for another kind of</div>
<div id="crayon-4f7ff0eb852de-278">bruteforcing iteration for Ncrack that is explained in part 4 of this</div>
<div id="crayon-4f7ff0eb852de-279">paper.</div>
<div id="crayon-4f7ff0eb852de-280"></div>
<div id="crayon-4f7ff0eb852de-281">&#8212;- [ 2.5 Packet Handling</div>
<div id="crayon-4f7ff0eb852de-282"></div>
<div id="crayon-4f7ff0eb852de-283">This is one of the most interesting and important subsystems of OpenSSH.</div>
<div id="crayon-4f7ff0eb852de-284">packet.c is full of packet processing and parsing code. We are dealing with</div>
<div id="crayon-4f7ff0eb852de-285">code that is involved with the more low-level details of passing the outgoing</div>
<div id="crayon-4f7ff0eb852de-286">messages of all other functions to an internal queue and then sending them</div>
<div id="crayon-4f7ff0eb852de-287">out on the network or doing the opposite for incoming ones. Most of the</div>
<div id="crayon-4f7ff0eb852de-288">handlers here largely rely on buffer manipulation functions defined at</div>
<div id="crayon-4f7ff0eb852de-289">buffer.c, bufaux.c and bufbn.c .</div>
<div id="crayon-4f7ff0eb852de-290"></div>
<div id="crayon-4f7ff0eb852de-291">We are going to focus on the main ingress and egress functions:</div>
<div id="crayon-4f7ff0eb852de-292">packet_read() and packet_send2() respectively.</div>
<div id="crayon-4f7ff0eb852de-293"></div>
<div id="crayon-4f7ff0eb852de-294">The packet.c subsystem uses some global variables to do its job. The most</div>
<div id="crayon-4f7ff0eb852de-295">important ones are:</div>
<div id="crayon-4f7ff0eb852de-296"></div>
<div id="crayon-4f7ff0eb852de-297">/* Encryption context for receiving data. This is only used for decryption. */</div>
<div id="crayon-4f7ff0eb852de-298">static CipherContext receive_context;</div>
<div id="crayon-4f7ff0eb852de-299"></div>
<div id="crayon-4f7ff0eb852de-300">/* Encryption context for sending data. This is only used for encryption. */</div>
<div id="crayon-4f7ff0eb852de-301">static CipherContext send_context;</div>
<div id="crayon-4f7ff0eb852de-302"></div>
<div id="crayon-4f7ff0eb852de-303">/* Buffer for raw input data from the socket. */</div>
<div id="crayon-4f7ff0eb852de-304">Buffer input;</div>
<div id="crayon-4f7ff0eb852de-305"></div>
<div id="crayon-4f7ff0eb852de-306">/* Buffer for raw output data going to the socket. */</div>
<div id="crayon-4f7ff0eb852de-307">Buffer output;</div>
<div id="crayon-4f7ff0eb852de-308"></div>
<div id="crayon-4f7ff0eb852de-309">/* Buffer for the partial outgoing packet being constructed. */</div>
<div id="crayon-4f7ff0eb852de-310">static Buffer outgoing_packet;</div>
<div id="crayon-4f7ff0eb852de-311"></div>
<div id="crayon-4f7ff0eb852de-312">/* Buffer for the incoming packet currently being processed. */</div>
<div id="crayon-4f7ff0eb852de-313">static Buffer incoming_packet;</div>
<div id="crayon-4f7ff0eb852de-314"></div>
<div id="crayon-4f7ff0eb852de-315">The difference between 'output' and 'outgoing_packet' is, as the authors'</div>
<div id="crayon-4f7ff0eb852de-316">comments already denote, that 'output' is referring to the raw data that</div>
<div id="crayon-4f7ff0eb852de-317">is going to be sent in the end (which may also be encrypted), while the</div>
<div id="crayon-4f7ff0eb852de-318">'outgoing_packet' is just a temporary buffer holding the intermediate</div>
<div id="crayon-4f7ff0eb852de-319">operations that take place inside packet_send2() and its subsequent</div>
<div id="crayon-4f7ff0eb852de-320">functions. The same applies for 'input' and 'incoming_packet'.</div>
<div id="crayon-4f7ff0eb852de-321"></div>
<div id="crayon-4f7ff0eb852de-322">packet_send2() is a wrapper for packet_send2_wrapped() and also checks for</div>
<div id="crayon-4f7ff0eb852de-323">some cases like rekeying (when that is imperative to happen - which can</div>
<div id="crayon-4f7ff0eb852de-324">happen after a session is online for much time). packet_send2_wrapped() is</div>
<div id="crayon-4f7ff0eb852de-325">the real workhorse here. It first checks for whether the session keys have</div>
<div id="crayon-4f7ff0eb852de-326">been already initialized, which is always the case after the DH phase is</div>
<div id="crayon-4f7ff0eb852de-327">complete, so as to apply the corresponding cipher, hash message authentication</div>
<div id="crayon-4f7ff0eb852de-328">code and possibly compression on the outgoing packet.</div>
<div id="crayon-4f7ff0eb852de-329"></div>
<div id="crayon-4f7ff0eb852de-330">packet_read() is a zero-code wrapper for packet_read_seqnr() (though it</div>
<div id="crayon-4f7ff0eb852de-331">makes a difference by calling it with a NULL argument) which is basically a</div>
<div id="crayon-4f7ff0eb852de-332">common select() loop that tries to read a complete packet before moving on.</div>
<div id="crayon-4f7ff0eb852de-333">packet_read_poll_seqnr() is called inside this loop and gives its place to</div>
<div id="crayon-4f7ff0eb852de-334">packet_read_poll2() which is the main workhorse for incoming packet</div>
<div id="crayon-4f7ff0eb852de-335">processing. It does almost the opposite operations of what</div>
<div id="crayon-4f7ff0eb852de-336">packet_send2_wrapped() does. The return value of this function, which is</div>
<div id="crayon-4f7ff0eb852de-337">the message type of the incoming message, if that was possible with the data</div>
<div id="crayon-4f7ff0eb852de-338">available at 'input' (since we might be at the first iteration of the</div>
<div id="crayon-4f7ff0eb852de-339">packet_read_seqnr() loop and thus haven't issued a read() call yet). This</div>
<div id="crayon-4f7ff0eb852de-340">type is then used a decision-making value for packet_read_poll_seqnr(). For</div>
<div id="crayon-4f7ff0eb852de-341">every message other than SSH2_MSG_IGNORE, SSH2_MSG_DEBUG and</div>
<div id="crayon-4f7ff0eb852de-342">SSH2_MSG_DISCONNECT where special action is taken (like printing debugging</div>
<div id="crayon-4f7ff0eb852de-343">output or exiting the client in the last case), this type is just returned</div>
<div id="crayon-4f7ff0eb852de-344">to packet_read_seqnr(). If the type was SSH_MSG_NONE, which is the case</div>
<div id="crayon-4f7ff0eb852de-345">when packet_read_poll2 can't extract the type yet, or just encounters a</div>
<div id="crayon-4f7ff0eb852de-346">strange error (e.g bad packet length), then the loop goes on until a</div>
<div id="crayon-4f7ff0eb852de-347">'clean' message has arrived.</div>
<div id="crayon-4f7ff0eb852de-348"></div>
<div id="crayon-4f7ff0eb852de-349">This is a very brief summary of what these functions do. If you are curious</div>
<div id="crayon-4f7ff0eb852de-350">about more details, you are advised to read the source code as it is easily</div>
<div id="crayon-4f7ff0eb852de-351">readble and well-written.</div>
<div id="crayon-4f7ff0eb852de-352"></div>
<div id="crayon-4f7ff0eb852de-353">3 - Ncrack OpenSSH library</div>
<div id="crayon-4f7ff0eb852de-354">===========================</div>
<div id="crayon-4f7ff0eb852de-355"></div>
<div id="crayon-4f7ff0eb852de-356">One of the most challenging parts of hacking the OpenSSH library for Ncrack</div>
<div id="crayon-4f7ff0eb852de-357">was, apart from having to study and understand a large part of the OpenSSH</div>
<div id="crayon-4f7ff0eb852de-358">code and the SSH protocol itself, the fact that it would need to be</div>
<div id="crayon-4f7ff0eb852de-359">tailored so that socket operations are not done by OpenSSH but by Nsock,</div>
<div id="crayon-4f7ff0eb852de-360">the underlying parallel socket library leveraged by Ncrack. The OpenSSH</div>
<div id="crayon-4f7ff0eb852de-361">client needs only open 1 connection at a time, and thus any concurrency</div>
<div id="crayon-4f7ff0eb852de-362">issues can be handled perfectly by having these global variables in</div>
<div id="crayon-4f7ff0eb852de-363">packet.c and other subsystems. This is not the case for Ncrack, however,</div>
<div id="crayon-4f7ff0eb852de-364">which not only needs to be able to open many connections at the same time,</div>
<div id="crayon-4f7ff0eb852de-365">but also has to do so in a way that Nsock understands (obviously by calling</div>
<div id="crayon-4f7ff0eb852de-366">its designated handlers). For this reason, almost every function that had</div>
<div id="crayon-4f7ff0eb852de-367">socket operations involved was hacked to the core. In addition, a separate</div>
<div id="crayon-4f7ff0eb852de-368">structure was created that holds all necessary information for each</div>
<div id="crayon-4f7ff0eb852de-369">connection that Ncrack initiates with the SSH module.</div>
<div id="crayon-4f7ff0eb852de-370"></div>
<div id="crayon-4f7ff0eb852de-371">---- [ 3.1 - One Struct Fits All</div>
<div id="crayon-4f7ff0eb852de-372"></div>
<div id="crayon-4f7ff0eb852de-373">This struct 'ncrack_ssh_state' is created for each new SSH connection that</div>
<div id="crayon-4f7ff0eb852de-374">is initiated by Ncrack. It is defined at opensshlib.h under opensshlib/ of</div>
<div id="crayon-4f7ff0eb852de-375">Ncrack's directory and literally holds all variables that need to be separate</div>
<div id="crayon-4f7ff0eb852de-376">for each connection (and were globall ones previously on OpenSSH). Examples</div>
<div id="crayon-4f7ff0eb852de-377">are the buffers for the incoming and outgoing packets.</div>
<div id="crayon-4f7ff0eb852de-378"></div>
<div id="crayon-4f7ff0eb852de-379">typedef struct packet_state {</div>
<div id="crayon-4f7ff0eb852de-380">u_int32_t seqnr;</div>
<div id="crayon-4f7ff0eb852de-381">u_int32_t packets;</div>
<div id="crayon-4f7ff0eb852de-382">u_int64_t blocks;</div>
<div id="crayon-4f7ff0eb852de-383">u_int64_t bytes;</div>
<div id="crayon-4f7ff0eb852de-384">} packet_state;</div>
<div id="crayon-4f7ff0eb852de-385"></div>
<div id="crayon-4f7ff0eb852de-386">/*</div>
<div id="crayon-4f7ff0eb852de-387">* Every module invocation has its own Ncrack_state struct which holds every</div>
<div id="crayon-4f7ff0eb852de-388">* bit of information needed to keep track of things. Most of the variables</div>
<div id="crayon-4f7ff0eb852de-389">* found inside this object were usually static/global variables in the original</div>
<div id="crayon-4f7ff0eb852de-390">* OpenSSH codebase.</div>
<div id="crayon-4f7ff0eb852de-391">*/</div>
<div id="crayon-4f7ff0eb852de-392">typedef struct ncrack_ssh_state {</div>
<div id="crayon-4f7ff0eb852de-393"></div>
<div id="crayon-4f7ff0eb852de-394">struct Kex *kex;</div>
<div id="crayon-4f7ff0eb852de-395">DH *dh;</div>
<div id="crayon-4f7ff0eb852de-396">/* Session key information for Encryption and MAC */</div>
<div id="crayon-4f7ff0eb852de-397">struct Newkeys *keys[2];</div>
<div id="crayon-4f7ff0eb852de-398">char *client_version_string;</div>
<div id="crayon-4f7ff0eb852de-399">char *server_version_string;</div>
<div id="crayon-4f7ff0eb852de-400">/* Encryption context for receiving data. This is only used for decryption. */</div>
<div id="crayon-4f7ff0eb852de-401">CipherContext receive_context;</div>
<div id="crayon-4f7ff0eb852de-402">/* Encryption context for sending data. This is only used for encryption. */</div>
<div id="crayon-4f7ff0eb852de-403">CipherContext send_context;</div>
<div id="crayon-4f7ff0eb852de-404"></div>
<div id="crayon-4f7ff0eb852de-405">/* ***** IO Buffers ****** */</div>
<div id="crayon-4f7ff0eb852de-406">Buffer ncrack_buf;</div>
<div id="crayon-4f7ff0eb852de-407"></div>
<div id="crayon-4f7ff0eb852de-408">/* Buffer for raw input data from the socket. */</div>
<div id="crayon-4f7ff0eb852de-409">Buffer input;</div>
<div id="crayon-4f7ff0eb852de-410">/* Buffer for raw output data going to the socket. */</div>
<div id="crayon-4f7ff0eb852de-411">Buffer output;</div>
<div id="crayon-4f7ff0eb852de-412">/* Buffer for the incoming packet currently being processed. */</div>
<div id="crayon-4f7ff0eb852de-413">Buffer incoming_packet;</div>
<div id="crayon-4f7ff0eb852de-414">/* Buffer for the partial outgoing packet being constructed. */</div>
<div id="crayon-4f7ff0eb852de-415">Buffer outgoing_packet;</div>
<div id="crayon-4f7ff0eb852de-416"></div>
<div id="crayon-4f7ff0eb852de-417">u_int64_t max_blocks_in;</div>
<div id="crayon-4f7ff0eb852de-418">u_int64_t max_blocks_out;</div>
<div id="crayon-4f7ff0eb852de-419">packet_state p_read;</div>
<div id="crayon-4f7ff0eb852de-420">packet_state p_send;</div>
<div id="crayon-4f7ff0eb852de-421"></div>
<div id="crayon-4f7ff0eb852de-422">    int compat20;    /* boolean -&amp;gt; true if SSHv2 compatible */</div>
<div id="crayon-4f7ff0eb852de-423"></div>
<div id="crayon-4f7ff0eb852de-424">/* Compatibility mode for different bugs of various older sshd</div>
<div id="crayon-4f7ff0eb852de-425">* versions. It holds a list of these bug types in a binary OR list</div>
<div id="crayon-4f7ff0eb852de-426">*/</div>
<div id="crayon-4f7ff0eb852de-427">int datafellows;</div>
<div id="crayon-4f7ff0eb852de-428">int type; /* type of packet returned */</div>
<div id="crayon-4f7ff0eb852de-429">u_char extra_pad; /* extra padding that might be needed */</div>
<div id="crayon-4f7ff0eb852de-430"></div>
<div id="crayon-4f7ff0eb852de-431">/*</div>
<div id="crayon-4f7ff0eb852de-432">* Reason that this connection was ended. It might be that we got a</div>
<div id="crayon-4f7ff0eb852de-433">* disconnnect packet from the server due to many authentication attempts</div>
<div id="crayon-4f7ff0eb852de-434">* or some other exotic reason.</div>
<div id="crayon-4f7ff0eb852de-435">*/</div>
<div id="crayon-4f7ff0eb852de-436">char *disc_reason;</div>
<div id="crayon-4f7ff0eb852de-437"></div>
<div id="crayon-4f7ff0eb852de-438">    u_int packet_length;</div>
<div id="crayon-4f7ff0eb852de-439"></div>
<div id="crayon-4f7ff0eb852de-440">} ncrack_ssh_state;</div>
<div id="crayon-4f7ff0eb852de-441"></div>
<div id="crayon-4f7ff0eb852de-442">&#8212;- [ 3.2 - Main Changes Outlined</div>
<div id="crayon-4f7ff0eb852de-443"></div>
<div id="crayon-4f7ff0eb852de-444">Perhaps, the largest hacks took place inside packet.c which holds the</div>
<div id="crayon-4f7ff0eb852de-445">packet processing functions and some socket operations. packet.c handlers</div>
<div id="crayon-4f7ff0eb852de-446">now reference ncrack_ssh_state's unique Buffers and keys and apply all</div>
<div id="crayon-4f7ff0eb852de-447">changes to them instead of on the previously global variables.</div>
<div id="crayon-4f7ff0eb852de-448"></div>
<div id="crayon-4f7ff0eb852de-449">Many changes were also made in kex.c for all the related functions</div>
<div id="crayon-4f7ff0eb852de-450">mentioned in our analysis before.</div>
<div id="crayon-4f7ff0eb852de-451"></div>
<div id="crayon-4f7ff0eb852de-452">A function that was dissected into smaller pieces was kexgex_client() of</div>
<div id="crayon-4f7ff0eb852de-453">kexgexc.c . This was nessacary because previously it did all socket</div>
<div id="crayon-4f7ff0eb852de-454">operations in one go, while Ncrack needs to isolate each such operation so</div>
<div id="crayon-4f7ff0eb852de-455">that proper action is taken by Nsock. Thus, for each message sent or</div>
<div id="crayon-4f7ff0eb852de-456">received by kexgex_client() a separate function which is a subset of it was</div>
<div id="crayon-4f7ff0eb852de-457">made. Each such function is then separately called by Ncrack's SSH module</div>
<div id="crayon-4f7ff0eb852de-458">when the corresponding internal state is reached.</div>
<div id="crayon-4f7ff0eb852de-459">From this function, the verification of the server host key was also</div>
<div id="crayon-4f7ff0eb852de-460">skipped.</div>
<div id="crayon-4f7ff0eb852de-461"></div>
<div id="crayon-4f7ff0eb852de-462">As far as the ssh_userauth2() function is concerned, it only bothers</div>
<div id="crayon-4f7ff0eb852de-463">sending the 'password' method to authenticate and if that fails, then there</div>
<div id="crayon-4f7ff0eb852de-464">is no point in continuing to try anything else for that service (Ncrack</div>
<div id="crayon-4f7ff0eb852de-465">just stops cracking it entirely). In addition, the message for the 'none'</div>
<div id="crayon-4f7ff0eb852de-466">method is not sent at all, since that would be a waste of 2 packets for</div>
<div id="crayon-4f7ff0eb852de-467">each connection with no real meaning for current implementations (since</div>
<div id="crayon-4f7ff0eb852de-468">nowadays (almost?) no SSH server allows anyone to enter without any kind of</div>
<div id="crayon-4f7ff0eb852de-469">authentication).</div>
<div id="crayon-4f7ff0eb852de-470"></div>
<div id="crayon-4f7ff0eb852de-471">We should also mention here, that OpenSSH relies on non-OpenBSD systems</div>
<div id="crayon-4f7ff0eb852de-472">needs an underlying openbsd-compat library which comes bundled with the</div>
<div id="crayon-4f7ff0eb852de-473">OpenSSH-portable package. Since, Ncrack uses only a small subset of the</div>
<div id="crayon-4f7ff0eb852de-474">OpenSSH functionality, only the absolutely necessary functions were kept.</div>
<div id="crayon-4f7ff0eb852de-475">Finally, a lot of clean-up took place for many OpenSSH functions as</div>
<div id="crayon-4f7ff0eb852de-476">well.</div>
<div id="crayon-4f7ff0eb852de-477"></div>
<div id="crayon-4f7ff0eb852de-478">4 - SSH bruteforcing</div>
<div id="crayon-4f7ff0eb852de-479">=====================</div>
<div id="crayon-4f7ff0eb852de-480"></div>
<div id="crayon-4f7ff0eb852de-481">As we had mentioned in part 2.4 User Authentication of this paper, SSH</div>
<div id="crayon-4f7ff0eb852de-482">doesn't allow a client to change the username during a particular</div>
<div id="crayon-4f7ff0eb852de-483">connection. It terminates the session if that happens so that calls for</div>
<div id="crayon-4f7ff0eb852de-484">a specialized mode of username/password iteration.</div>
<div id="crayon-4f7ff0eb852de-485"></div>
<div id="crayon-4f7ff0eb852de-486">Ncrack by default uses an iteration of trying each password for every</div>
<div id="crayon-4f7ff0eb852de-487">username, instead of the usual iteration of trying every</div>
<div id="crayon-4f7ff0eb852de-488">password for each username. This means that given the following lists:</div>
<div id="crayon-4f7ff0eb852de-489"></div>
<div id="crayon-4f7ff0eb852de-490">Username list: guest, root</div>
<div id="crayon-4f7ff0eb852de-491">Password list: 12345, test, foo, bar</div>
<div id="crayon-4f7ff0eb852de-492"></div>
<div id="crayon-4f7ff0eb852de-493">Ncrack will try them by default with the following order:</div>
<div id="crayon-4f7ff0eb852de-494">guest/12345, root/12345, guest/test, root/test, guest/foo, root/foo, guest/bar,</div>
<div id="crayon-4f7ff0eb852de-495">root/bar</div>
<div id="crayon-4f7ff0eb852de-496"></div>
<div id="crayon-4f7ff0eb852de-497">Usually the default for common password crackers is doing the opposite. However,</div>
<div id="crayon-4f7ff0eb852de-498">this is less effective for the reason that password lists are usually sorted by</div>
<div id="crayon-4f7ff0eb852de-499">order of password frequency. This means that by trying the most common passwords</div>
<div id="crayon-4f7ff0eb852de-500">for every username at the beginning of the cracking phase, the odds of success</div>
<div id="crayon-4f7ff0eb852de-501">are increased.</div>
<div id="crayon-4f7ff0eb852de-502">Of course, Ncrack is flexible enough to give you the option to do the opposite</div>
<div id="crayon-4f7ff0eb852de-503">iteration by specifying the option --passwords-first.</div>
<div id="crayon-4f7ff0eb852de-504"></div>
<div id="crayon-4f7ff0eb852de-505">As you have already realized by now neither the default nor the opposite</div>
<div id="crayon-4f7ff0eb852de-506">iteration is good enough against SSH targets. Using Ncrack's default iteration</div>
<div id="crayon-4f7ff0eb852de-507">we would only be able to make 1 authentication per connection, since we would</div>
<div id="crayon-4f7ff0eb852de-508">get disconnected when trying to change the username in the same connection.</div>
<div id="crayon-4f7ff0eb852de-509">Using the opposite iteration is still not good enough, because we are are not</div>
<div id="crayon-4f7ff0eb852de-510">able to take advantage of the frequency-sorted password lists.</div>
<div id="crayon-4f7ff0eb852de-511"></div>
<div id="crayon-4f7ff0eb852de-512">Consequently, a better iteration would be the following:</div>
<div id="crayon-4f7ff0eb852de-513">For every service, Ncrack uses a first reconnaissance probe that opens just 1</div>
<div id="crayon-4f7ff0eb852de-514">connection and tries to make as many authentication attempts as the server</div>
<div id="crayon-4f7ff0eb852de-515">allows. By doing this, it can understand the maximum number of allowed</div>
<div id="crayon-4f7ff0eb852de-516">authentication attempts per connection against that specific server and since</div>
<div id="crayon-4f7ff0eb852de-517">there is only 1 connection open at that time, the reliability of the inference</div>
<div id="crayon-4f7ff0eb852de-518">is much higher.</div>
<div id="crayon-4f7ff0eb852de-519">Knowing that, Ncrack in this special mode of iteration will provide each</div>
<div id="crayon-4f7ff0eb852de-520">connection with passwords for the same username. So if a connection started with</div>
<div id="crayon-4f7ff0eb852de-521">the username 'guest' then Ncrack will give the next 'maximum allowed</div>
<div id="crayon-4f7ff0eb852de-522">authentication attempts per connection' passwords for that username.</div>
<div id="crayon-4f7ff0eb852de-523">The above sounds a bit complicated, so let's see an example to clear things out.</div>
<div id="crayon-4f7ff0eb852de-524"></div>
<div id="crayon-4f7ff0eb852de-525">Let's suppose that the SSH server allows 3 attempts per connection and we have</div>
<div id="crayon-4f7ff0eb852de-526">the following lists:</div>
<div id="crayon-4f7ff0eb852de-527"></div>
<div id="crayon-4f7ff0eb852de-528">Username list: guest, root</div>
<div id="crayon-4f7ff0eb852de-529">Password list: 12345, test, foo, bar, changeme, lala, keke, 000</div>
<div id="crayon-4f7ff0eb852de-530"></div>
<div id="crayon-4f7ff0eb852de-531">Suppose Ncrack opens 4 parallel connections numbered #1-#4.</div>
<div id="crayon-4f7ff0eb852de-532"></div>
<div id="crayon-4f7ff0eb852de-533">Connection #1 will first get guest/12345 and will additionally be allocated with</div>
<div id="crayon-4f7ff0eb852de-534">the passwords 'test' and 'foo' for the same username(guest) for the next 2 attempts.</div>
<div id="crayon-4f7ff0eb852de-535"></div>
<div id="crayon-4f7ff0eb852de-536">Connection #2 will first get root/12345 and will additionally be allocated with</div>
<div id="crayon-4f7ff0eb852de-537">the passwords 'test' and 'foo' for the same username(root) for the next 2 attempts.</div>
<div id="crayon-4f7ff0eb852de-538"></div>
<div id="crayon-4f7ff0eb852de-539">Connection #3 will first get guest/bar and will additionally be allocated with</div>
<div id="crayon-4f7ff0eb852de-540">the passwords 'changeme' and 'lala' for the same username(guest) for the next 2</div>
<div id="crayon-4f7ff0eb852de-541">attempts.</div>
<div id="crayon-4f7ff0eb852de-542"></div>
<div id="crayon-4f7ff0eb852de-543">Connection #4 will first get root/bar and will additionally be allocated with</div>
<div id="crayon-4f7ff0eb852de-544">the passwords 'changeme' and 'lala' for the same username(root) for the next 2</div>
<div id="crayon-4f7ff0eb852de-545">attempts.</div>
<div id="crayon-4f7ff0eb852de-546"></div>
<div id="crayon-4f7ff0eb852de-547">After any of the connection finishes, then the first newly invoked connection #5</div>
<div id="crayon-4f7ff0eb852de-548">will get guest/keke and will then try guest/keke and guest/000 and so on.</div>
<div id="crayon-4f7ff0eb852de-549"></div>
<div id="crayon-4f7ff0eb852de-550">By using this mixed mode of iteration we are taking advantage of the</div>
<div id="crayon-4f7ff0eb852de-551">frequency-sorted password lists and the maximum efficiency of using all the</div>
<div id="crayon-4f7ff0eb852de-552">allowed attempts per connection.</div>
<div id="crayon-4f7ff0eb852de-553"></div>
<div id="crayon-4f7ff0eb852de-554">However, note that it is sometimes actually more efficient to open more</div>
<div id="crayon-4f7ff0eb852de-555">connections instead of using this special mode of iteration to get as many</div>
<div id="crayon-4f7ff0eb852de-556">authentication attempts per connections as possible. Most SSH servers</div>
<div id="crayon-4f7ff0eb852de-557">insert a delay before showing the results of the authentication attempt.</div>
<div id="crayon-4f7ff0eb852de-558">That delay may be 1 or 2 seconds or more depending on the configuration.</div>
<div id="crayon-4f7ff0eb852de-559">By default, it is usually more than 2 seconds. This delay is at most times</div>
<div id="crayon-4f7ff0eb852de-560">more than the time it takes to initiate a new 3way TCP handshake and</div>
<div id="crayon-4f7ff0eb852de-561">exchange the necessary protocol packets before getting to the</div>
<div id="crayon-4f7ff0eb852de-562">authentication phase. Consequently, it may be faster to open more connections</div>
<div id="crayon-4f7ff0eb852de-563">that each try out 1 authentication attempt and then immediately close</div>
<div id="crayon-4f7ff0eb852de-564">instead of trying as many attempts as possible with each connection.</div>
<div id="crayon-4f7ff0eb852de-565">This holds true, when the connection probes are not strictly limited by</div>
<div id="crayon-4f7ff0eb852de-566">a firewall or other hindrance. In any case, it is noteworthy to mention</div>
<div id="crayon-4f7ff0eb852de-567">that by default OpenSSH allows at most 10 concurrent unauthenticated</div>
<div id="crayon-4f7ff0eb852de-568">connections as mentioned by the manual of sshd_config:</div>
<div id="crayon-4f7ff0eb852de-569"></div>
<div id="crayon-4f7ff0eb852de-570">MaxStartups</div>
<div id="crayon-4f7ff0eb852de-571">Specifies the maximum number of concurrent unauthenticated connections to</div>
<div id="crayon-4f7ff0eb852de-572">the SSH daemon. Additional connections will be dropped until</div>
<div id="crayon-4f7ff0eb852de-573">authentication succeeds or the LoginGraceTime expires for a connection.</div>
<div id="crayon-4f7ff0eb852de-574">The default is 10.</div>
<div id="crayon-4f7ff0eb852de-575"></div>
<div id="crayon-4f7ff0eb852de-576">5. Conclusion</div>
<div id="crayon-4f7ff0eb852de-577">==============</div>
<div id="crayon-4f7ff0eb852de-578"></div>
<div id="crayon-4f7ff0eb852de-579">Building the OpenSSH library for Ncrack was definitely a valuable experience</div>
<div id="crayon-4f7ff0eb852de-580">and was worth the time and the effort. As Ncrack keeps improving, this</div>
<div id="crayon-4f7ff0eb852de-581">library might also be subject to more changes in order to deal with more</div>
<div id="crayon-4f7ff0eb852de-582">subtle situations and corner-cases. This document has the form of a paper</div>
<div id="crayon-4f7ff0eb852de-583">but might also be updated in the future as these changes might need to have</div>
<div id="crayon-4f7ff0eb852de-584">their own mention here.</div>
<div id="crayon-4f7ff0eb852de-585"></div>
<div id="crayon-4f7ff0eb852de-586">6. References</div>
<div id="crayon-4f7ff0eb852de-587">==============</div>
<div id="crayon-4f7ff0eb852de-588"></div>
<div id="crayon-4f7ff0eb852de-589">[0]. List of SSH-related RFCs:</div>
<div id="crayon-4f7ff0eb852de-590"></div>
<div id="crayon-4f7ff0eb852de-591">The Secure Shell (SSH) Protocol Assigned Numbers, RFC 4250, 2006.</div>
<div id="crayon-4f7ff0eb852de-592">The Secure Shell (SSH) Protocol Architecture, RFC 4251, 2006.</div>
<div id="crayon-4f7ff0eb852de-593">The Secure Shell (SSH) Authentication Protocol, RFC 4252, 2006.</div>
<div id="crayon-4f7ff0eb852de-594">The Secure Shell (SSH) Transport Layer Protocol, RFC 4253, 2006.</div>
<div id="crayon-4f7ff0eb852de-595">The Secure Shell (SSH) Connection Protocol, RFC 4254, 2006.</div>
<div id="crayon-4f7ff0eb852de-596">The Secure Shell (SSH) Session Channel Break Extension, RFC 4335, 2006.</div>
<div id="crayon-4f7ff0eb852de-597">The Secure Shell (SSH) Transport Layer Encryption Modes, RFC 4344, 2006.</div>
<div id="crayon-4f7ff0eb852de-598">Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport</div>
<div id="crayon-4f7ff0eb852de-599">Layer Protocol, RFC 4419, 2006.</div>
<div id="crayon-4f7ff0eb852de-600">Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints,</div>
<div id="crayon-4f7ff0eb852de-601">RFC 4255, 2006.</div>
<div id="crayon-4f7ff0eb852de-602">Generic Message Exchange Authentication for the Secure Shell Protocol (SSH),</div>
<div id="crayon-4f7ff0eb852de-603">RFC 4256, 2006.</div>
<div id="crayon-4f7ff0eb852de-604">Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol,</div>
<div id="crayon-4f7ff0eb852de-605">RFC 4345, 2006.</div>
<div id="crayon-4f7ff0eb852de-606">The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006.</div>
<div id="crayon-4f7ff0eb852de-607"></div>
<div id="crayon-4f7ff0eb852de-608">[1]. http://tools.ietf.org/html/rfc4253</div>
<div id="crayon-4f7ff0eb852de-609"></div>
<div id="crayon-4f7ff0eb852de-610">[2]. http://tools.ietf.org/html/rfc4253#section-8</div>
<div id="crayon-4f7ff0eb852de-611"></div>
<div id="crayon-4f7ff0eb852de-612">[3]. http://tools.ietf.org/html/rfc3526</div>
<div id="crayon-4f7ff0eb852de-613"></div>
<div id="crayon-4f7ff0eb852de-614">[4]. http://tools.ietf.org/html/rfc2409</div>
<div id="crayon-4f7ff0eb852de-615"></div>
<div id="crayon-4f7ff0eb852de-616">[5]. http://tools.ietf.org/html/rfc4252#section-9</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6207/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>活在当下</title>
		<link>http://www.am82.com/6201/</link>
		<comments>http://www.am82.com/6201/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 03:41:59 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[浓咖啡]]></category>
		<category><![CDATA[活着]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6201</guid>
		<description><![CDATA[什么要写这篇文章，是因为有感而发，前车之鉴，各位IT朋友，包括自己，要珍惜眼前，要活在当下。
 
在很长一段时间内，总是听到一些让我震惊的消息:XXX公司的程序员累死了，XXX公司的技术人员白血病了，XXX有得了急性脑溢血！眼睁睁的看着一些熟悉与陌生的IT朋友一个个的离开，有的很年轻，刚刚毕业，有的正值中年，看到这些，真的让人有点恐慌：尽管死亡是个无法避免的事实，但是不要来的太早，特别是现在！
 
    每次加班打的回去的时候，总是........]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">活在当下</span></p>
<div></div>
<div></div>
<div><span style="font-size: small;">    为什么要写这篇文章，是因为有感而发，前车之鉴，各位IT朋友，包括自己，要珍惜眼前，要活在当下。</span></div>
<div></div>
<div id=""><span style="font-size: small;">在很长一段时间内，总是听到一些让我震惊的消息:XXX公司的程序员累死了，XXX公司的技术人员白血病了，XXX有得了急性脑溢血！眼睁睁的看着一些熟悉与陌生的IT朋友一个个的离开，有的很年轻，刚刚毕业，有的正值中年，看到这些，真的让人有点恐慌：尽管死亡是个无法避免的事实，但是不要来的太早，特别是现在！</span></div>
<div></div>
<div id=""><span style="font-size: small;">    每次加班打的回去的时候，总是有的士司机问我：你们的天天加班，工资很高吧，听说你们搞IT的工资都很高？</span></div>
<div id=""></div>
<div><span style="font-size: small;">     </span></div>
<div><span style="font-size: small;">    各位搞技术朋友，你们听到这个问题之后，是什么感想？说的不好听的，有时候，真的很想抽那些散播“IT人工资高”的人几个嘴巴！很多人都在听着“传说”，看着“神话”，看到了搞计算机的比尔.盖茨成为了首富，看到了搞Iphone的Apple成为了千亿公司。</span></div>
<div></div>
<div></div>
<div id=""><span style="font-size: small;">    于是一个不成文潜意识就在所有人的头脑中形成：搞计算机的人，工资很高；搞计算机的人，都是首富的胚子；搞计算机的人，都很有前途！于是一个个其他专业的学生，毕业为了找份工作，转搞了IT。于是软件园周边的小区的房租，餐馆的菜价，早点的价格一个个都比其他地方高…</span></div>
<div id=""></div>
<div></div>
<div><span style="font-size: small;">    搞技术的朋友们，实际情况是怎么样的，大家心里很清楚：有几个城市的工资可以和房价一样的，有几个搞IT的可以活很滋润的的，又有几个IT人员可以抽时间陪家人，找老婆的，又有几个可以再IT中混出点名堂的，又有几个可以IT创业成功的。</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    说的不好听一点：搞技术的人员很多的都是处于IT食物链的底层。</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    有些人IT朋友，有的是感觉上了贼船，骑虎难下；有的是怀揣着一份自己的梦想，拼死的在坚持着！不管怎样，对于那些为了梦想还在坚持的朋友，我们一定要加以支持，不要无故的喷人家口水，诋毁别人，大家活的都不容易，已经是弱势群体了，何必还自相残杀呢。</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    对于那些骑虎难下的兄弟，希望大家保重身体，不能发财，起码要全家健康，无法富裕，起码要活的开心！</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    曾经见过太多的创业团队一个个的成为炮灰，真的有一种很难过的感觉：拿出了所有的家当，勒紧了全家人的腰带，带着一批兄弟开始创业。团队的兄弟把自己的生计压在你的身上，把前途压在你身上…失败了，如何办？虽然说“失败乃成功之母”，但是你一生有几个十年？可以扛得起几次失败？你的“成功之母”什么时候到来？</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    另外，要知道，病了进入医院，那就是另外一个“屠宰场”，并且是一个无法讨价还价，扛不起也得抗的地方，它不仅仅让我们身心重创，甚至倾家荡产！</span></div>
<div></div>
<div></div>
<div id=""><span style="font-size: small;">    每每说到这里，我就想起之前很多搞技术朋友在转型之前对我说的：哥们，搞技术就是死路一条，并且死路的很快！又想起之前和我认识的搞销售的朋友对我说的：我们公司的IT部门的搞技术的人很贱，给他们一点钱，他们就可以在哪里拼死拼活，而且加班，训斥他们，他们不敢反抗！</span></div>
<div id=""></div>
<div></div>
<div><span style="font-size: small;">    记得刚刚踏入IT的时候，看到一些公司的老员工在体检的时候，总是查出脖子不好，腰不好，肝火大，有高脂肪，高血压等等毛病，我当是还笑他们：不是吧，每天坐着都搞成这样！后来发现：坐着有时候真的不如站着舒服！也许，坐着死的更快！</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    这几年以来，自己的身体也是每况愈下，也出现过很多大大小小的警告，那是，一直以为自己年轻，不当回事，但是一件件在自己身边发生，让人开始心惊胆战。</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    “身体是革命的本钱”，这句话真不是瞎说的。如果你自己不把自己看重，没有人看重你；如果你自己不把自己看人，别人更加不把你当人；如果你自己都不珍惜自己，死神就开始向你招手了！</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    有人说：把技术搞的非常非常牛X，那就工资高了！说的不好听一点：有几个公司要技术很牛X的？技术牛X不等于高工资！技术再牛X，人都没了，有什么用？</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    自己一直在到处折腾，想法设发的赚钱，但是发现：钱这个东西，真的急不来！</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    活在当下，钱固然重要，但是想想曾经自己没有钱的日子，过的也很开心。那时候，穷的真没有钱吃饭，每天就和老婆吃挂面，每天的开销一共5元不到，如果有点青菜吃，那就是高兴的不得了的事情，如果有肉吃，那就是天降横财了…</span></div>
<div></div>
<div></div>
<div><span style="font-size: small;">    活在当前，不要认为身边的一切都是无所谓，真正的到了那一天，什么都迟了。有个朋友说的好：我们真的不敢保证，白天出门上班，晚上就可以一定平安回来！</span></div>
<div id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown"></div>
<div></div>
<div id=""><span style="font-size: small;">    活在当前，活在现实，活在今天！  祝福大家！</span></div>
<div><strong id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">本文出自：<a><span style="color: #f66209;">www.agilesharp.com</span></a> </strong></div>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6201/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>生命的歌</title>
		<link>http://www.am82.com/6199/</link>
		<comments>http://www.am82.com/6199/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 09:11:33 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[三八纯情]]></category>
		<category><![CDATA[爱]]></category>
		<category><![CDATA[瓦力]]></category>
		<category><![CDATA[视频]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6199</guid>
		<description><![CDATA[.........]]></description>
			<content:encoded><![CDATA[<p><embed src="http://www.tudou.com/v/T0TzU7vLnHk/&#038;resourceId=95575290_05_02_99/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed></p>
<p><embed src="http://player.youku.com/player.php/sid/XMzY0NjgzMzIw/v.swf" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6199/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【硬广告】《玩转QQ6》揭秘盗号，刷钻惊人内幕。更有800QB大奖等你拿！</title>
		<link>http://www.am82.com/6189/</link>
		<comments>http://www.am82.com/6189/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 09:39:10 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[挨踢消息]]></category>
		<category><![CDATA[QQ]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6189</guid>
		<description><![CDATA[你还在为QQ被盗而找不到原因而郁闷吗？

你还在为设置了二代密保的QQ依然被盗而莫名其妙吗？

你还在网上苦苦寻找刷钻方法而遭受“大牛”的白眼？

亦或者你干脆准备花钱请商家帮你刷钻？

不必郁闷，不必彷徨。

完全揭秘.......]]></description>
			<content:encoded><![CDATA[<p>你还在为QQ被盗而找不到原因而郁闷吗？</p>
<p>你还在为设置了二代密保的QQ依然被盗而莫名其妙吗？</p>
<p>你还在网上苦苦寻找刷钻方法而遭受“大牛”的白眼？</p>
<p>亦或者你干脆准备花钱请商家帮你刷钻？</p>
<p>不必郁闷，不必彷徨。</p>
<p>完全揭秘QQ盗号者近乎完美的欺骗手法、堪称经典的社工思路，知己知彼方能百战百胜，识别异常，提高安全意识，为你的Q号保驾护航。</p>
<p>揭开刷钻的必杀秘籍，红钻、黄钻、蓝绿钻，钻石想刷就刷！</p>
<p>《玩转Q6》拿到手，学会技术，把妞无忧！更有800QB大奖等你拿。</p>
<p>文艺范、盗号狂、 图标迷、钻石达人、技术青年，你值得拥有。</p>
<p>玩转QQ6<br />
<a href="http://www.am82.com/6189/qq%e5%b0%81%e9%9d%a2/" rel="attachment wp-att-6190"><img class="alignleft size-full wp-image-6190" title="QQ封面" src="http://www.am82.com/wp-content/uploads/2012/03/QQ封面.jpg" alt="" width="400" height="396" /></a></p>
<p>玩转QQ6<br />
<a href="http://www.am82.com/6189/qq6-%e7%ab%8b%e4%bd%93%e5%9b%be/" rel="attachment wp-att-6191"><img class="alignleft size-full wp-image-6191" title="QQ6 立体图" src="http://www.am82.com/wp-content/uploads/2012/03/QQ6-立体图.jpg" alt="" width="537" height="569" /></a></p>
<p><a href="http://www.am82.com/6189/qq%e6%b5%b7%e6%8a%a5/" rel="attachment wp-att-6192"><img class="alignleft size-full wp-image-6192" title="QQ海报" src="http://www.am82.com/wp-content/uploads/2012/03/QQ海报.jpg" alt="" width="560" height="777" /></a></p>
<p>&nbsp;<br />
<a href="http://item.taobao.com/item.htm?id=16196676863" target="_blank">淘宝购买地址</a></p>
<p><a href="http://book.nohack.me/goods.php?id=86" target="_blank">非安全在线商城</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6189/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>毁掉生活的正确方法：有用的一天</title>
		<link>http://www.am82.com/6185/</link>
		<comments>http://www.am82.com/6185/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 09:55:10 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[三八纯情]]></category>
		<category><![CDATA[生活]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6185</guid>
		<description><![CDATA[有用的一天，你的敌人是钝感、走神和拖延症。
有用的一天，不包括慵懒的早晨、闲逛的午后和一个人无所事事的黄昏。
有用的一天，你不是生活在生活里，而是狂奔在日程表上填得满当当的逼仄格子中。


07:00 新的一天尽在掌握

有用的一天必须从早起开始。
《哈佛商业评论》的一项调查报告是这么说的：“早晨精力最充沛的人更能明确自己的长期目标，更有把握实现自己的目标。”
你把这句话奉为格言。你.......]]></description>
			<content:encoded><![CDATA[<p><strong>有用的一天，你的敌人是钝感、走神和拖延症。<br />
有用的一天，不包括慵懒的早晨、闲逛的午后和一个人无所事事的黄昏。<br />
有用的一天，你不是生活在生活里，而是狂奔在日程表上填得满当当的逼仄格子中。</strong><br />
07:00 新的一天尽在掌握</p>
<p>有用的一天必须从早起开始。<br />
《哈佛商业评论》的一项调查报告是这么说的：“早晨精力最充沛的人更能明确自己的长期目标，更有把握实现自己的目标。”<br />
你把这句话奉为格言。你醒来，叼着牙刷打开电视，频道锁定在《凤凰早班车》——哪怕头脑还不够清醒，你也要从睁眼的第一时间开始，就了解这个世界在发生什么。<br />
你知道大多数成功人士都有早起跑步的习惯，你正考虑把这项计划纳入日程，现在你唯一向他们表示敬意的方式就是狂奔向地铁，以充沛的战斗力在铃声响起之前夺取车厢里的一席之位。<br />
地铁站是这个城市里你最熟悉的地方，你像蝗虫一般，在每个早晨被吞入，又在每个深夜被吐出。你不必买车，生活在这个城市让你感到最骄傲的事情是：挤地铁总比开车更有效率。你争取到更多的时间，尽管每个早晨你赶到办公室，身上总混杂着四五种丰富的体味。<br />
你居住在五环外，手机赐予你这漫长的路程以私密空间。你打开新闻订阅，每一条消息都不想错过，你关心全世界的地震、水灾和饥荒，关心这个国家的每一个发言人在什么场合说了什么话，你查看昨天深夜球赛的结果，一个二线小明星的桃色八卦……然后你开始刷微博，背下来几段励志格言，学会了几句俏皮话，知道人们在围观什么热闹，又因为什么正感到愤怒。<br />
你沉溺在13亿人，不，甚至更多，你背负着70亿人的烦恼和快乐，好像永远都在事发现场。只要一个半小时，你已经胸有成竹：这世上的一切尽在掌握。<br />
09:00 邮件轰炸，或者轰炸邮件</p>
<p>有用的一天，以邮件来佐早餐。<br />
地铁口的便利店是你的早餐顾问，它们每天的特价产品就是你最科学的饮食搭配。你一边喝咖啡一边打开电脑——不要误会，喝咖啡绝对不是一种生活态度，它和某些夜晚必须吞服安眠药是一个原理。你已经很久没有遭遇过一个下午无所事事的咖啡馆，你甚至没勇气成为星巴克门口长队中的一员，现在，你只喝自己泡的速溶咖啡。<br />
你的邮箱里躺满了邮件，你发觉这世上到处都是更有用的人——他们总能比你睡得更晚、起得更早。你敲定了两个会议安排，修改了同事方案中几个不显眼的语法错误，帮你的老板订好了三天后的打折机票和酒店房间，然后驾轻就熟地写了封长信来抚慰一个愤怒的客户。<br />
另外一项调查报告说：早晨10点是人们打开邮箱的高峰期。你赶在新一波邮件到来之前，抢得先机把所有人统统轰炸了一遍，你的进阶目标是那些号称两小时内处理三四百封邮件的人，虽然你很担心他们会不会因此患上密集恐惧症。<br />
你顺手给那封同学会的邀请函回复：“下周我出差，择日再聚！”事实上，你已经有五年没有见过你的大学同学，这是你毕业的第六年。<br />
最后，你没忘记却给你的朋友留个言：“亲爱的，记得晚上约好的一起吃饭哦！”<br />
11：30 事事有攻略</p>
<p>有用的一天，你熟悉生活中的捷径。<br />
就像游戏达人沉迷于攻略一样，你在大众点评网的收藏里有超过50家餐厅的名单，你熟悉它们的地理位置和联系电话，同时在你的大脑收藏夹里有另一份人数更众的列表，你记得某一个客户喜欢日本料理，而另一个则偏爱意大利餐厅。你打电话预约了晚餐时间，指明一定要右走廊的第三个位置，你可不愿意成为这排队国奇迹中的一员，晚上七点还一脸尴尬地磕着发潮的瓜子。<br />
这城市比你的家乡更亲切，即便你从未穿梭在它的广场和小巷——衣食住行、吃喝玩乐，有关城市的一切都好好地躺在你的电脑里。你熟悉它们每一行即时更新的信息，胜过熟悉小区楼下的物管和保安——你认为他们那一口流利的方言，并不比外星语易懂多少。<br />
然后，你开始做你的午餐攻略。你的个人管理导师告诉你：做一个善于管理时间的人，要从控制自己开始。于是你只能控制你的饮食，你查询各种健康搭配和最新流行，再把附近餐馆的优惠券和特价套餐都比较一番。<br />
在等待外卖的时间里，你还有几个攻略需要浏览：时尚达人介绍的名人秋天搭配指南，星座运势建议的人际关系小提醒，科学人士提供的“提高工作效率六大准则”。<br />
13:00 在线视频里的人生偶像</p>
<p>有用的一天，和同事共进午餐绝对不是明智的选择。<br />
一本叫做《时间管理幸福学》的书中说：“一大群人坐在下午茶餐厅里无所事事地闲磨牙、聊八卦的情况，常让我觉得自己像只无头苍蝇，最后的收获只有口干舌燥而已。”<br />
你以此警戒自己。午餐时间的最佳选择是在线视频，当然你从不看那些无聊的恶搞视频或是偷拍录像。<br />
你最近青睐的是网络上的公开课，哈佛、耶鲁、剑桥、牛津和麻省理工，一个都不能错过。你听罗伯特·希勒谈房价和理财，听泰勒·本沙-哈尔教你如何变得更幸福，听欧文·辛格如讲讲爱情哲学，免不了再围观一下迈克尔·桑德尔谈一谈“什么是正义”。<br />
你最新一个偶像就在网络视频里——在TED上演讲的自闭学者丹尼尔·谭米特，他是两本畅销书作者，据说他一周就能掌握一门语言，可以背诵圆周率小数点后两万多位数字，被称为“人类自豪的天才特例”——你看，这才是符合你标准的：最有用的人。<br />
15:00 不要在下午三点登录社交网站</p>
<p>有用的一天，高潮在下午三点。<br />
萨特说过：下午三点钟是一天中一个很奇怪的时间，在这个时间开始做一件事总是觉得太早或太晚。<br />
在这个最尴尬的时间里，“不要在这个时间登录社交网站”——你的“职场达人准则”是这么说的——“一旦登录Twitter和Facebook之类的社交网站，不知不觉就开始刷新画面，不知不觉就写两句，不知不觉就开始聊天。这些‘不知不觉’非常浪费时间。”<br />
为了不浪费下午三点，你的一份企划书一直拖到了现在。在敲出第一个字之前，你又搜索了更多的攻略：“PPT演示之道”、“用信息图表说话”、“ 撰写商业计划书的详细步骤”以及“如何说服你的用户、老板或客户”。<br />
你浏览更多的帖子，企图解决你在这项工作中遇到的两个麻烦：第一，如何治好拖延症；第二，怎样才能成为一个有创意的人。最后，你还顺便看了看：“不用工作还能挣钱的十大方法。”<br />
17:15 请保证手机电量充足</p>
<p>有用的一天，必须保证包里随时装着手机充电器。<br />
你要赶在下班前，通过电话来解决一系列麻烦——<br />
你向快递公司咨询：“为什么应该在一小时前送到的快递，现在还杳无音信？”接着你得到了有生以来最强有力的客气回答：“十分抱歉，快递员失踪了，我们也联系不上！”<br />
你向清洁工阿姨咨询：“为什么我的进口柠檬汁没有了？”她迟疑了50秒，然后问你：“你说的是那瓶洗洁精吗？”在向你反复保证再不犯类似的错误后，你又努力说服她：“最好也不要把高级精油洗脸皂用来洗抹布，好吗？”<br />
你向航空公司咨询：“为什么三个月前退订的机票，现在也没收到退款？”“对不起，我们的系统故障，现在正在紧急维修中。”要知道，他们的紧急状态已经持续了三个月。<br />
最后，你不得不跟你的投资理财顾问大吵一架：“不要再跟我推荐任何免费午餐了！”<br />
你精疲力竭地吞掉一粒金嗓子喉宝，检查这一天还有什么漏掉的事情没有做。你想起来周末的MBA学习班，再次拿起电话去咨询管理经济学考试事宜，赶在手机爆掉之前，你还来得及跟你的驾校老师请一个假。<br />
19:00 一个司空见惯的饭局</p>
<p>有用的一天，不会在下班时间选择一辆出租车。<br />
你依然搭地铁。只要有过一次这样的经历——苦等50分钟时间才看到一辆亮着红灯的空车驶过，再搏斗1小时才能碰到门把手——你就知道选择这种交通工具并非明智之选。事实上，这个城市的出租车司机好似每时每刻都在交班路上，无处不在的师奶团比你的六块腹肌实在要勇猛得多。<br />
你预约好的晚餐没有给你带来任何麻烦，只是你有些搞不懂和你共进晚餐的究竟算是朋友还是工作伙伴。你们上一次见面是在某个发布会现场，而这一天最后端上来的大餐是某份合作方案的细节。你忙里偷闲发了短信敲定明天的饭局，这一年你在家吃饭的时间总共不超过三次。<br />
你的这位朋友在Say Goodbye的时候搞错了你的名字，却十分有礼貌地问候你家的宠物。事实上为了度过有用的一天，你从未养过任何活物。<br />
21:21 当你在看电视的时候你看些什么</p>
<p>有用的一天，看深夜剧不是一种娱乐。<br />
你看《红楼梦》，想从中学习企业治理方法；你看《西游记》，认真琢磨团队建设之道；你看《三国演义》，为的是偷师各种战略决策；你看《水浒传》，据说那是最好的领导艺术。所有的清宫戏和谍战剧都是你的职场教科书，你认为：要学几招腹黑学，还是得看大陆电视剧。<br />
认真的一天需要放松，你看几集TVB，学会了自我安慰：“做人呐，最重要是开心。”你看几集日剧，目的是要给自己打点鸡血：“我们需要的是活着的意志，朝着夕阳奔跑吧！”当然你还要看几集美剧，为下次和同事聊天争取发言权。<br />
自从电视上流行专家以来，你偶尔也看看这个时段的综艺节目，他们致力于帮你对付生活中最大的两个敌人——上司和女人。<br />
你很久不看文艺片，十分鄙视韩剧和动画，那些都是浪费时间的玩意。<br />
23:00 深夜读书方法论</p>
<p>有用的一天，提前一小时上床，这是你的读书时间。<br />
据说精英的年阅读量是300本至500本书籍，阿兰·德波顿同时要看10本书，而乔·昆南可以25本书一起读。为了尽早跻身他们中的一员，你的床头堆满了励志学、成功学和职场圣经。<br />
你读大前研一的“OFF学”，他告诉你：“下班后的生活，决定你的竞争力！”你决定像他所说的那样：只花一小时来阅读一本商业书籍，否则就是在谋杀生命。所以当你拿起柳井和正的《一胜九败》来，只苦心钻研优衣库的“23条经营理念”——23条理念，39条原则，47种方法论，这是你最擅长的条目式阅读。<br />
最近你在读的是：《高效能人士的七个习惯》、《时间管理圣经——番茄工作法》和《拖延心理学：向与生俱来的行为顽症宣战》。在那之前，为了让读书计划更有效率，你还读了《如何阅读一本书》和《如何谈论你没读过的书》。<br />
当然，你还读一点哲学。这和听古典音乐是同一个道理——要是在某个饭局上有人提起亚里士多德或者德彪西，很好，你知道他们在说什么。文学？坚决不碰，这玩意儿没有半点实用价值。<br />
0:00 养生时间</p>
<p>有用的一天，以养生结束。<br />
据说，在中国每6秒钟就有一人死于车祸，每10秒钟就有一人死于心血管病，每21秒钟就有一人死于中风，每1分钟就有两人死于吸烟引起的疾病，每3分钟就有一人死于胃癌，每12分钟就有一位女性死于乳腺癌……<br />
为了向你的健康喝彩，你必须学会养生。你的中医告诉你：“子时入睡、丑时保肝、寅时养肺。”你没听懂，他只好换了一种通俗易懂的方式：“每天在晚上12点就要睡觉，因为从12点到凌晨两点是退黑激素分泌最多，用来帮助身体细胞修复，若是错过这段时间，会导致疲劳到无法恢复。”<br />
于是你赶在12点前开完了一个短暂的电话会议，爬上微博道了一声“晚安”，你没忘记从你的年度计划表、月度计划表、每周计划表和每日计划表中抽出一张来，写下第二天的行程安排。<br />
明天早上起来，你会发现：福布斯富豪榜上依然没有你的名字。然后你就继续为“有用的一天”而努力，也就这样，既充实而又不浪费一分一秒地毁掉了你的一天。</p>
<p>&nbsp;</p>
<p>来源：新周刊</p>
<p>链接：<a href="http://www.neweekly.com.cn/index/newsview.php?id=3950" target="_blank">http://www.neweekly.com.cn/index/newsview.php?id=3950</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6185/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于郑州的记忆【音乐×视频】tudou</title>
		<link>http://www.am82.com/6181/</link>
		<comments>http://www.am82.com/6181/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 13:33:59 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[三八纯情]]></category>
		<category><![CDATA[视频]]></category>
		<category><![CDATA[郑州]]></category>
		<category><![CDATA[音乐]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6181</guid>
		<description><![CDATA[世界上最遥远的距离并非生与死，而是你在郑州，我却在驻马店。在未收到@南京李志 先生授权的情况下，葫芦屯影视中心顺应民心擅自制作了《关于郑州的记忆》MV，据悉，这款加长夜用MV不日将进驻国内各大夜总会，并被广电总局选送至戛纳电影节“一种注视”单元播放.........]]></description>
			<content:encoded><![CDATA[<p>世界上最遥远的距离并非生与死，而是你在郑州，我却在驻马店。在未收到@南京李志 先生授权的情况下，葫芦屯影视中心顺应民心擅自制作了《关于郑州的记忆》MV，据悉，这款加长夜用MV不日将进驻国内各大夜总会，并被广电总局选送至戛纳电影节“一种注视”单元播放&#8230;&#8230;&#8230;</p>
<p><embed src="http://www.tudou.com/v/PUb8ccDk3wc/&#038;resourceId=0_05_05_aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="480" height="400"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6181/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eric Clapton &#8211; Tears In Heaven</title>
		<link>http://www.am82.com/6178/</link>
		<comments>http://www.am82.com/6178/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 13:11:29 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[三八纯情]]></category>
		<category><![CDATA[视频]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6178</guid>
		<description><![CDATA[Eric Clapton - Tears In Heaven.......]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.tudou.com/v/3ebgEmGqOVY/&amp;resourceId=0_05_05_aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown/v.swf" /><param name="allowscriptaccess" value="always" /><param name="allowfullscreen" value="true" /><param name="wmode" value="opaque" /><embed width="480" height="400" type="application/x-shockwave-flash" src="http://www.tudou.com/v/3ebgEmGqOVY/&amp;resourceId=0_05_05_aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown/v.swf" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6178/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Art</title>
		<link>http://www.am82.com/6175/</link>
		<comments>http://www.am82.com/6175/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 08:17:31 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[浓咖啡]]></category>
		<category><![CDATA[诗]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6175</guid>
		<description><![CDATA[The art of losing isn't hard to master;
so many things seem filled with the intent
to be lost that their loss is no disaster.

Lose something every day. Accept the fluster
of lost.......]]></description>
			<content:encoded><![CDATA[<div>
<p id="aeaoofnhgocdbnbeljkmbjdmhbcokfdb-mousedown">The art of losing isn&#8217;t hard to master;<br />
so many things seem filled with the intent<br />
to be lost that their loss is no disaster.</p>
<p>Lose something every day. Accept the fluster<br />
of lost door keys, the hour badly spent.<br />
The art of losing isn&#8217;t hard to master.</p>
<p>Then practice losing farther, losing faster:<br />
places, and names, and where it was you meant<br />
to travel. None of these will bring disaster.</p>
<p>I lost my mother&#8217;s watch. And look! my last, or<br />
next-to-last, of three loved houses went.<br />
The art of losing isn&#8217;t hard to master.</p>
<p>I lost two cities, lovely ones. And, vaster,<br />
some realms I owned, two rivers, a continent.<br />
I miss them, but it wasn&#8217;t a disaster.</p>
<p>&#8211;Even losing you (the joking voice, a gesture<br />
I love) I shan&#8217;t have lied. It&#8217;s evident<br />
the art of losing&#8217;s not too hard to master<br />
though it may look like (*Write* it!) like disaster.</p>
<p>by Elizabeth Bishop</p>
</div>
<div></div>
<p>译者未知</p>
<p>失去的艺术<br />
失去的艺术并非难以掌握<br />
有太多的事情就算失去了<br />
其实也没有什么<br />
（我们）每天都会失去一些东西<br />
接受吧！<br />
弄丢钥匙的慌乱<br />
虚度光阴的不安<br />
失去的艺术并非难以掌握<br />
那么<br />
何不尝试更多、更快的损失<br />
住所、名声以及你所在意的一切<br />
去旅行<br />
失去它们并不会带来灾难</p>
<p>我遗失了我妈给我的手表，还不只这样！<br />
我最后的、在之前的，总共三栋我所热爱的房子都失去了<br />
失去的艺术并非难以掌握<br />
我失去了两个城市<br />
两个很漂亮的城市<br />
还有我曾拥有的广阔领土<br />
两条河流、一大块土地<br />
我很怀念<br />
但（想通了）其实这也没什么<br />
甚至会失去你（用我喜欢的手势与玩笑的态度说出）<br />
我也不该说谎<br />
很明显地，失去的艺术并非难以掌握<br />
尽管它或许看起来会像（写下它！）是一场灾难</p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6175/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安全科普:加密不是安全的一切</title>
		<link>http://www.am82.com/6172/</link>
		<comments>http://www.am82.com/6172/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 15:53:53 +0000</pubDate>
		<dc:creator>假装纯情</dc:creator>
				<category><![CDATA[挨踢消息]]></category>
		<category><![CDATA[加密]]></category>
		<category><![CDATA[安全加密]]></category>

		<guid isPermaLink="false">http://www.am82.com/?p=6172</guid>
		<description><![CDATA[搞数学的往往迷信于只需要加密与算法就能解决一切安全问题.可事实是攻击者并不是在算法层和你对抗,代码,实现,逻辑和协议流程,配置,意识的漏洞无所不在.比如在网上经常看到一些对加密算法比较了解的人,觉得在公开接入的无线环境下通过HTTPS协议可以确保安全的看法就是如此.现有的网络协议,基本上实施中间人比较容易,同名欺骗/ARP欺骗/DHCP欺骗都可以做到在客户端实施中间人,还有通过邮件/IM/WEB等方式实施中间人.且不说加密协议的加密算法强度如何不可攻破,随便说几种攻击可能:

1)基本所有HTTPS站点都........]]></description>
			<content:encoded><![CDATA[<p>安全科普:加密不是安全的一切</p>
<p>Flashsky</p>
<p>http://hi.baidu.com/fs_fx/blog/item/2db7e9d64c63fdc2a144df95.html?timeStamp=1330333861914</p>
<p>       搞数学的往往迷信于只需要加密与算法就能解决一切安全问题.可事实是攻击者并不是在算法层和你对抗,代码,实现,逻辑和协议流程,配置,意识的漏洞无所不在.比如在网上经常看到一些对加密算法比较了解的人,觉得在公开接入的无线环境下通过HTTPS协议可以确保安全的看法就是如此.现有的网络协议,基本上实施中间人比较容易,同名欺骗/ARP欺骗/DHCP欺骗都可以做到在客户端实施中间人,还有通过邮件/IM/WEB等方式实施中间人.且不说加密协议的加密算法强度如何不可攻破,随便说几种攻击可能:</p>
<p>      1)基本所有HTTPS站点都很少是直接HTTPS,用户习惯大多是通过站点主页点选或通过搜索引擎点选上去的.这些页面并非HTTPS而是明文可直接篡改的.中间人直接篡改这些页面指向HTTPS的URL到自己的钓鱼站点,放置自己证书,模拟正常页面行为,可以窃取用户敏感信息,劫持用户操作.</p>
<p>      2)如果直接通过HTTPS URL访问而且所有资源都使用HTTPS,但是服务器端证书首先是通过明文下载到客户端,攻击者可以实施中间人替换自己的证书到客户端然后实施劫持.当然浏览器端会有提示但大多数普通用户不会注意到直接会确认.</p>
<p>      3)另外网银客户端网盾主要用于签名关键交易.如果自身处理设计不好,一是没有防范回放攻击.二是一些交易要素可能并没有签名.比如我们实施安全测试服务的一家手机充值支付厂商就没有对手机号做签名.中间人篡改手机号后可以修改充值到别的手机上实施交易.</p>
<p>     4)HTTPS协议的实现也可能存在很多问题.协议过程实现的问题可以参考技术文档:关于BEAST攻击http://icylife.net/yunshu/show.php?id=814  还有分组加密的算法实现也可能导致一些问题,例如参考文档http://hi.baidu.com/aullik5/blog/item/7e769d2ec68b2d241f3089ce.html和http://www.icylife.net/yunshu/attachments/Padding-Oracle-Attack.pdf</p>
<p>     5)代码自身的安全漏洞,有客户端证书的应用需要实现浏览器本身不支持的功能,大都采用了ACTIVEX控件这样的技术,在我们的测试中,这些控件大多存在安全漏洞.2010年我们测试国内提供证书用于金融交易处理的activex组件,70%都存在本地文件创建漏洞,攻击者直接可以种马到客户端.加密算法再坚固一万倍又如何?就算加密算法和加密实现都无懈可击,可他也最多只能保证信息在传输和存储时的安全,用于处理和使用信息的程序自身不安全也是白搭,所谓皮之不存毛之焉附,强调加密算法安全没错,但以为这就万事大吉了,就能让攻击者成本高于攻击收益了,只能说太天真了.</p>
<p>      安全不是想的这么简单的事,被黑客远程成功入侵的防护严密的重要客户不少,如GOOGLE,SYSMENTEC,伊朗物理隔离的核电站,美国能源部,美国国防军火承包商,花旗银行等等,连他们都不能幸免.如果只靠加密算法就能保证安全,也不会连RSA这种以加密产品著称的顶级公司于2011年3月份也被APT攻击入侵,用于多个重要部门的高端加密产品SecureID的加密种子都被窃取,当时RSA还不肯承认损害(http://security.zdnet.com.cn/security_zone/2011/0321/2023153.shtml),直到导致使用SecureID产品的重要客户也被入侵才承认(http://www.cnbeta.com/articles/145118.htm).之后RSA彻底研究了APT攻击之后写出了<当APT成为主流>的报告在2011年的RSA大会上发布,得出甚至比我们都还悲观的结论:认为APT入侵当前防护体系不可能防住,强调以后要侧重被入侵之后能及时发现的能力,因此企业防护策略也要调整不再强调全面保护而是收缩只防护重点资产等(中文简单介绍http://yepeng.blog.51cto.com/3101105/631387<br />
英文原文http://www.rsa.com/innovation/docs/SBIC_RPT_0711.pdf)</p>
<p>     美国已经将网络划为第5空间,将网络安全战略已上升成国家安全战略,截止2008年美国因为网络安全导致的被窃取的信息资产损失达1万亿美圆,国土安全部在招聘启事中提出, 申请者应能够“像恶意攻击者那样思考”,同时掌握黑客的常用技术,熟悉网络运行原理并能迅速判断政府网络系统的“薄弱之处”(http://wenku.baidu.com/view/fa18afb069dc5022aaea00e7.html).可见系统的“薄弱之处”才是IT系统面临的最大的安全问题而不仅仅只是加密算法强度的问题.</p>
<p>      当然,如何降低安全成本又能大幅度提高攻击者成本同时还要尽量减少用户的易用性损失是安全必须要考虑的,但当前的现实是,单纯依靠加密类产品,并没有很大幅度提高攻击者成本,精通数学的黑客并不多,但能找到安全漏洞的人相对就多多了,而且这些漏洞在我们应用中比比皆是,攻击者不需要付出不可承受的成本就能找到,就无须去从解密上去对抗算法.</p>
<p>    安全行业肩负的使命还很重,要走的路还很长</p>
]]></content:encoded>
			<wfw:commentRss>http://www.am82.com/6172/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

