October 3rd, 2009 | Tags:

今天实验室里上网感觉不大对劲, 总是打不开网页, 怀疑有 ARP 病毒作祟, 就用 arp 命令查看了一下 ARP Entries, 结果如下:

C:\>arp -d & arp -a
接口: x.x.x.23 — 0xb
Internet 地址 物理地址 类型
x.x.x.1 00-15-f2-61-9d-fd 动态

C:\>arp -d & arp -a
未找到 ARP 项。

C:\>arp -d & arp -a
接口: x.x.x.23 — 0xb
Internet 地址 物理地址 类型
x.x.x.1 00-15-f2-61-9d-fd 动态

C:\>arp -d & arp -a
接口: x.x.x.23 — 0xb
Internet 地址 物理地址 类型
x.x.x.1 00-e0-fc-17-ea-78 动态

可以看到网关对应了两个 MAC 地址, 这其中至少有一个是病毒机. 我把两个地址都记录下来, 对实验室里所有正在运行的机子都挨个排查, 最终确定了“毒源”。

September 7th, 2009 | Tags:

今天对自制的绿色版 Dr.Web 升级,发现屡次升级都失败,提示找不到服务器。检查网络连接,正常;检查 C:\Windows\System32\Drivers\Etc\Hosts 文件,正常;nslookup 查询 Dr.Web 服务器正常;ping Dr.Web 服务器失败(见下文);重置 WinSock ,故障依旧。初步判断是因为系统感染了劫持本地 DNS 的病毒所致,于是便有了下面的杀毒历程。

先 Show 一下奇怪的现象(1.1.1.1 为虚假地址,真实地址正常)

C:\>ipconfig /all
Windows IP Configuration #经检查,所有参数都正常
Host Name . . . . . . . . . . . . : NoteBook
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-14-78-10-24-XX
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 1.1.1.1
Subnet Mask . . . . . . . . . . . : 1.1.1.1
Default Gateway . . . . . . . . . : 1.1.1.1
DHCP Server . . . . . . . . . . . : 1.1.1.1
DNS Servers . . . . . . . . . . . : 1.1.1.1
1.1.1.1
Lease Obtained. . . . . . . . . . : 2009年9月6日 21:42:56
Lease Expires . . . . . . . . . . : 2009年9月7日 1:42:56

C:\>nslookup www.google.com
Server: 1.1.1.1
Address: 1.1.1.1
Name: www.l.google.com
Addresses: 64.233.189.103, 64.233.189.104, 64.233.189.147, 64.233.189.99
Aliases: www.google.com
C:\>Pinging www.l.google.com [64.233.189.147] with 32 bytes of data:
Reply from 64.233.189.147: bytes=32 time=46ms TTL=239
Reply from 64.233.189.147: bytes=32 time=51ms TTL=239
Reply from 64.233.189.147: bytes=32 time=66ms TTL=239
Reply from 64.233.189.147: bytes=32 time=72ms TTL=239
Ping statistics for 64.233.189.147:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 46ms, Maximum = 72ms, Average = 58ms

C:\>nslookup www.kaspersky.com
Server: 1.1.1.1
Address: 1.1.1.1
Name: www.kaspersky.com
Address: 195.27.181.10
C:\>Ping www.kaspersky.com
Ping request could not find host www.kaspersky.com. Please check the name and try again.

C:\>nslookup www.kaspersky.com.cn
Server: 1.1.1.1
Address: 1.1.1.1
Name: www.kaspersky.com.cn.fastcdn.com
Addresses: 58.198.42.10, 58.198.42.11, 58.198.42.8, 58.198.42.9
Aliases: www.kaspersky.com.cn
C:\>Ping www.kaspersy.com.cn
Ping request could not find host www.kaspersky.com.cn. Please check the name and try again.

C:\>nslookup www.drweb.com
Server: 1.1.1.1
Address: 1.1.1.1
DNS request timed out.
timeout was 2 seconds.
Name: boss.drweb.com
Address: 87.242.72.150
Aliases: www.drweb.com
C:\>Ping www.drweb.com
Ping request could not find host www.drweb.com. Please check the name and try again.

