2003/05/25

反汇编工具IDA Pro

IDA Pro是DataRescue开发的专业反汇编工具, 全称是An Advanced Interactive Multi-Processor Disassembler. 在我所知道的反汇编工具中, IDA Pro的反汇编能力最强, 远甚于W32asm, SoftIce等, 因此IDA Pro也成为了很多Hacker, Reverse engineerer的必备工具.
1)概述
从IDA的名字可以看出, IDA的最主要的两个特性是交互(Interactive)和多处理器(Multi-Processor). 多处理器特性容易理解, 是指IDA可以反汇编多种处理器平台上的软件产品(但注意IDA本身是运行于Windows下的), 基本上, IDA支持所有常见的通用处理器. 比如可以在Windows平台下使用IDA来反汇编运行于MIPS平台的PocketPC程序, 这种交叉反汇编能力给使用者带来极大的便利.

2) 交互
IDA的另一个最重要的特性之一是其"交互"的工作方式, 一般的反汇编工具在反汇编过程中总会遇到其"不能理解"的代码, 或者说不能产生便于理解,易读的反汇编结果, 原因是现在的软件编译器众多, 各种开发库更是花样百出, 在IDA不能理解这些因素时, 操作者(运行IDA的人)的指令显得尤为重要, 在反编译过程中, IDA可以完全和操作者相互交互, 操作者可以通过对IDA的交互来指导IDA更好的反汇编, 比如人工指定编译器类型/版本, 开发库类型/版本等, 甚至IDA的反汇编结果也完全可定制, 函数名, 变量名, 结构定义, 数组定义等等完全可以由操作者自定义, 加强反汇编结果. 这样的交互能力在反汇编大型软件时显得尤为重要.

3)FLIRT
IDA另外一个卓越的能力是FLIRT(Fast Library Identification and Recognition Technology) - 快速的库鉴定/识别技术. 通常的反汇编软件对于各种开发库显得无能为力, 只能给出其反汇编结果, 而不能给出库函数的名称/意义, 这样的反汇编结果虽然是正确的, 但却是无意义的, 试想你希望看到strcmp被展开成大段的汇编代码吗? IDA使用FLIRT技术可以正确识别大多数的流行的开发库, 如MFC, OWL, BCL等等. 并在反汇编结果中正确标记出所调用的库函数名称. 这样就极大的提高了反汇编结果的可读性. 事实上, FLIRT能力是IDA可以被称为专业的反汇编工具的重要因素之一.

4) 嵌入式语言IDC
IDA能够称之为专业的另一个重要因素就是IDC - IDA的嵌入式语言, 类似于微软产品中的VB Script, IDC的存在极大的提高了IDA的扩展性, IDC本身是一种类C的语言, 简单易学, 一方面使得IDA中很多的自动化的任务可以交由IDC来完成, 另一方面, 一些特殊反汇编任务需要IDC的协助, 如对代码段进行加密的程序, 可以用IDC先写一段解密的代码, 在解密后再反汇编就可以得到正确的反汇编结果.

5) 用户界面
作为交互式的反汇编工具, IDA的用户界面则显得非常重要, 早期版本的IDA使用了文本模式的Borland窗口界面(类似于Borland C++ 3.1的风格), 新版本则同时提供了Windows下的界面, 相比较而言, 我更喜欢Windows下的界面(信息量更大), IDA的用户界面为IDA的交互特性提供了很好的支持. 使得用户可以充分发挥IDA的交互能力.

6)其他特性
IDA在提供专业的反汇编能力的同时, 也同时提供了很多相当优秀的辅助功能, 这里提两点: 文件补丁的制作和动态调试.
IDA在反汇编的结果中提供了修改能力, 可以对任意看到的结果进行修改, 操作符, 操作数, 甚至是完整的指令, 但对于大多数的文件格式, IDA不支持直接存盘(只提供对DOS下EXE文件的修改存盘支持), 只能存成一个补丁文件, 补丁文件给出原文件和修改后文件的二进制差异, 补丁文件是文本格式, 以便于发布.
动态调试本不属于IDA这个静态反汇编工具的范畴(它是SoftIce的强项), 但由于动态调试与静态反汇编本身的紧密联系, 新版本的IDA提供了动态调试的支持, 这个版本以后, IDA已不再是一个单纯的静态反汇编工具了.

