序言

前面搞 使用Sublime Text2来编辑Evernote(印象笔记) 发现st2的插件只能增加笔记,不能修改什么的,必须的st3

强烈的想用sublime text 用markdown书写文章,笔记什么的,顺便同步保存evernote

把用了1年多的sublime text2升级到了sublime text3最新版

Sublime text3安装插件 Evernote

安装支持插件

Preferences -> Package Control:Install Package ->  evernote

获得evernote api接口 Developer Tokens

Preferences -> Package Settings ->  Evernote -> Reconfigure Authorization

会在浏览器中打开 https://www.evernote.com/api/DeveloperToken.action

如果是中国区 印象笔记用户请直接打开  https://app.yinxiang.com/api/DeveloperToken.action

申请好Token

插件 Evernote配置

Preferences -> Package Settings ->  Evernote -> Settings – User

20141101173120

 

保存后就可以使用了

在Sublime Text3中用MarkDown写文章同步到Evernote

Tools -> Command Palette  -> evernote

20141102110030

 

更多使用说明请看

https://sublime.wbond.net/packages/Evernote

 

安装插件

sublime text2 安装插件 sublimeevernote

Preferences -> Package Control:Install Package ->  sublimeevernote

Tools -> Command Palette  -> Send to evernote  (PS:如果没有,就把sublime text2重启下)

20141101143516

Evernote api授权

20141101143657

复制网址到浏览器打开

(ps:如果是国内 印象笔记用户 ,把网址 www.evernote.com 换成 app.yinxiang.com)

授权后会回调到

http://127.0.0.1/?oauth_token=oparrish-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&oauth_verifier=25532B383E0Exxxxxxxxxxxxxx&sandbox_lnb=false

找到oauth_verifier=25532B383E0Exxxxxxxxxxxxxx

认证代码为:25532B383E0Exxxxxxxxxxxxxx

输入sublime text2中回车

20141101144452

现在就可以使用 send to evernote了

后话:

你妹的,搞完了才发现 只有 send to evernote啊!!!!!

st3才有Update Evernote Note,Open Evernote Note

要不要升级st3,插件是否兼容呢~~~