C:\>nslookup www.drweb.com.cn
Server: 1.1.1.1
Address: 1.1.1.1
Name: www.drweb.com.cn
Address: 60.217.32.246
C:\>ping www.drweb.com.cn
Ping request could not find host www.drweb.com.cn. Please check the name and try again.

C:\>nslookup www.rising.com.cn
Server: 1.1.1.1
Address: 1.1.1.1
Name: www.rising.com.cn
Addresses: 211.103.159.89, 219.238.233.203
C:\>Ping www.rising.com.cn
Ping request could not find host www.rising.com.cn. Please check the name and try again.

C:\>nslookup www.pandasecurity.com
Server: 1.1.1.1
Address: 1.1.1.1
DNS request timed out.
timeout was 2 seconds.
Name: a1331.b.akamai.net
Addresses: 61.200.81.150, 61.200.81.142
Aliases: www.pandasecurity.com, pandasecurity.com.edgesuite.net
C:\>ping www.pandasecurity.com
Ping request could not find host www.pandasecurity.com. Please check the name and try again.

先找出 Autoruns ,发现如下异常项目

HKLM\System\CurrentControlSet\Services
Nla 收集并保存网络配置和位置信息,并在信息改动时通知应用程序。 (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
HKLM\System\CurrentControlSet\Services\WinSock2\Parameters\NameSpace_Catalog5\Catalog_Entries
Tcpip Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
网络位置知晓 (NLA) 名称空间 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
HKLM\System\CurrentControlSet\Services\WinSock2\Parameters\Protocol_Catalog9\Catalog_Entries
000000000001 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000002 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000003 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000004 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000005 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000006 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000007 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000008 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
000000000009 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000010 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000011 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000012 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000013 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000014 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000015 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000016 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000017 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000018 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000019 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000020 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll
0000000000021 Microsoft Windows Sockets 2.0 Service Provider (Not verified) Microsoft Corporation c:\windows\system32\mswsock.dll

用 Process Explorer 查看进程并查询该模块,得到如下结果

mswsock.dll 注入进程

mswsock.dll 注入进程

把 c:\windows\system32\mswsock.dll 这个文件上传至 VirScan.ORG 扫描,得出结果如下

mswsock.dll 的扫描结果

mswsock.dll 的扫描结果

现在基本上已经确定了它是一个病毒,剩下的事情就好办多了。基本杀毒过程如下:
1,删除 c:\windows\system32\dllcache\mswsock.dll 和 c:\windows\system32\mswsock.dll 。此病毒的反删除能力很弱,直接使用 del 命令即可。记住要同时删除这两个文件,否则病毒还会死灰复燃。
2,在 Autoruns 里删除上述注册表项。
3,重新从 Windows 安装光盘里复制正常的 mswsock.dll 到 C:\Windows\System32 目录下
4,重新安装 Tcp/IP 协议

系统终于恢复正常了。

重启后,电脑恢复正常,无论是 Dr.Web 升级还是 Ping 那些杀毒软件的官方地址,都没有任何问题了。

相关链接
如何在 Windows XP 中重置 Internet 协议 (TCP/IP)

September 5th, 2009 | Tags:

今天想写一个批处理文件,其功能是从一个指定的 Ftp 服务器上把某个目录下的所有文件都下载下来,结果发现遇到个难题。

我本来是这样写的

C:>cat Batch.bat
@echo off && @color 0A & cls
ftp 1.1.1.1
cd /pub/files/
mget *.*

一运行,发现批处理运行到 ftp 1.1.1.1 这条命令后就出现了要求输入用户名和密码的提示。刚开始尝试替换为如下形式

ftp -a 1.1.1.1
ftp USERNAME:PASSWORD@1.1.1.1
ftp ftp://USERNAME:PASSWORD@1.1.1.1#匿名时用户名为 anonymous ,密码为空

均告失败。其中第一条的 -a 参数无效(*nix 系统中 -a 表示匿名访问,Windows 中不是),第二条和第三条报告 Unknown Host 错误。

后来在 http://technet.microsoft.com 中找到了官方的 Ftp 命令帮助页面,内容如下

ftp [-v] [-d] [-i] [-n] [-g] [-s:FileName] [-a] [-w:WindowSize] [-A] [Host]

Parameters
-v : Suppresses the display of FTP server responses.
-d : Enables debugging, displaying all commands passed between the FTP client and FTP server.
-i : Disables interactive prompting during multiple file transfers.
-n : Suppresses the ability to log on automatically when the initial connection is made.
-g : Disables file name globbing. Glob permits the use of the asterisk (*) and question mark (?) as wildcard characters in local file and path names. For more information, see Ftp: Glob
-s: FileName : Specifies a text file that contains ftp commands. These commands run automatically after ftp starts. This parameter allows no spaces. Use this parameter instead of redirection (< ).
-a : Specifies that any local interface can be used when binding the FTP data connection.
-w: WindowSize : Specifies the size of the transfer buffer. The default window size is 4096 bytes.
-A : Logs onto the FTP server as anonymous.
Host : Specifies the computer name, IP address, or IPv6 address of the FTP server to which to connect. The host name or address, if specified, must be the last parameter on the line.
/? : Displays help at the command prompt.

发现两个问题:
1,-a 指的是 interface,真难理解,难道是指定网卡或网络连接?
2,-A 才是匿名访问
3,Ftp 命令专门提供了一个 -s:FileName 参数以便登录进入服务器之后调出使用。

现在好办了,原批处理文件内容修改如下

C:>cat Batch.bat
@echo off && @color 0A & cls
ftp -A 1.1.1.1
cd /pub/files/
mget *.*

再运行一次,好了,顺利登录,但登录进入服务器之后没有自动运行后两条命令,这好办,利用 -s 命令即可。先在同目录下创建一个文本文件,文件名取为 commands.ini(与文件后缀无关),内容如下

C:>cat commands.ini
cd /pub/files
mget *.*

然后,把 Batch.bat 文件修改如下

C:>cat Batch.bat
@echo off && @color 0A & cls
ftp -s:commands.ini 1.1.1.1

再次运行之后,基本上达到了预期的目标,后来再经改进,版本如下

C:>cat Batch.bat
@echo off && @color 0A & cls
start ftp -s:commands.ini 1.1.1.1 #用 start 命令把 Ftp 动作给 fork 出来,以便继续执行下面的命令
OTHER LOCAL COMMANDS #任意本地命令
C:>cat commands.ini
USERNAME #只写用户名,不能再前面加 user 命令
PASSWORD #如果密码为空,则此行为空;必须保留这一行
cd /pub/files
prom #关闭提示,否则 mget 每次下载文件前都要手工判断 YES or NO
mget *.*

注意
此处的 cat 命令等同于 type 命令
“#” 号是注释符,仅供阅读方便

相关链接
Ftp

August 5th, 2009 | Tags:

只需要将 C:\WINDOWS\system32\Macromed\Flash\NPSWF32.dll 分别复制到 %OperaDIR%\program\plugins 和 %ChromeDIR%\chorme\plugins\ 目录下,分别重启两个浏览器即可。

相关链接
Opera@USB Homepage
Portable Google Chrome

August 3rd, 2009 | Tags:

AlwaysSync 和 SyncBack 等软件,搞不定其自动备份功能,还是回归到了 AutoVer。

软件界面:

AutoVer 软件界面

AutoVer 软件界面

软件基本信息:

软件大小: 261 KB
软件类别: 国外软件 / 系统备份
软件语言: 英文
授权方式: 免费软件
官方主页: http://beanland.net.au/AutoVer
运行环境: Win9X/Win2000/WinXP/Win2003/windows vista/
额外要求: .NET Framework V2.0

软件官方简介:

AutoVer is a configurable automatic or real time backup and personal versioning system. It can be used as a simple real time backup or as a more complex, but transparent version control system (like a realtime incremental backup). The beauty of this system is that once you set it up (which is extremely simple) it does everything. No remembering to backup or to check in or check out files. Every time you save a file it is copied to your backup folder or drive. You can include and exclude certain files and browse the backups with the Backup Explorer.
Great for backing up (or one way syncronising) your work or home documents to flash memory or saving every change you make to your source code or image files.

软件特点官方介绍:

Select any number of separate folders or folder trees (including sub folders) to watch for changes – each folder tree has its own independent settings
Select straight backup or versioning mode
Select any folder or drive to backup to (including memory sticks)
Optionally create an initial backup before the automatic backup starts and ensure it is current on every startup
Restrict which files and folders to include and exclude (by file mask) & maximum size
Change the versioning datetime stamp format (and you can use this to restrict the rate of which the versions are stored)
Optionally zip or delete old versions after a specified time
Optionally delete backup files on original file deletion
Fault tolerance in case your backup folder/drive goes off line or source files are locked. USB & Firewire drives sync’ed when they come online
MS Office, Visual Studio plus many others supported (temp file creation, delete then rename is treated as original file change)
Backup file & version explorer included
Open backups or file versions directly (file extensions are preserved) or via inbuilt explorer
Compare file versions (using customisable external application)
Restore file versions via inbuilt explorer or manually
Runs discretely in the Windows System Tray

推荐安装方式:
1, 到 http://www.jz5u.com/Soft/system/patch/12697.html 下载 .NET Framework 2.0 绿色版,按照使用说明安装。
2, 到 http://www.cngr.cn/dir/208/239/2008121936580.html 下载 AutoVer 绿色版。

应用举例(备份指定 QQ 号码资料):
1,在 General 选项卡设置备份基本信息,包括 Job Name 和原始文件夹以及目标文件夹。

AutoVer 一般选项

AutoVer 一般选项


2,在 Advanced 选项卡里,推荐勾选后两项
AutoVer 高级选项

AutoVer 高级选项


3,在 Versions 选项卡里,推荐不勾选 “Keep Backup Versions”,这个功能会产生大量的备份文件,一般情况下是不需要的。除非用来做版本控制。
AutoVer 版本选项

AutoVer 版本选项

June 28th, 2009 | Tags:

昨天和前天去天台山玩,同学拍了很多图片回来。想看的时候傻眼了,因为机子里没安装看图软件,只安装了 Gimp 。如果我用 Gimp 来看这几百张图片的话,那我肯定是白痴。

于是就想找一个可以快速看图的小软件,先后安装了 xv、xnview、xzgv(zgv) ,做了一个对比,最终确定使用 xv。

写一下这三(四)个软件的优缺点吧:

xv: 体积小,速度快,界面清爽。功能少。
xnview: 体积不大,速度快,功能多。臃肿,界面丑陋。
zgv: 只能在 console 下运行,不能在 term 下运行(或者是因为我没找到合适的方法?)。
xzgv: 依赖 GTK+1.2 和其他几个老旧的软件包。

看图软件必不可少的是快捷键,下面是一个我从网上找到的 xv 快捷键列表:

Key Command
— ————
space Next(下一张)
Del Previous(上一张)
Enter Load/Reload selected image(加载所选图片)
Ctrl-d Delete
Ctrl-l Load
Ctrl-s Save
i Info
e ColEdit
q Quit
? Open/Close the xv controls window
c Crop(剪贴)
u Uncrop(撤销剪贴)
A AutoCrop(自动剪贴)
n Normal
m MaxSize
M Maxpect
> DblSize(放大一倍)
< HalfSize(缩小一半)
. +10%
, -10%
4 4x3
a Aspect
r raw
d Dither(颜色抖动)
S Smooth(平滑处理)
t Rotate Clockwise(顺时针旋转)
T Rotate Counter-Clockwise(逆时针旋转)
h FlipH(水平翻转)
v FlipV(垂直翻转)
Ctrl-R Reset (the xv color editor)(重置 xv 颜色编辑器)
p Apply
N Norm
H Histeq

June 24th, 2009 | Tags:

今天打开浏览器,习惯性的输入 http://user.qzone.qq.com/34689**** 这个网址,想进去看一下她的空间,了解她的近况。

然而页面加载完毕后,出现的不是我所熟悉的紫色主页,而是一个访问受限的提示页面。她所设置的问题是“我叫什么名字?”

这个页面,我不是第一次见到。如果我没记错的话,早在数天以前,我已经见过了。这个问题的答案,我当然也知道。她的名字我在心里温习了十几年,如浮雕一样嵌入了我的心里。

但是我无从了解她为什么要设置这么一个访问提示问题。就在看到访问受限的一瞬间,我有被某种强大的力量向后推了一把的感觉,心中不由的打了个趔趄。我感觉我离心中的那片圣洁之地越来越远。

想起了之前我在 QQ 签名里随手写的那句话:“我时时都能感受到那隐藏于深处的绝望,绝望有时是一种力量。”三年后的今天,它还会是那种推动我不断努力的力量吗?

June 17th, 2009 | Tags:

把 WordPress 升级到 2.8 以后就发现了一个严重的问题:Exec-php 插件用不了了。而本博客的地震 Page 是需要这个插件的。

我先是到官方找一些相似的插件,比如 Php Executation 等,很遗憾,同样无法在 WordPress 2.8 上正常工作。只好到 WordPress 的官方支持论坛上求助了。发了个帖子,结果半天没人回复;随便翻了一些老贴,发现有人曾经提到过用 Shortcode 替代 Exec-php 插件。这是什么玩意儿,我怎么没听说过呢?

到 Google 上随便搜了一下,英文资料太罗嗦,直接看中文的好了。然后就稍微明白了些。这个东西类似于 BBCode ,只用几个字符就可以替代并执行一整段 PHP 代码。

怎么使用 Shortcode 呢?简单的说只需要进行如下步骤:

1,编辑 $TEMPLATE/functions.php 页面,添加一个函数以及 Shortcode 声明,比如

$function sayhi(){
echo “Hello,world!”;
}
add_shortcode(‘hi’, ‘sayhi’);

2,在帖子正文需要处添加 [hi] 标记即可。

访客打开此帖时, WordPress 会根据 [hi] 标识查找到 sayhi() 函数,并执行它,执行结果就是打印 Hell,world! 这句话。这就意味着 WordPress 其实已经变相的支持在帖子中运行自定义 PHP 代码了。

不过呢,我推荐将 Shortcode 专门放置在另外一个 shortcode.php 里,然后在 functions.php 的末尾添加

include_once(“shortcode.php”)

相关链接
WordPress 的 Shortcode
Shortcode API

June 17th, 2009 | Tags:

今天用 MPlayer 播放一首 MP3 听,竟然运行失败,提示找不到 libaudio.so.2 。这就怪异了,我最近分明没更改过这个东西,怎么突然就用不了了呢?

努力回想最近都干了些什么,好像除了下载 Opera 时删除了它所依赖的 qt3 ,以及处于更上游依赖关系的库外,没有卸载其他东西,难道与这个有关?

到网上搜索了一下 libaudio.so.2 ,没找到什么线索,不知道它隶属于哪个库。

最后逼得没办法,只好从 MPlayer 官方网站重新下载 MPlayer-1.0rc2.tar.bz2 源代码包,重新编译并覆盖安装,再次运行 MPlayer ,问题未再次出现。

June 16th, 2009 | Tags:

这是我在清水河校区这边巨烂的电信网络下发现的问题。

问题的表现:
当你试图编辑某一篇已经写好了的文章以后,如果你所处的网络环境很不好,那么等编辑页面加载完毕以后,你可能会发现你地文章平白无故被截取了一大截,只保留了前面一小部分,而后面的哪部分凭空蒸发了!

问题的根源:
据我猜测应该是与 WordPress 内建编辑器的自动保存功能有关。怎么解释呢?就是当编辑页面加载的时候,浏览器先加载了自动保存文章的 JS 代码,然后再加载文章;当文章比较长的时候,而且如果你所处的网络环境很差,比如像我这样,那么悲剧就发生了;当文章还在慢慢加载地时候,自动保存地 JS 代码地计时器可能就被触发了,于是编辑器就自作聪明地把当前已加载的那部分当成整篇文章给保存了,其余部分就这样凭空没了。

问题地解决:
直接修改代码,等编辑页面加载完毕以后再启动 JS 计时器。或者把相关 JS 代码移至页尾,先加载文章,再加载 JS 代码,这样 JS 计时器就不可能在文章未加载完毕时自动触发保存功能了。