7)缺陷
IDA也不是十全十美, 其最大的缺陷是其反汇编的速度, 由于各种高级功能的引进, IDA在反汇编速度一项上, 落后其他大多数反汇编工具, 虽然IDA引入了后台反汇编机制, 但较慢的反汇编速度仍然成为IDA被批评的最主要因素.
另一个缺陷来自于用户界面, 由于IDA的强大交互性, 导致IDA的界面过于专业, 大量的窗口, 反汇编术语可能导致初级用户的无所适从, 但反过来也可以说, 这样的用户界面又再次加强了IDA在专业领域的地位.

8)结论
专业的反汇编工具, 不适于初级用户.

2003/05/09

Remote Control Software - VNC

VNC(Virtual Network Computing) is a platform independent remote control software from AT&T lab which support MS Windows, X Windows and Mac oprate system. It's the easiest remote software i've used.

Using VNC, you can:
1) Remote control your other computers. The main feature of VNC is remote controling. You need install the server package of VNC in server side(controled computer). In client side, no install is needed. Just run the viewer application is OK. The usage of VNC is very easy, You can control remote computer in window or fullscreen mode. Even you can remote shutdown the other computer.
2) Remote monitor your other computers. As an additional feature, you can use VNC as a remote monitor software watching the remote computers. To do this, just uncheck the local keyboard/mouse checkbox in VNC option dialog.

TIP: To control remote computer in screen saved mode or locked mode, you must install VNC as service by VNC administration tools in VNC start program menu.
TIP: To lock or unlock the remote computer, you must send Ctrl-Alt-Del to the remote, but this key is keeped by local computer, so you can only send Ctrl-Alt-Del by select "send ctrl-alt-del" from VNC system menu.

There are some derived software from standard VNC which add some useful features and bugless. TightVNC is a good one which support JAVA technology that can let any client access to VNC server by IE, That is say, NO client software is needed at client computer. Very nice feature! TightVNC is published under GNU license, you can get it from SourceForge.

2003/05/08

FreeLAMP安装指南