囧`

 

简介

在Vmware ESXI中安装群晖Synology DSM 5.0 (4528)

文件准备

Vmware ESXi用户安装需要的文件

  1. NB_x64_5032_DSM_50-4528_Xpenology_nl.rar
  2. DSM_DS3612xs_4528.pat   (Synology DSM 5.0 (4528) 2014年10月30日 最新)
  3. SynologyAssistantSetup-5.0-4448.exe  (群晖管理工具)

百度网盘链接: http://pan.baidu.com/s/1gdioUDP 密码: 2k6f

文件说明:

NB_x64_5032_DSM_50-4528_Xpenology_nl.rar 引导系统,用于引导群晖dsm系统,已经做成vmdk虚拟机磁盘

Synology DSM 5.0 (4528)群晖系统

开始安装

1、登录vSphere client

文件->新建->虚拟机

自定义->”取名字比如(NAS-DSM)”->选存储器->选虚拟机版本8->客户端操作系统(Ubuntu Linux 64位)->

cpu->内存 分配内存大小->网络 (网卡注意选适配器一定要选E1000)->SCSI控制器(VMware 准虚拟)->

选择磁盘(创建新的虚拟磁盘)->创建磁盘(设置容量等)->高级选项-> 完成 虚拟机NAS-DSM 备用

2、上传NB_x64_5032_DSM_50-4493_Xpenology_nl.rar 到ESXi的数据存储 上

解压 NB_x64_5032_DSM_50-4528_Xpenology_nl.rar

的到文件 NB_x64_5032_DSM_50-4528_Xpenology_nl.vmdk、 NB_x64_5032_DSM_50-4528_Xpenology_nl-flat.vmdk

在ESXi 的 配置->存储器-> 找到 虚拟机NAS-DSM目录

把 NB_x64_5032_DSM_50-4528_Xpenology_nl.vmdk、 NB_x64_5032_DSM_50-4528_Xpenology_nl-flat.vmdk上传上去

 

3、编辑虚拟机NAS-DSM

 

硬件->添加->硬盘->使用现有的虚拟磁盘->磁盘文件路径(选取 上传的文件)

4、启动虚拟机NAS-DSM

选择Nanoboot (5.0.3.2) DSM 5.0-4528 Install/Upgrade

安装SynologyAssistantSetup-5.0-4448.exe

20141030134543

SynologyAssistant 搜索安装 群晖

 

右键->安装->选择DSM_DS3612xs_4528.pat->设置密码 设置服务器名->设置网络ip

20141030135336

 

esxi运行群晖

esxi运行群晖

 

升级到DSM 5.0-4528 Update 1

DSM 5.0-4528叫做大版本,Update 1 Update 2叫做小版本.

小版本可以在 控制面板->更新和还原 直接更新

SYNOLOGY DSM 5.x升级方法

 从刚刚安装的DSM 5.0-4493 升级到 DSM 5.0-4528 (最新版2014年10月30日)

在web管理界面中

控制面板->终端机和 SNMP->启动 SSH 功能 打勾 ->应用

用ssh管理工具登录dsm nas的 ssh终端

控制面板->更新和还原->下载新版本 (这里关键一步,不要点 立即更新,只下载不更新,一定要下载完成)

回到ssh 终端->敲入2行命令,回车执行

sed 's/flashupdateDeb/flashupdateDeb1/' /autoupd@te.info > /autoupd@te.info1
mv /autoupd@te.info1 /autoupd@te.info

 回到控制面板->点击 立即更新

 

 

参考文献

http://cyanlabs.net/Thread-Install-Synology-DSM-5-0-4493-ESXi-Non-ESXI

http://xpenology.me/category/how-to/

XPEnoboot http://xpenology.me/downloads/

检查是否有 linux bash的ShellShock系列漏洞

ShellShock系列漏洞包含有

CVE-2014-6271

CVE-2014-7169

CVE-2014-7186

CVE-2014-7187

CVE-2014-6277

CVE-2014-6278

 

检查是否有ShellShock系列漏洞

wget --no-check-certificate  https://github.com/hannob/bashcheck/raw/master/bashcheck;sh bashcheck

有漏洞显示为

shellshock20141011151023

 

检查方式任选1

检查方式1

在 bash 中输入如下命令可以检测是否受影响:如果显示You are vulnerable,很遗憾,必须立即打上安全补丁修复

env t='() { :;}; echo You are vulnerable.' bash -c "true"

检查方式2

在 bash 中输入如下命令可以检测是否受影响:如输出 vulnerable,很遗憾,必须立即打上安全补丁修复

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

 

修复bash ShellShock系列漏洞

包管理器更新bash版本即可

yum -y update bash;/sbin/ldconfig;rpm -qa -changelog bash  | grep "2014"

修复后检查

sh bashcheck

 

shellshock20141011151102

参考

Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271)

Resolution for Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271) in Red Hat Enterprise Linux

CVE-2014-6271: remote code execution through bash

Bash 远程任意代码执行安全漏洞(最严重漏洞)

#陆续更新中
#iproute2 介绍
iproute2是一个linux下管理控制 TCP/IP 网络和流量控制的工具包,用以替代老的arp、ifconfig、route。目前由 Stephen Hemminger <shemminger@osdl.org>维护,原作者为Alexey Kuznetsov,原作者是linux内核中Qos实现作者。   

继续阅读

流传的移除XSS攻击的php函数

The goal of this function is to be a generic function that can be used to parse almost any input and render it XSS safe. For more information on actual XSS attacks, check out http://ha.ckers.org/xss.html. Another excellent site is the XSS Database which details each attack and how it works.

<?php
/**
 * Usage: Run *every* variable passed in through it.
 * The goal of this function is to be a generic function that can be used to
 * parse almost any input and render it XSS safe. For more information on
 * actual XSS attacks, check out http://ha.ckers.org/xss.html. Another
 * excellent site is the XSS Database which details each attack and how it
 * works.
 *
 * Used with permission by the author.
 * URL: http://quickwired.com/smallprojects/php_xss_filter_function.php
 *
 * License:
 * This code is public domain, you are free to do whatever you want with it,
 * including adding it to your own project which can be under any license.
 *
 * $Id: RemoveXSS.php 2663 2007-11-05 09:22:23Z ingmars $
 *
 * @author	Travis Puderbaugh <kallahar@quickwired.com>
 * @package RemoveXSS
 */
class RemoveXSS {

	/**
	 * Wrapper for the RemoveXSS function.
	 * Removes potential XSS code from an input string.
	 *
	 * Using an external class by Travis Puderbaugh <kallahar@quickwired.com>
	 *
	 * @param	string		Input string
	 * @return	string		Input string with potential XSS code removed
	 */
	function RemoveXSS($val)	{
		// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed
		// this prevents some character re-spacing such as <java\0script>
		// note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some inputs
		$val = preg_replace('/([\x00-\x08][\x0b-\x0c][\x0e-\x20])/', '', $val);

		// straight replacements, the user should never need these since they're normal characters
		// this prevents like <IMG SRC=&#X40&#X61&#X76&#X61&#X73&#X63&#X72&#X69&#X70&#X74&#X3A&#X61&#X6C&#X65&#X72&#X74&#X28&#X27&#X58&#X53&#X53&#X27&#X29>
		$search = 'abcdefghijklmnopqrstuvwxyz';
		$search.= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
		$search.= '1234567890!@#$%^&*()';
		$search.= '~`";:?+/={}[]-_|\'\\';

		for ($i = 0; $i < strlen($search); $i++) {
			// ;? matches the ;, which is optional
			// 0{0,7} matches any padded zeros, which are optional and go up to 8 chars

			// &#x0040 @ search for the hex values
			$val = preg_replace('/(&#[x|X]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ;
			// &#00064 @ 0{0,7} matches '0' zero to seven times
			$val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;
		}

		// now the only remaining whitespace attacks are \t, \n, and \r
		$ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');
		$ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');
		$ra = array_merge($ra1, $ra2);

		$found = true; // keep replacing as long as the previous round replaced something
		while ($found == true) {
			$val_before = $val;
			for ($i = 0; $i < sizeof($ra); $i++) {
				$pattern = '/';
				for ($j = 0; $j < strlen($ra[$i]); $j++) {
					if ($j > 0) {
						$pattern .= '(';
						$pattern .= '(&#[x|X]0{0,8}([9][a][b]);?)?';
						$pattern .= '|(&#0{0,8}([9][10][13]);?)?';
						$pattern .= ')?';
					}
					$pattern .= $ra[$i][$j];
				}
				$pattern .= '/i';
				$replacement = substr($ra[$i], 0, 2).'<x>'.substr($ra[$i], 2); // add in <> to nerf the tag
				$val = preg_replace($pattern, $replacement, $val); // filter out the hex tags
				if ($val_before == $val) {
					// no replacements were made, so exit the loop
					$found = false;
				}
			}
		}

		return $val;
	}
}

