响应我党号召,全面建设和谐博客,坚持和谐写博的路线不动摇
<?php $ua = $_SERVER[’HTTP_USER_AGENT’]; if (stristr($ua, ‘msnbot’) || stristr($ua, ‘googlebot’)) { //it’s pretending to be MSN’s bot or Google’s bot $ip = $_SERVER[’REMOTE_ADDR’]; $hostname = gethostbyaddr($ip); if(!preg_match("/\.googlebot\.com$/", $hostname) && !preg_match("/search\.live\.com$/", $hostname)){ //the hostname does not belong to either live.com or googlebot.com. //Remember the UA already said it is either MSNBot or Googlebot. //So it’s a [...]
wc -l `find trunk|grep .php|grep -v .svn`
机房有机器中毒,发arp包,通过arpspoof虽然可以解决,也可以找到中毒机器的mac地址,但在机房设备不足的情况下,很难查到mac地址对应的IP。 然后我们可以通过一个循环,使用arping来对整个子网下面的机器发一个包,这样就可以在arp下面查看到相应的mac缓存,进而得到对应的IP地址。 #!/bin/sh for ((i = 1; i < 254; i++)) do arping -I eth0 192.168.1.$i -c 1 done arp -a > mac_table 脚本跑完后,查看当前目录生成的mac_table。
相信用Mac、Linux的朋友都有加密文件的需要,但这些系统下面并不一定能找到比较好而且还是免费的加密软件。今天就介绍一个所有Mac、linux系统都自带的软件:openssl。 openssl包括了大量的对称、非对称、摘要等加密算法,我们可以选用对称算法对文件进行加密,比如3DES。 比如我们要对test.tar.bz2进行加密,那么我们可以使用下面的方法 $ openssl des3 -salt -in test.tar.bz2 -out test.tar.bz2.des3 其中-in是输入文件,-out是加密后输出的文件 之后会提示你输入一个用于加密的密钥,输入一个自己能记住的密码 enter des-ede3-cbc encryption password: Verifying – enter des-ede3-cbc encryption password: 然后我们可以试试加密后的文件是否可以打开 $ tar jxvf test.tar.bz2.des3 bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2 tar: Error exit delayed from previous errors 嗯。。。可以确认文件被成功加密了。 我们试试把文件解密 $ openssl des3 -d -salt -in [...]