作为互联网上应用非常广泛的一套WEB服务器系统, FreeLAMP因为其为自由软件, 源码公开而有着其他WEB服务器系统无法比拟的优势, 这里L指Linux, A是Apache(web 服务器), M-MySql(数据库), P为PHP(动态网页解释语言), 本站也是基于这套系统(用win2000代替了Linux)而开发, 由于OpenSource, 互联网上也有相当多的基于LAMP的开源软件,因而赋予了LAMP极大的扩展性. 下面结合本站给出这个系统的安装方法, 我的计算机是WIN2000, 所以下面将以WIN2000为例来说明.
1) MySql的安装
这个是一个免费的数据库软件, 在官方网站 http://www.mysql.com/downloads/mysql-3.23.html 下载它的3.23版本(注意找到windows的版本), 大概为12M左右. 然后安装, 建议安装到C:/MySql目录. 安装完后在DOS窗口中运行c:\MySql\bin\mysqld-nt -install,这会将MySql安装为WIN2000的一个服务, 然后net start MySql启动服务, MySql就算安装完了. (可以在控制面板的'管理工具/服务'中看一下MySql服务是否存在, 并且双击它应该看到它的启动类型是'自动', 服务状态是'已启动'就对了).
2) PHP的安装
PHP是个轻量级的服务器端脚本语言, 在它的官方网站 http://www.php.net/downloads.php 下下载windows binaries的4.2.2版本(我运行的是4.2.1版本, 估计没有什么差别). 注意一定要下载那个5M的版本, 不是那个900多K的. PHP没有安装程序, 直接解压缩到C:/PHP4目录即可. 然后将c:/php4下的php.ini-dist文件拷贝到winnt目录下(就是你的WIN2000的安装目录), 改名为php.ini. 将c:/php4下的php4ts.dll和C:/php4/extensions下的php_gd.dll拷贝到winnt/system32目录下 (切记!!!).
3) Apache的安装
最后说这个web服务器的安装, 其实这个论坛也是可以在IIS(微软的web服务器)下面跑的, 但是由于FreeLAMP是比较经典的搭配, 所以Apache用的更多一些, 和PHP的配合也更好一些.
Apache有1.3和2.0两个大版本,建议安装1.3的版本, 因为这个版本已经经过全世界大量的web服务器的验证, 非常稳定, 2.0版本则好象和其它软件配合上有些问题. 在Apache的官方网页 http://www.apache.org/dist/httpd/binaries/win32/ 下download 1.3.26的win32版本(只有一个EXE文件,5M左右). 运行安装程序, 安装过程很简单, 基本上一路回车下来, 这个的安装目录无所谓.
安装后,需要修改Apache的参数, 运行Start菜单/程序菜单中的Apache HTTP server下的Configure Apache Server中的Edit...Httpd.conf..., 会打开Apache的配置文件Httpd.conf, 做以下修改:
1)找到一大堆#LoadModule地方, 在下面加上一行LoadModule php4_module c:/php4/sapi/php4apache.dll 这个用来加载php4模块.
2)紧接着下面会有一大堆的AddModule的地方, 在这里的最后加上一行AddModule mod_php4.c
3)找到ServerName一项, 改成你想让Apache显示的服务器名字, 就是你的域名, 如果没有的话, 可以用ip地址, 这个名字在安装Apache时其实已经问过你了, 这里也可以改.
4)找到DocumentRoot一项, 改成你的web服务器的主目录, 我的是D:/WEB/root, 你可以随便, 不过这个目录定下了后, web的程序就要放在这个目录下.
5)找到DirectoryIndex一项,将原来的DirectoryIndex index.html改为DirectoryIndex index.html index.php index.htm index.shtml
6)找到AddType的地方, 在原来的AddType application/x-tar .tgz下面加上两行, 一行Addtype application/x-httpd-php .php, 一行Addtype application/x-httpd-php .php3
以上更改是Apache论坛能否正常运行的关键, 存盘退出后, 就可以启动Apache了. 运行Start菜单/程序菜单中的Apache HTTP server下的Control Apache Server/Start就可以了, Apache也应该是作为WIN2000的服务运行的, 通过和MySql一样的方法在控制面板中验证一番. 如果你的Apache在安装完后已经自动运行了, 那么这时在做完所有的设置后, 应该重启动一次Apache, 也就是在Control Apache Server中先stop再start一次.

以上是三个最基本的软件AMP的安装, 还有下面几个辅助的软件, 这几个软件可以装, 也可以不装.
1)ZendOptimizer, 一个PHP的缓冲程序, 用来提高PHP的响应速度.
它的安装很简单, 基本上是一路回车就可以了, 注意安装时, ZendOptimizer会自动检测Apache和php的版本和安装路径, 如果自动检测不到, 或者自动检测的信息不正确, ZendOptimizer会提示,你可以手动修改它的信息. 安装完成后需要重新启动Apache.
2)PhpMyAdmin, 一个MySql数据库的管理程序, 就是用PHP写的, 用它来管理MySql数据库非常方便.
由于phpMyadmin的功能非常强大, 所以必须对phpMyadmin的访问加以限制, 可以通过Apache的目录权限控制来实现, apache会在要访问的每个目录中寻找.htaccess文件, 用文件中的设置来改变缺省的对所有目录设置的访问权限, 但由于在windows下很难建立这个文件(因为文件名以.开头), 所以可以在Apache的配置文件中改变这个名字, 在配置文件中将AccessFileName设置改变为AccessFileName _apache_.hta, 同时在web主目录的缺省权限设置中, 要允许通过AccessFile改变权限, 所以要在配置文件的中将AllowOverride None一项改为AllowOverride AuthConfig.
下面就要给每个目录分配权限了, 权限控制文件中(在我们这里是_apache_.hta)写入
AuthName "PhpMyAdmin Auth-Login"
AuthType basic
AuthUserFile _apache_.pas
require valid-user
其中AuthUserFile指的是用户及相应密码所在的文件, 这个文件应该放在Apache的安装目录下, 如C:/Program Files/Apache Group/Apache, 这个文件是通过Apache/bin/htpasswd小程序生成的, 如你想生成用户wenshu, 密码为123, 只需运行htpasswd -c _apache_.pas wenshu, 然后输入123两遍即可生成用户密码文件_apache_.pas, 然后将这个文件移到Apache的安装目录下就可以了.