?>

 

Discuz系统中 防止XSS漏洞攻击,过滤HTML危险标签属性的PHP函数

//屏蔽html
function checkhtml($html) {
	$html = stripslashes($html);
	if(!checkperm('allowhtml')) {

		preg_match_all("/<([^<]+)>/is", $html, $ms);

		$searchs[] = '<';
		$replaces[] = '<';
		$searchs[] = '>';
		$replaces[] = '>';

		if($ms[1]) {
			$allowtags = 'img|a|font|div|table|tbody|caption|tr|td|th|br
						|p|b|strong|i|u|em|span|ol|ul|li|blockquote
						|object|param|embed';//允许的标签
			$ms[1] = array_unique($ms[1]);
			foreach ($ms[1] as $value) {
				$searchs[] = "<".$value.">";
				$value = shtmlspecialchars($value);
				$value = str_replace(array('\','/*'), array('.','/.'), $value);
				$skipkeys = array(
						'onabort','onactivate','onafterprint','onafterupdate',
						'onbeforeactivate','onbeforecopy','onbeforecut',
						'onbeforedeactivate','onbeforeeditfocus','onbeforepaste',
						'onbeforeprint','onbeforeunload','onbeforeupdate',
						'onblur','onbounce','oncellchange','onchange',
						'onclick','oncontextmenu','oncontrolselect',
						'oncopy','oncut','ondataavailable',
						'ondatasetchanged','ondatasetcomplete','ondblclick',
						'ondeactivate','ondrag','ondragend',
						'ondragenter','ondragleave','ondragover',
						'ondragstart','ondrop','onerror','onerrorupdate',
						'onfilterchange','onfinish','onfocus','onfocusin',
						'onfocusout','onhelp','onkeydown','onkeypress',
						'onkeyup','onlayoutcomplete','onload',
						'onlosecapture','onmousedown','onmouseenter',
						'onmouseleave','onmousemove','onmouseout',
						'onmouseover','onmouseup','onmousewheel',
						'onmove','onmoveend','onmovestart','onpaste',
						'onpropertychange','onreadystatechange','onreset',
						'onresize','onresizeend','onresizestart',
						'onrowenter','onrowexit','onrowsdelete',
						'onrowsinserted','onscroll','onselect',
						'onselectionchange','onselectstart','onstart',
						'onstop','onsubmit','onunload','javascript',
						'script','eval','behaviour','expression',
						'style','class'
					);
				$skipstr = implode('|', $skipkeys);
				$value = preg_replace(array("/($skipstr)/i"), '.', $value);
				if(!preg_match("/^[/|s]?($allowtags)(s+|$)/is", $value)) {
					$value = '';
				}
				$replaces[] = empty($value)?'':"<".str_replace('"', '"', $value).">";
			}
		}
		$html = str_replace($searchs, $replaces, $html);
	}
	$html = addslashes($html);

	return $html;
}