以上的都安装完后, 就可以安装基本web应用了, 如论坛程序, 不过安装之前最好验证一下这些软件安装的有无问题, 写一个文本文件,只有一行
<?php
phpinfo();
?>

存为D:/WEB/root/index.php(如果的web根目录不一样的话, 请更改), 然后在IE的地址栏输入http://你的ip地址, 应该可以看到php的欢迎界面, 有一大堆表格, 如果你看到的话, 恭喜你, 安装完全正确!

FAQ:
1) 无法启动MySql service
如果你的MySql没有安装在C:\Mysql目录, 那么你就必须在windows目录下创建一个My.INI文件来告诉windows你的MySql的安装路径, 那样才能启动MySql服务, 具体文件内容可以参考MySql帮助文件.

2003/05/06

DVDRip

Today, with the high apeed access of Internet, the strong power of PC, We can enjoy various films in our personal computer, like in cinema before. All we need is a pc connected to Internet.
The dvdrip which mostly converted from DVD, and compressed with MPEG4 is the best choice for us. and it's the focus of this article too.
1) Where to get?
The answer is Internet, the best approach is use some P2P software like Kala, Morphues etc. I strongly recommend eMule, a very nice eDonkey(a famous P2P software) client software, high speed, more resource, easy to use, no ads and is published under GNU, which means it's very open and developed quickly! The newest eMule version is 0.27, you can download it from sourceforge. even it's source code if you like.
After install eMule, you need to connect to eDonkey world by click the connect button at the top-left of the eMule main windows. Then you can search anything in eDonkey world, of cource include dvdrip too. In the search result window, you can download anything you want. That's all.

2) How to play?
Usualy you can play the dvdrip by Microsoft media player, I recommed media player 6.4 (normaly in "c:\program file\Windows Media Player\mplayer2.exe") which is more stable and less resource occupation. Most dvdrip downloaded from Internet is divx compressed in avi format. some new dvdrip maybe compressed by xvid(not divx). Divx and xvid are both advanced video codec of MPEG4, so you must install codec software to support media player, In audio, There are also some codec like ac3, mp3 need be installed. In my experiense, Nimo codec pack is good choice which contains almost all codec you need. But unfortunately some codecs are NOT compatible each other. So you must manual install codecs you need from Nimo codec pack, as I know, if you select "Divx5 direct show" codec, you will get a install error message. But it's no bader impact.

3) Subtitles?
Vobsub which contained in Nimo codec pack is a subtitle plugin for media player, so if you view dvdrip NOT in your natural language, you need install this software . Download subtitle file from Internet(There are some website contains thousands of subtitles). Decompres and save the subtitle file to the direcotory which contains the dvdrip file, and rename the subtitle file to the dvdrip filename(not include the extname). This is very important. After do that, use
media player to open the dvdrip file, you will see the subtitle you want.

4) Other tools?
Some little tool like GSpot, Divfix, AviPreview is must have, GSpot can view an avi file's internal structure include which video and audio codec is used. When you can not play a dvdrip file, you will find GSpot is very useful to help you find the answer.
Divfix(like rmfix) can fix some bad divx file which is also useful when you can not download a dvdrip fully.
AviPreview can extract partial frames from incomplete avi file to new avi file, very useful when you downloading a large avi file and want to preview it before complete the downloading.

FAQ:
1) No sound/ No picture/No sub?
Install Nimo, If that no use, Open the rip file with GSpot, see which part of the file can not be rendered.

2)Sub only dispaly few seconds
If you use ffdShow to decode divx file, maybe get this result. Deselect all divx format(3,4,5)in ffdshow setting dialog. Use Divx 5 to decode the divx file. That will ok.

3) CPU too Slow to play the movie?
You can use BSPlayer - a very fast divx player in the world,
in my computer - Celeon 433 -, BSPlayer can play most divx movie smoothly even with ac3 audio.

4)Audio is ok, but video is full of green mask?
It's because of some old version codec's bug like ffdshow or divx. you should download the newest codec.