12/29/2009

b

b

in reference to: Google (view on Google Sidewiki)

5/01/2009

Install Anjuta for C.C++ development on Ubuntu 8.X

1 install anjuta


sudo apt-get install anjuta

2 install C/C++ enviroment and related packages

sudo apt-get install autogen automake build-essential indent intltool

3 install development documents

sudo apt-get install manpages-dev

4/29/2009

install ant and svn ant on ubuntu 8.X or later

1 install and config the ant(JRE has installed)


sudo apt-get install ant ant-optional
echo ‘ANT_HOME=”/usr/share/ant”‘ | sudo tee -a /etc/environment

2 download the svnant

firefox http://subclipse.tigris.org/svnant.html

3 unzip svnant-1.2.1.zip, and put lib/*.jar files to your ANT_HOME/lib directory
4 test it with the following build.xml


<?xml version="1.0"?>
<project name="svn-test" default="Main" basedir=".">
<!-- Sets variables which can be used. -->
<property name="checkout" location="./svncheckout" />
<!-- Define the classpath which includes the jars that are required for svnant.jar -->
<path id="svnant.class.path">
<pathelement location="lib/svnant.jar" />
<pathelement location="lib/svnClientAdapter.jar" />
<pathelement location="lib/svnjavahl.jar" />
<pathelement location="lib/svnkit.jar" />
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.class.path" />


<!-- Deletes the existing build, docs and dist directory-->
<target name="clean">
<delete dir="${checkout}" />
</target>

<!-- Creates the build, docs and dist directory-->
<target name="makedir">
<mkdir dir="${checkout}" />
</target>


<!-- Checkout the latest source code of svnant itself-->
<target name="svn">
<svn username="guest" password="">
<checkout url="http://subclipse.tigris.org/svn/subclipse/trunk/svnant/" revision="HEAD" destPath="${checkout}" />
</svn>
</target>

<target name="Main" depends="clean, makedir, svn">
<description>Main target</description>
</target>
</project>



edwin@Castor:~/Desktop/svnTest$ ant
Buildfile: build.xml

clean:
[delete] Deleting directory /home/edwin/Desktop/svnTest/svncheckout

makedir:
[mkdir] Created dir: /home/edwin/Desktop/svnTest/svncheckout

svn:
[svn] started ...
[svn] finished.

Main:

BUILD SUCCESSFUL
Total time: 1 minute 58 seconds

Installing MySQL 5.1 on ubuntu 8.X or later using apt

First, you need to edit /etc/apt/sources.list and add the dotdeb repository. This is the line you need to add for Lenny, but just change it to Etch if you haven’t upgraded yet (see my earlier post if you want to know how to do that)


deb http://packages.dotdeb.org lenny all

Then, update…

apt-get update

And then install 5.1

apt-get install mysql-server-5.1

set password for root

sudo mysqladmin -u root password admin

4/26/2009

Tunnelling MySQL Over SSH On ubuntu

Context:
1 local PC
2 Remote PC IP:192.168.0.51
3 My SSH user name on remote PC is edwin

1 build a tunnel By ssh:
I will open a local TCP port 3333 for tunnelling mysql; The syntax of SSH is


ssh -L LOCAL_PORT:hostname:REMOTE_PORT USER_NAME@SERVER_NAME or IP_ADDRESS.

or with sshpass

sshpass -p 'YOUR_PASSWD' ssh -o StrictHostKeyChecking=no -L 3333:localhost:3306 USERNAME@REMORT_HOST -p 22

We're using localhost as the hostname because we are directly accessing the remote mysql server through ssh. You could also use this technique to port-forward through one ssh server to another server.

#ssh -L 3333:localhost:3306 edwin@192.168.0.51

2 Connect reomote mysql using mysql command

#mysql -u root -p -h 127.0.0.1 -P 3333

4/24/2009

Auto login script with expect on Ubuntu 9.04

1 install expect
sudo apt-get install expect
2 write shell script as the following:


#!/usr/bin/expect -f
# Expect script to supply root/admin password for remote ssh server
# and execute command.

# set Variables
set password "YOUR_PASSWORD"
set ipaddr "REMOTE_HOSTNAME"
set port 22

set timeout -1
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh $ipaddr -l root -p 22
match_max 100000
# Look for passwod prompt
expect "*?assword:*"
# Send password aka $password
send -- "$password\r"
# send blank line (\r) to make sure we get back to gui
send -- "\r"
expect eof



3 save this file as edwin.ssh, and add X permission for it
4 use it

./edwin.ssh

Common Select usage:Where condation of datatime format for query rows

There are 8 different ways for select rows form table by filed formated as datatime

1. where date like '2005-01-%'
2. where DATE_FORMAT(date,'%Y-%m')='2005-01'
3. where EXTRACT(YEAR_MONTH FROM date)='200501'
4. where YEAR(date)='2005' and MONTH(date)='1'
5. where substring(date,1,7)='2005-01'
6. where date between '2005-01-01' and '2005-01-31'
7. where date >= '2005-01-01' and date <= '2005-01-31'
8. where date IN('2005-01-01', '2005-01-02', '2005-01-03', '2005-01-04', '2005-01-05', '2005-01-06', '2005-01-07', '2005-01-08', '2005-01-09', '2005-01-10', '2005-01-11', '2005-01-12', '2005-01-13', '2005-01-14', '2005-01-15', '2005-01-16', '2005-01-17', '2005-01-18', '2005-01-19', '2005-01-20', '2005-01-21', '2005-01-22', '2005-01-23', '2005-01-24', '2005-01-25', '2005-01-26', '2005-01-27', '2005-01-28', '2005-01-29', '2005-01-30', '2005-01-31')

4/20/2009

Install javaDocs and setup in eclipse on Ubuntu

The default installation of Eclipse did not include Javadoc,so here's how to get Javadoc installed and working.


First, enter


sudo apt-get install sun-java6-doc


The installer will prompt you to download a zip file containing the documentation from Sun. Bring up Firefox and head to Sun's website. Click the zip file to download the documentation(only english version enough, never japs).

When the download finishes, in another terminal, enter


sudo cp /path/to/zip/file/documentation.zip /tmp


Enter
sudo chown root:root /tmp/documentation.zip


to change the file permissions.

Back in the first terminal, hit enter, and the installer should continue. When it finishes, in Eclipse,


click Window -> Preferences -> Java -> Installed JREs, and click the JRE . Click Edit, and use Shift+Click to select all the JRE system libraries. Click Javadoc Location, and enter


file:/usr/lib/jvm/java-6-sun/docs/api/

in the box. Click Validate to test it (you can open it in your browser to double check), and click OK out of all the dialogs. Javadoc should now be working!

4/07/2009

Add tpl to HTML content type on Zend Studio Form Eclipse

The smarty deafult tempalte file type named "tpl" hasn't been supported by Zend Studio for Eclipse 6.1. So, you need to setup this content type to html. the solution is the following:

1 Open Preferences
2 Click HTML in General->Appearance->Content Type
3 Add "*.tpl" to File associations
4 Clink OK

Install Zend Server on Ubuntu 8.10

1 Add Zend server source list


deb http://repos.zend.com/deb/pe pe non-free

get public key and import it by sofware management editor

wget http://repos.zend.com/deb/zend.key


2 Set apache2's config to your workspace

The apache used by Zend Server is apache2,the config file locates in /etc/apache/
2.1 edit "/etc/apache2/sites-available/default"

<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/workspaces/Odour-main/Public/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/edwin/Zend/workspaces/Odour-main/Public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

2.2 edit first virtualHost (IP:192.168.6.1)


<VirtualHost 192.168.6.1:80>
ServerName ComServer
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/comWorkspace/Public/
<Directory /home/edwin/Zend/comWorkspace/Public/>

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/192.168.6.1.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/192.168.6.1.access.log combined
</VirtualHost>



3 enable virturalHost


sudo a2ensite 192.168.6.1


4 restart the apache

4/03/2009

Resolution of No Sound in Wine On Ubuntu 8.10

I have used Wine successfully with Pulseaudio via padsp!!

First you have to run
Code:


padsp winecfg

and select the OSS output under Audio. The other outputs should be toggled off.Then you can use any program via "padsp wine yourprogram.exe".For example:running diablo 2 in wine

padsp wine diablo.exe

4/02/2009

installing Mysql with YUM in CentOs

1 install application
yum install mysql
yum install mysql-server
yum install mysql-devel
service mysqld start



2 Set the passwords for your root account like so

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h hostname password 'new-password'

3 config iptables for accessing by local network
#vi /etc/sysconfig/iptables
add "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT"
# service iptables restart

3/31/2009

Set Docbook edtiing environment in Ubuntu 8.10

1、init compile environment


  $sudo apt-get install xsltproc
  $sudo apt-get install docbook-xsl

  
2、install docbook editor named XMLmind XML Editor
and build a test docbook xml

3、Generating a html
$xsltproc -o test.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl test.xml

3/27/2009

Mouse-less Firefox

Navigation from the toolbar

  • Select location bar: Ctrl+L or Alt+D
  • Select search bar: Ctrl+K
  • Back: Backspace or Alt+Left
  • Forward: Alt+Right or Shift+Backspace

Searching pages

The find-as-you-type feature was an epiphany. While Google is great at getting you to the right web page, Firefox's find-as-you-type feature gets you the rest of the way.

  • Find as you type text: /
  • Find as you type link: '
  • Regular old find: Ctrl+F

The link search is very useful, especially when used in conjunction with...

Opening pages

Unless you do all of your browsing in one page, these shortcuts are huge when you don't want to go running for your mouse.

  • Open link in new window: Shift+Enter
  • Open link in new tab: Ctrl+Enter
  • Open address/search in new tab: Alt+Enter

Used together with their respective shortcuts (address and search bar shortcuts and the find-as-you-type link shortcut), the page opening shortcuts go a long way toward mouse-less browsing.

Grab bag

The following shortcuts fall into a more general grab bag of useful shortcuts.

  • Caret browsing: F7
  • Refresh: Ctrl+R or F5
  • Refresh (override cache): Ctrl+F5 or Ctrl+Shift+R
  • Switch tabs: Ctrl+Tab
  • Select tab (1-9): Ctrl+[1-9]

If you're looking to change your default mail program (e.g. to Gmail, etc.) to best utilize the Compose email shortcut, check out these tips for setting your default mail program.

Wweb writer

Install PHPunit in ZendCore on Ubuntu 8.10

1 cd :/usr/local/Zend/Core/bin
2 sudo ./pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
3 sudo ./pear install --alldeps phpunit/PHPUnit
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
phpunit/PHPUnit requires PEAR Installer (version >= 1.7.1), installed version is 1.6.1
phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
phpunit/PHPUnit can optionally use PHP extension "tokenizer"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.0)
pear/Log can optionally use PHP extension "sqlite"
downloading Image_GraphViz-1.2.1.tgz ...
Starting to download Image_GraphViz-1.2.1.tgz (4,872 bytes)
.....done: 4,872 bytes
downloading Log-1.11.3.tgz ...
Starting to download Log-1.11.3.tgz (42,960 bytes)
...done: 42,960 bytes
downloading DB-1.7.13.tgz ...
Starting to download DB-1.7.13.tgz (132,246 bytes)
...done: 132,246 bytes
downloading MDB2-2.4.1.tgz ...
Starting to download MDB2-2.4.1.tgz (119,790 bytes)
...done: 119,790 bytes
downloading Mail-1.1.14.tgz ...
Starting to download Mail-1.1.14.tgz (17,537 bytes)
...done: 17,537 bytes
downloading Net_SMTP-1.3.2.tgz ...
Starting to download Net_SMTP-1.3.2.tgz (10,247 bytes)
...done: 10,247 bytes
downloading Net_Socket-1.0.9.tgz ...
Starting to download Net_Socket-1.0.9.tgz (5,173 bytes)
...done: 5,173 bytes
downloading Auth_SASL-1.0.2.tgz ...
Starting to download Auth_SASL-1.0.2.tgz (5,645 bytes)
...done: 5,645 bytes
install ok: channel://pear.php.net/Image_GraphViz-1.2.1
install ok: channel://pear.php.net/Log-1.11.3
install ok: channel://pear.php.net/DB-1.7.13
install ok: channel://pear.php.net/MDB2-2.4.1
install ok: channel://pear.php.net/Mail-1.1.14
install ok: channel://pear.php.net/Net_Socket-1.0.9
install ok: channel://pear.php.net/Auth_SASL-1.0.2
install ok: channel://pear.php.net/Net_SMTP-1.3.2
MDB2: Optional feature fbsql available (Frontbase SQL driver for MDB2)
MDB2: Optional feature ibase available (Interbase/Firebird driver for MDB2)
MDB2: Optional feature mysql available (MySQL driver for MDB2)
MDB2: Optional feature mysqli available (MySQLi driver for MDB2)
MDB2: Optional feature mssql available (MS SQL Server driver for MDB2)
MDB2: Optional feature oci8 available (Oracle driver for MDB2)
MDB2: Optional feature pgsql available (PostgreSQL driver for MDB2)
MDB2: Optional feature querysim available (Querysim driver for MDB2)
MDB2: Optional feature sqlite available (SQLite2 driver for MDB2)
MDB2: To install optional features use "pear install pear/MDB2#featurename"

3/10/2009

Install pysvn and workbench on Ubuntu 8.10 for managing

There are few svn gui client in linu, pysvn should be a good choice on Ubuntu,
1 install ubuntu packages pysvn and workbench.

* sudo apt-get install python-svn
* sudo apt-get install svn-workbench
2 You can launch it form application menu: application->programming->svn Workbench

2/26/2009

Adding virtual directory to apache on ubuntu 8.10

To add virtual directory to apache (Zend Core) on ubuntu 8.10, is different from FC somewhere. the step is the following:
1 makdir


mkdir /home/edwin/Documents/Wiki


2 add setting to the http.conf

alias /Wiki/ "/home/edwin/Documents/Wiki/"

<Directory "/home/edwin/Documents/Wiki">
Options indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>

3 restart apache

2/19/2009

Vi full installation on ubuntu

vim as a default installation on ubuntu is tiny-vim,that have limited function to edit file. if you want to install it fully, run the following :


apt-get install vim-full vim-gnome vim-runtime vim-gui-common

Hacking tools on linux

摘自Ubuntu.com.cn

工具:Nessus(最好的开放源代码风险评估工具)
网址:http://www.nessus.org/
类别:开放源码
平台:Linux/BSD/Unix
简介:Nessus是一款可以运行在Linux、BSD、Solaris以及其他一些系统上的远程安全扫描软件。它是多线程、基于插入式的软件,拥有很好的 GTK界面,能够完成超过1200项的远程安全检查,具有强大的报告输出能力,可以产生HTML、XML、LaTeX和ASCII文本等格式的安全报告,并且会为每一个发现的安全问题提出解决建议。

工具:Ethereal(网络协议检测工具)
网址:http://www.ethereal.com/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Ethereal是一款免费的网络协议分析程序,支持Unix、Windows。借助这个程序,你既可以直接从网络上抓取数据进行分析,也可以对由其他嗅探器抓取后保存在硬盘上的数据进行分析。你能交互式地浏览抓取到的数据包,查看每一个数据包的摘要和详细信息。Ethereal有多种强大的特征,如支持几乎所有的协议、丰富的过滤语言、易于查看TCP会话经重构后的数据流等。

工具:Snort(免费的入侵检测系统)
网址:http://www.snort.org/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Snort是一款轻量级的网络入侵检测系统,能够在IP网络上进行实时的流量分析和数据包记录。它不仅能进行协议分析、内容检索、内容匹配,而且能用于侦测诸如缓冲溢出、隐秘端口扫描、CGI攻击、SMB探测、操作系统指纹识别等大量的攻击或非法探测。Snort使用灵活的规则去描述哪些流量应该被收集或被忽略,并且提供一个模块化的探测引擎。

工具:Netcat(网络瑞士军刀)
网址:http://www.atstake.com/research/tools/network_utilities/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:一个简单而有用的工具,透过使用TCP或UDP协议的网络连接去读写数据。它被设计成一个稳定的后门工具,能够直接由其它程序和脚本轻松驱动。同时,它也是一个功能强大的网络调试和探测工具,能够建立你需要的几乎所有类型的网络连接,还有几个很有意思的内置功能。

工具:TCPDump/WinDump(用于网络监测和数据收集的优秀嗅探器)
网址:http://www.tcpdump.org/,http://windump.polito.it/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Tcpdump是一款众人皆知和受人喜欢的基于命令行的网络数据包分析和嗅探工具。它能把匹配规则的数据包的包头给显示出来。你能使用这个工具去查找网络问题或者去监视网络上的状况。WinDump是Tcpdump在Windows平台上的移植版。

工具:Hping2(类似ping的网络探测工具)
网址:http://www.hping.org/
类别:开放源码
平台:Linux/BSD/Unix
简介:hping2能发送自定义的ICMP/UDP/TCP包到目标地址并且显示包的响应情况。它有一个方便的traceroute模式,并且支持IP分片。这个工具在traceroute、ping和探测防火墙后的主机时特别有用。

工具:DSniff(一流的网络审计和渗透测试工具)
网址:http://naughty.monkey.org/~dugsong/dsniff/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:DSniff是由Dug Song开发的一套包含多个工具的软件套件。其中,dsniff、filesnarf、mailsnarf、msgsnarf、rlsnarf和 webspy可以用于监视网络上我们感兴趣的数据(如口令、e-mail、文件等),arpspoof、dnsspoof和macof能很容易地载取到攻击者通常难以获取的网络信息(如二层交换数据),sshmitm和webmitm则能用于实现重写SSH和HTTPS会话达到monkey-in-the -middle攻击。在http://www.datanerds.net/~mike/dsniff.html可以找到Windows平台上的移植版。

工具:GFI LANguard(商业化的网络安全扫描软件)
网址:http://www.gfi.com/lannetscan/
类别:商业
平台:Windows
简介:LANguard扫描网络并且得出诸如每台机器的服务包等级、缺少的安全补丁、打开的共享、开放的端口、正在运行的服务和应用程序、注册表键值、弱口令、用户和组等扫描信息的报告。扫描结果输出为一个HTML格式的报告,报告能够自定义。

工具:Ettercap(为你的交换环境提供更多的安全)
网址:http://ettercap.sourceforge.net/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Ettercap是一款以太网环境下的网络监视、拦载和记录工具,支持多种主动或被动的协议分析(甚至跟加密相关的SSH、HTTPS 等),有数据插入、过滤、保持连接同步等多种功能,也有一个能支持多种嗅探模式的、强大而完整的嗅探套件,支持插件,能够检查网络环境是否是交换局域网,并且能使用主动或被动的操作系统指纹识别技术让你了解当前局域网的情况。

工具:Whisker/Libwhisker(CGI缺陷扫描软件和库)
网址:http://www.wiretrip.net/rfp/p/doc.asp/d21.htm
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Whisker是一款非常好的HTTP服务器缺陷扫描软件,能扫描出大量的已知安全漏洞,特别是些危险的CGI漏洞。Libwhisker是一个用perl编写的由Whiskerr使用的程序库,通过它你可以创建自己HTTP扫描器。

工具:John the Ripper(格外强大、灵活、快速的多平台哈希口令破解器)
网址:http://www.openwall.com/john/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:John the Ripper是一个快速的口令破解器,支持多种操作系统,如Unix、DOS、Win32、BeOS和OpenVMS等。它设计的主要目的是用于检查 Unix系统的弱口令,支持几乎所有Unix平台上经crypt函数加密后的口令哈希类型,也支持Kerberos AFS和Windows NT/2000/XP LM哈希等。

工具:OpenSSH/SSH(访问远程计算机的一种安全方法)
网址:http://www.openssh.com/,http://www.ssh.com/commerce/index.html
类别:开放源码/商业
平台:Linux/BSD/Unix/Windows
简介:SSH(Secure Shell)是一款用来登录远程服务器并在远程服务器上执行命令的程序,在缺少安全防护的网络上它能给两台互不信任的主机间提供安全可靠的加密通讯。 X11连接和其他任意的TCP/IP端口连接都可以通过SSH进行数据封装转发到一个安全的通道里。SSH开发的本意是用于代替rlogin、rsh和 rcp这些不安全的程序,以及为rdist和rsync提供安全通道。需要注意的是,OpenSSH是SSH的替代软件,SSH对于某些用途是要收费的,但OpenSSH总是免费。

工具:Sam Spade(Windows平台上的免费网络查询工具)
网址:http://www.samspade.org/ssw/
类别:免费软件
平台:Windows
简介:SamSpade提供了一个友好的GUI界面,能方便地完成多种网络查询任务,它开发的本意是用于追查垃圾邮件制造者,但也能用于其它大量的网络探测、网络管理和与安全有关的任务,包括ping、nslookup、whois、dig、traceroute、finger、raw HTTP web browser、DNS zone transfer、SMTP relay check、website search等工具,在它的网站还有大多数查询工具的一个在线版本(http://www.samspade.org/t/)。

工具:ISS Internet Scanner(应用层风险评估工具)
网址:http://www.iss.net/products_services/enterprise_protection
/vulnerability_assessment/scanner_internet.php
类别:商业
平台:Windows
简介:互联网扫描器(Internet Scanner)始于1992年一个小小的开放源代码扫描器,它是相当不错的,但价格昂贵,使用开源软件Nessus来代替它也是一个不错的选择。

工具:Tripwire(功能强大的数据完整性检查工具)
网址:http://www.tripwire.com/
类别:商业
平台:Linux/BSD/Unix/Windows
简介:Tripwire是一款文件和目录完整性检查工具,它能帮助系统管理员和用户监视一些重要文件和目录发生的任何变化。通过制定一些基本的系统策略,在文件遭到破坏或篡改时由Tripwire通知系统管理员,从而能及时地做出处理。Tripwire的商业版本非常昂贵,在 Tripwire.Org网站有一个免费的开放源代码的Linux版本,UNIX用户也可能需要考虑AIDE(http://www.cs.tut.fi /~rammer/aide.html),它是Tripwire的免费替代品。

工具:Nikto(一款非常全面的web扫描器)
网址:http://www.cirt.net/code/nikto.shtml
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Nikto是一款能对web服务器多种安全项目进行测试的扫描软件,能在200多种服务器上扫描出2000多种有潜在危险的文件、CGI及其他问题。它也使用LibWhiske库,但通常比Whisker更新的更为频繁。

工具:Kismet(强大的无线嗅探器)
网址:http://www.kismetwireless.net/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Kismet是一款802.11b网络嗅探和分析程序,功能有:支持大多数无线网卡,能通过UDP、ARP、DHCP数据包自动实现网络 IP阻塞检测,能通过Cisco Discovery协议列出Cisco设备,弱加密数据包记录,和Ethereal、tcpdump兼容的数据包dump文件,绘制探测到的网络图和估计网络范围。

工具:SuperScan(Windows平台上的TCP端口扫描器)
网址:http://www.foundstone.com/index.htm?subnav=resources/
navigation.htm&subcontent=/resources/proddesc/superscan.htm
类别:免费
平台:Windows
简介:SuperScan是一款具有TCP connect端口扫描、Ping和域名解析等功能的工具,能较容易地做到对指定范围内的IP地址进行ping和端口扫描。源代码不公开。

工具:L0phtCrack 4(Windows口令审计和恢复程序)
网址:http://www.atstake.com/research/lc/
类别:商业
平台:Linux/BSD/Unix/Windows
简介:L0phtCrack试图根据从独立的Windows NT/2000工作站、网络服务器、主域控制器或Active Directory上正当获取或者从线路上嗅探到的加密哈希值里破解出Windows口令,含有词典攻击、组合攻击、强行攻击等多种口令猜解方法。

工具:Retina(eEye公司的风险评估扫描工具)
网址:http://www.eeye.com/html/Products/Retina/index.html
类别:商业
平台:Windows
简介:像上面提到的Nessus和ISS Internet Scanner一样,Retina的功能也是用于扫描网络内所有的主机并且报告发现的每一个缺陷。

工具:Netfilter(当前Linux内核采用的包过滤防火墙)
网址:http://www.netfilter.org/
类别:开放源码
平台:Linux
简介:Netfilter是一款功能强大的包过滤防火墙,在标准的Linux内核内得到实现,iptables是防火墙配置工具。它现在支持有状态或无状态检测的包过滤,支持所有种类的NAT和包分片。相应的,对于非Linux平台上的防火墙,OpenBSD平台上有pf,UNIX平台上有 ipfilter,Windows平台上有Zone Alarm个人防火墙。

工具:traceroute/ping/telnet/whois(基本命令)
网址:
类别:免费
平台:Linux/BSD/Unix/Windows
简介:当我们使用大量的高水平的工具来辅助安全审计工作时,别忘了这几个最基本的工具。我们每个人都应非常熟悉这几个工具的用法,几乎所有的操作系统上都附带有这几个工具,不过Windows平台上没有whois工具,并且traceroute改名为tracert。

工具:Fport(增强的netstat)
网址:http://www.foundstone.com/index.htm?subnav=resources/
navigation.htm&subcontent=/resources/proddesc/fport.htm
类别:免费
平台:Windows
简介:Fport能显示主机上当前所有打开的TCP/IP、UDP端口和端口所属的进程,因此通过使用它能即刻发现未知的开放端口和该端口所属的应用程序,是一款查找木马的好工具。不过,Fport仅支持Windows系统,在许多UNIX系统上有一个netstat命令实现类似功能,Linux 系统上用 "netstat -pan"命令。源代码不公开。

工具:SAINT(安全管理员的综合网络工具)
网址:http://www.saintcorporation.com/saint/
类别:商业
平台:Linux/BSD/Unix
简介:Saint是一款商业化的风险评估工具,但与那些仅支持Windows平台的工具不同,SAINT运行在UNIX类平台上,过去它是免费并且开放源代码的,但现在是一个商业化的产品。

工具:Network Stumbler(免费的Windows平台802.11嗅探器)
网址:http://www.stumbler.net/
类别:免费
平台:Windows
简介:Netstumbler是最有名的寻找无线接入点的工具,另一个支持PDA的WinCE平台版本叫Ministumbler。这个工具现在是免费的,仅仅支持Windows系统,并且源代码不公开,而且该软件的开发者还保留在适当的情况下对授权协议的修改权。UNIX系统上的用户可以使用 Kismet 来代替。

工具:SARA(安全管理员的辅助工具)
网址:http://www-arc.com/sara/
类别:开放源码
平台:Linux/BSD/Unix
简介:SARA是一款基于SATAN安全扫描工具开发而来的风险评估工具,每月更新两次。

工具:N-Stealth(web服务器扫描工具)
网址:http://www.nstalker.com/nstealth/
类别:商业
平台:Windows
简介:N-Stealth是一款商业化的Web服务器安全扫描软件,通常它比whisker、nikto等免费的web扫描器升级的更为频繁。 N- Stealth开发商宣称的"超过20,000条的缺陷和exploit数据"和"每天新增大量的缺陷检查"是非常可疑的。我们也要注意到,在 nessus、ISS、Retina、SAINT和SARA等所有常见的风险评估工具里已含有web扫描组件,不过它们可能没有N-Stealth这样灵活易用和更新频繁。n-stealth不公开源代码。

工具:AirSnort(802.11 WEP密码破解工具)
网址:http://airsnort.shmoo.com/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:AirSnort是一款无线局域网密钥恢复工具,由Shmoo小组开发。它监视无线网络中的传输数据,当收集到足够多的数据包时就能计算出密钥。

工具:NBTScan(从Windows网络上收集NetBIOS信息)
网址:http://www.inetcat.org/software/nbtscan.html
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:NBTscan是一个用于扫描网络上NetBIOS名字信息的程序。这个程序对给出范围内的每一个地址发送NetBIOS状态查询,并且以易读的表格列出接收到的信息,对于每个响应的主机,它列出它的IP地址、NetBIOS计算机名、登录用户名和MAC地址。

工具:GnuPG/PGP(保护你的文件和通信数据的先进加密程序)
网址:http://www.gnupg.org/,http://www.pgp.com/
类别:开放源码/商业
平台:Linux/BSD/Unix/Windows
简介:PGP是由Phil Zimmerman开发的著名加密程序,它使用公钥加密算法和常规的加密技术相结合,能将加密后的文件安全地从一地传递到另一地,从而保护用户的数据免于窃听或其他的安全风险。GnuPG是遵照PGP标准开发的开源程序,不同的是,GnuPG是永远免费的,而PGP对于某些用途要收费。

工具:Firewalk(高级的traceroute)
网址:http://www.packetfactory.net/projects/firewalk/
类别:开放源码
平台:Linux/BSD/Unix
简介:Firewalk使用类似traceroute的技术来分析IP包的响应,从而测定网关的访问控制列表和绘制网络图。2002年10月,这个一流的工具在原来的基础上进行了重新开发。需要注意到的是,Firewalk里面的大多数功能也能由Hping2的traceroute选项来实现。

工具:Cain & Abel(穷人的L0phtcrack)
网址:http://www.oxid.it/cain.html
类别:免费
平台:Windows
简介:Cain & Abel是一个针对Microsoft操作系统的免费口令恢复工具。它通过如下多种方式轻松地实现口令恢复:网络嗅探、破解加密口令(使用字典或强行攻击)、解码被打乱的口令、显示口令框、显示缓存口令和分析路由协议等。源代码不公开。

工具:XProbe2(主动操作系统指纹识别工具)
网址:http://www.sys-security.com/html/projects/X.html
类别:开放源码
平台:Linux/BSD/Unix
简介:XProbe是一款测定远程主机操作系统类型的工具。它依靠与一个签名数据库的模糊匹配以及合理的推测来确定远程操作系统的类型,利用ICMP协议进行操作系统指纹识别是它的独到之处。

工具:SolarWinds Toolsets(大量的网络发现、监视、攻击工具)
网址:http://www.solarwinds.net/
类别:商业
平台:Windows
简介:SolarWinds包含大量适合系统管理员做特殊用途的工具,与安全相关的工具包括许多的网络发现扫描器(network discovery scanner)和一个SNMP强力破解器。

工具:NGrep(方便的包匹配和显示工具)
网址:http://www.packetfactory.net/projects/ngrep/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:NGrep在网络层实现了GNU grep的大多数功能,基于pcap,可以使你通过指定扩展的正则表达式或十六进制表达式去匹配网络上的数据流量。它当前能够识别流经以太网、PPP、 SLIP、FDDI、令牌网和回环设备上的TCP、UDP和ICMP数据包,并且和其他常见的嗅探工具(如tcpdump和snoop)一样,理解bpf 过滤机制。

工具:Perl/Python(脚本语言)
网址:http://www.perl.org,http://www.python.org/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:当我们使用那些已经开发好的安全工具来处理任务时,别忘了能自己写出(或修改)安全程序也是一件非常重要的事情。利用Perl和 Python能非常容易地写出用于系统测试、exploit和修补的脚本程序,使用包含Net::RawIP和协议实现等模块的 CPAN(Comprehensive Perl Archive Network:http://www.cpan.org/)或类似的档案能帮助我们比较容易地进行相关的开发。

工具:THC-Amap(应用程序指纹识别扫描器)
网址:http://www.thc.org/releases.php
类别:开放源码
平台:Linux/BSD/Unix
简介:由THC开发的Amap是一个功能强大的扫描器,它通过探测端口响应的应用程序指纹数据来识别应用程序和服务,远甚于通过缺省端口号来判断应用程序和服务的方法。

工具:OpenSSL(最为重要的SSL/TLS加密库)
网址:http://www.openssl.org/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:OpenSSL项目是共同努力开发出来的一个健全的、商业级的、全开放的和开放源代码的工具包,用于实现安全套接层协议(SSL v2/v3)和传输层安全协议(TLS v1)以及形成一个功效完整的通用加密库。该项目由全世界范围内志愿者组成的团体一起管理,他们使用Internet去交流、设计和开发这个 OpenSSL工具和相关的文档。

工具:NTop(网络使用状况监测软件)
网址:http://www.ntop.org/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Ntop是一款显示网络使用状况的流量监测软件,类似于UNIX平台上监视系统进程的top命令。在交互模式下,ntop会将网络的使用状况显示在用户的终端上;在Web模式下,ntop会做为一个web服务器,创建包含网络状况的HTML网页返回给用户。

工具:Nemesis(命令行式的UNIX网络信息包插入套件)
网址:http://www.packetfactory.net/projects/nemesis/
类别:开放源码
平台:Linux/BSD/Unix
简介:Nemesis项目是为了开发一个UNIX/Linux系统上基于命令行的、方便人们使用的IP栈,它可以自定义数据包、插入数据包、进行协议攻击等,是一个很好的测试防火墙、入侵检测系统、路由器和其他网络设备的工具。如果你对Nemesis感兴趣,那么你也可能需要看看hping2,这两者补相互之不足。

工具:LSOF(列出打开的文件)
网址:ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/
类别:开放源码
平台:Linux/BSD/Unix
简介:LSOF是针对Unix的诊断和分析工具,它能显示出由系统里正在运行的进程所打开的文件,也能显示出每一个进程的通讯socket。

工具:Hunt(Linux平台上高级的包嗅探和会话劫持工具)
网址:http://lin.fsid.cvut.cz/~kra/index.html#HUNT
类别:开放源码
平台:Linux
简介:Hunt能监视、劫持、重设网络上的TCP连接,在以太网上使用才有作用,并且含有监视交换连接的主动机制,以及包括可选的ARP转播和劫持成功后的连接同步等高级特征。

工具:Honeyd(你个人的honeynet,http://www.honeynet.org/)
网址:http://www.citi.umich.edu/u/provos/honeyd/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Honeyd是一个能在网络上创建虚拟主机的小小后台程序,虚拟主机能被配置成运行任意的服务,并且洽当的服务TCP特性以致他们看起来就像是运行在某个特定版本的操作系统上。Honeyd能在一个模拟的局域网环境里让一台主机配有多个地址,并且可以对虚似主机进行ping、 traceroute。虚拟主机上任何类型的服务都可以依照一个简单的配置文件进行模拟。Honeyd也可以对一台主机做代理服务,而不是模拟它。

工具:Achilles(可以修改http会话包的代理程序)
网址:http://packetstormsecurity.nl/filedesc/achilles-0-27.zip.html
类别:开放源码
平台:Windows
简介:Achilles是一个设计用来测试web应用程序安全性的工具。它是一个代理服务器,在一个HTTP会话中扮演着"中间人"(man- in-the -middle)的角色。一个典型的HTTP代理服务器将在客户浏览器和web服务器间转发数据包,但Achilles却载取发向任一方的HTTP会话数据,并且在转发数据前可以让用户修改这些数据。

工具:Brutus(网络认证的强行破解工具)
网址:http://www.hoobie.net/brutus/
类别:免费
平台:Windows
简介:Brutus是一款对远程服务器的网络服务进行口令猜解的工具,支持字典攻击和组合攻击,支持的网络应用包括HTTP、POP3、FTP、SMB、TELNET、IMAP、NTP等。源代码不公开。UNIX系统上的THC-Hydra有类似的功能。

工具:Stunnel(一个多种用途的SSL加密外壳)
网址:http://www.stunnel.org/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Stunnel程序被设计用来做为本地客户端和远程服务器间的SSL加密外壳。它能在POP2、POP3、IMAP等使用inetd后台进程的服务器上增加SSL功能,并且不会影响到程序源代码。它使用OpenSSL或SSLeay库建立SSL会话连接。

工具:Paketto Keiretsu(极端的TCP/IP)
网址:http://www.doxpara.com/paketto
类别:开放源码
平台:Linux/BSD/Unix
简介:Paketto Keiretsu是一组使用新式的不常见的策略去操作TCP/IP网络的工具集合,开发的最初本意是为了在现有TCP/IP架构里去实现一些功能,但现在已经远远超出了最初的本意。包含的工具有:Scanrand,一个罕见的快速的网络服务和拓朴发现系统;Minewt,一个NAT/MAT路由器; linkcat,把以太网链路做为标准的输入输出;Paratrace,不产生新的连接就能追踪网络路径;Phentropy,使用OpenQVIS在三维拓朴空间里能绘制出任意总量的数据源图形。
 

工具:Fragroute(破坏入侵检测系统最强大的工具)
网址:http://www.monkey.org/~dugsong/fragroute/
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Fragroute能够截取、修改和重写向外发送的报文,实现了大部分的IDS攻击功能。Fragroute起重要作用的是一个简单的规则设置语言,以它去实现延迟、复制、丢弃、碎片、重叠、打印、重排、分割、源路由或其他一些向目标主机发送数据包的攻击。这个工具开发的本意是去测试入侵检测系统、防火墙、基本的TCP/IP栈的行为。像Dsniff、Libdnet一样,这个优秀的工具也是由Dug Song开发的。

工具:SPIKE Proxy
网址:http://www.immunitysec.com/spikeproxy.html
类别:开放源码
平台:Linux/BSD/Unix/Windows
简介:Spike Proxy是一个开放源代码的HTTP代理程序,用于发现web站点的安全缺陷。它是Spike应用程序测试套件(http://www.immunitysec.com/spike.html)的一部份,支持SQL插入检测、web站点检测、登录表单暴力破解、溢出检测和字典穷举攻击检测等。

工具:THC-Hydra(网络认证的破解工具)
网址:http://www.thc.org/releases.php
类别:开放源码
平台:Linux/BSD/Unix
简介:这个工具能对需要网络登录的系统进行快速的字典攻击,包括FTP、POP3、IMAP、Netbios、Telnet、HTTP Auth、LDAP NNTP、VNC、ICQ、Socks5、PCNFS等,支持SSL,并且现在是Nessus风险评估工具的一部份。


其他的25个最佳安全工具:

OpenBSD,http://www.openbsd.org/:安全可靠的操作系统。

TCP Wrappers,ftp://ftp.porcupine.org/pub/security/index.html:一流的IP访问控制和日志的实现机制。

pwdump3,http://www.polivec.com/pwdump3.html:获取本地或远程Windows主机的口令哈希,而不管是否安装了syskey。

LibNet,http://www.packetfactory.net/libnet/: 允许程序员去构造和插入网络数据包的高水平开发函数库.

IpTraf,http://cebu.mozcom.com/riker/iptraf/: IP网络监控软件。

Fping,http://www.fping.com/:一次可以ping多个IP地址的扫描程序。

Bastille,http://www.bastille-linux.org/:增强系统安全性的脚本程序,支持Linux, Mac OS X和HP-UX操作系统。

Winfingerprint,http://winfingerprint.sourceforge.net/: 一款基于Win32的高级远程系统扫描器。

TCPTraceroute,http://michael.toren.net/code/tcptraceroute/:使用TCP SYN包实现traceroute的工具。

Shadow Security Scanner,http://www.safety-lab.com/en2/products/1.htm:一款商业化的风险评估工具。

pf,http://www.benzedrine.cx/pf.html:OpenBSD系统内很有特色的包过滤防火墙。

LIDS,http://www.lids.org/:Linux内核上的入侵检测和入侵防御系统。

hfnetchk,http://www.microsoft.com/technet/treeview/default.asp?
url=/technet/security/tools/tools/hfnetchk.asp:微软发布的用于检查网络上Windows主机补丁安装情况的工具。

etherape,http://etherape.sourceforge.net/:继流量监测软件etherman之后又一个支持unix的图形化网络状况监测软件。

dig,http://www.isc.org/products/BIND/:Bind附带的DNS查询工具。

Crack/Cracklib,http://www.users.dircon.co.uk/~crypto/:一流的本地口令破解器。

cheops/cheops-ng,http://www.marko.net/cheops/,http://cheops-ng.sourceforge.net/:绘制本地或远程网络的网络图,并且也能识别主机的操作系统类型。

zone alarm,http://www.zonelabs.com/:Windows平台上的个人防火墙软件。

Visual Route,http://www.visualware.com/visualroute/index.html:获取traceroute/whois数据,并且绘制出数据包经过的网络路线在世界地图上的位置。

The Coroner's Toolkit (TCT),http://www.fish.com/tct/:运行于Unix系统上的文件系统检查及紧急修复工具集。

tcpreplay,http://tcpreplay.sourceforge.net/:能把tcpdump或snoop保存下来的流量监测文件在任意点进行回放的工具。

snoop,http://www.spitzner.net/snoop.html:Solaris系统附带的网络嗅探工具。

putty,http://www.chiark.greenend.org.uk/~sgtatham/putty/:Windows平台上优秀的SSH客户端。

pstools,http://www.sysinternals.com/ntw2k/freeware/pstools.shtml:一套用于管理Windows系统的免费命令行工具。

arpwatch,http://www-nrg.ee.lbl.gov/:主要用来检测mac地址和ip地址对应关系的工具。

The best hacking tool on Ubuntu

1 Nmap
Nmap is one of the best network security scanners out there. Nmap will scan for all the computers and services that are currently running on the network.

Nmap is included within Ubuntu's repositories. So to install, use the following command:


sudo apt-get install nmap

2 NetCat
NetCat is a fantastic little program written by a guy called 'Hobbit' in 1991. This tool is used for reading and writing to network locations using connections on either UDP or TCP.
Again, NetCat is also in the repositories, so to install, run the following command:

sudo apt-get install netcat


3 Aircrack-ng
Aircrack-ng is the best tool out there for cracking and recovering 802.11 WEP & WPA-PSK keys. Once you have collected enough data packets, you are then able to recover the key from the data packets. This is defiantly a must have application to test your home wireless security.

To install:

sudo apt-get install aircrack-ng


4 nessus

The Nessus® vulnerability scanner, is the world-leader in active scanners, featuring high speed discovery, configuration auditing, asset profiling, sensitive data discovery and vulnerability analysis of your security posture. Nessus scanners can be distributed throughout an entire enterprise, inside DMZs, and across physically separate networks.
To install:

sudo apt-get install nessus
sudo apt-get install nessusd

add a new user

sudo nessus-adduser

2/17/2009

How to configure system server on Ubuntu 8.10

On ubuntu, runlevel 2 is default. You can configure Linux Startup Applications with sysv-rc-conf.Sysv-rc-conf is Run level configurator (front-end) for init.d scripts, Let us install it firstly.


sudo apt-get install sysv-rc-conf

then, setup your needed services, for example httpd(see "ZendCore and mysql config in Ubuntu 8.10")

The following list is common service
sysvconfig - Services Startup Configuration Tool

Debian and Ubuntu Linux also offers service command. It can be used to execute System V style init script stored at /etc/init.d/service-name { start|stop|restart|action }. This is good if you grown up with Red hat. This tool is equivalent to update-rc.d and invoke-rc.d (rcconf and others).
sysvconfig package

First, install sysvconfig package:

$ sudo apt-get install sysvconfig

To start / restart / stop service, use the following syntax:

$ sudo service {service-name} restart <-- Restart service
$ sudo service {service-name} stop <-- Stop service
$ sudo service {service-name} start <-- Start service

For example to stop apache service, enter:

$ sudo service httpd stop

2/16/2009

ZendCore and mysql config on Ubuntu 8.10

1 Install ZendCore
2 Configure the ZendCore's apache as init.d/httpd
add the following file to init.d


sudo gedit /etc/init.d/httpd

add the following content to this file

# httpd auto-start
#
# description: Auto-starts httpd
# processname: httpd

case $1 in
start)
/usr/local/Zend/apache2/bin/apachectl -k start
;;
stop)
/usr/local/Zend/apache2/bin/apachectl -k stop
;;
restart)
/usr/local/Zend/apache2/bin/apachectl -k restart
;;
esac
exit 0

You'll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/httpd

3 install mysql by apt-get

sudo apt-get install mysql-server mysql-clinet mysql-admin

4 config mysql socket

sudo gedit /usr/local/Zend/Core/etc/php.ini

make sure mysql driver,then modify php.ini. i.e. Mysqli

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket =/var/run/mysqld/mysqld.sock

2/15/2009

Ubuntu: Sensor temperature monitoring with lm-sensors

One of the basic things you need, especially if you build your own boxes like I do, is to be able to watch cpu temperatures, voltages, fan speeds, etc. This is easily done with the lm-sensors package in conjuction with code which is available for most types of motherboards in the kernel. This is pretty straightforward, first off lets install lm-sensors:

# apt-get install lm-sensors

config the sesors
sensors-detect

Then , install gui monitor
# apt-get install sensors-applet

2/12/2009

Install virtual network card in Ubuntu 8.10

1 install uml-utilities


sudo apt-get install uml-utilities

2 build a new virtual Network Card

tunctl -t tap0 -u edwin

3 delete this virtual network card

tunctl -d tap0

4 config tap0

ifconfig tap0 192.168.6.1 netmask 255.255.255.0

5 add network card when system startup

sudo gedit /etc/network/interfaces

add the following content

auto tap0
iface tap0 inet manual
up ifconfig $IFACE 192.168.6.1 up
down ifconfig $IFACE down
tunctl_user edwin

2/11/2009

Update the Bouml form 4.4-1 to 4.10 in Ubuntu 8.10

1 add source of bouml
deb http://download.tuxfamily.org/arakhne/ubuntu intrepid-arakhne universe

2 add pulic key
The packages are signed by a GPG public key. You must add this key into your apt key list to avoid warnings. To proceed use one of the following methods:

1. Download the public key from the download area and add it into the apt key list:

wget -q http://download.tuxfamily.org/arakhne/public.key -O- | sudo apt-key add -

2. Import the public key into your local key repository:

$> gpg --keyserver www.keyserver.net --recv-keys 0xBA62BC7E
gt; gpg --keyserver www.keyserver.net --recv-keys 0xBA62BC7E

or

$> gpg --keyserver keyserver.mobrien.net --recv-keys 0xBA62BC7E
gt; gpg --keyserver keyserver.mobrien.net --recv-keys 0xBA62BC7E

Add the imported public key into the apt key list:

$> gpg --export -a 0xBA62BC7E | sudo apt-key add -
gt; gpg --export -a 0xBA62BC7E | sudo apt-key add -
3 update by apt-get

2/07/2009

List of object-relational mapping software in PHP

bject-relational mapping (aka ORM, O/RM, and O/R mapping) is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a "virtual object database," which can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.
* Doctrine, Open Source ORM for PHP 5.2.3, free software (GNU LGPL)
* Propel, ORM and Query-Toolkit for PHP 5, inspired by Apache Torque, free software (GNU LGPL)
* EZPDO, Open Source ORM for PHP 5.0.4 or newer, free software (BSD)

1/12/2009

快速在Ubuntu 8.10 安装 lamp开发环境

在日常开发中,我们主要使用LAMP,Ubuntu提供了简单的,快速的配置该服务器环境的方法,步骤如下:

1 使用tasksel安装LAMP套件

sudo tasksel install lamp-server

2 基于ZF的开发要使用rewrite 模块,所以在终端中执行

sudo a2enmod rewrite

指令后,即启用了 Mod_rewrite 模块。

3 配置虚拟目录位置(修改红色部分)




<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/workspaces/DefaultWorkspace/Member-shouxi/Public
<directory>
Options FollowSymLinks
AllowOverride None
</directory>
<directory home/edwin/zend/workspaces/defaultworkspace/shouxi/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<directory usr="" lib="" bin="">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<directory usr="" share="" doc="">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</directory>

</VirtualHost>


4 重启apache 即可


在 Ubuntu 8.10下设置静态IP和虚拟机

步骤1-卸载 Gnome Network Manager:这是必须的一步,因为不卸载的话,不过你如何设置,重启后都会被重置。这个就是Bug所在之处。

用下列命令卸载:

sudo update-rc.d -f NetworkManager remove

这会禁用并且卸载Gnome Network Manager应用程序。然后你需要重启

步骤2-手动修改网络配置:这步你需要手动编辑网络配置文件。

2.1-手动修改网络配置文件:

sudo gedit /etc/network/interfaces

加入(或者修改)下列行:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.1.96
netmask 255.255.255.0
gateway 192.168.1.1

auto eth0:0
iface eth0:0 inet static
address 192.168.1.97
netmask 255.255.255.0
gateway 192.168.1.1

auto eth0:1
iface eth0:1 inet static
address 192.168.1.98
netmask 255.255.255.0
gateway 192.168.1.1

保存修改。

2.2-手动修改DNS配置文件:

sudo nano /etc/resolv.conf

加入(或者修改)下列行:

# Generated by NetworkManager
nameserver 192.168.1.1
nameserver 202.106.46.151

保存修改。

2.3- 手动重启网络服务:

sudo /etc/init.d/networking restart

返回结果如下:

*Reconfiguring network interfaces… [OK]

现在,你可以在终端里输入ipconfig命令来查看你修改的结果。如果不对,你还需要重启下。

设置apache的虚拟机
1 在workspace里添加doucument root
2 在/etc/apache2/sites-available 创建虚拟机配置文件 192.168.1.96, 内容如下:


<VirtualHost 192.168.1.97:80>
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/workspaces/DefaultWorkspace/ZfProjects-Main/Public

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


ErrorLog /var/log/apache2/192.168.1.97.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/192.168.1.97.access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128


<VirtualHost *:80>

3 重启apache 服务
sudo a2ensite 192.168.1.97
sudo /etc/init.d/apache2 restart

1/03/2009

Pseudocode Guidline

原文:《Pseudocode 》by Naomi Nishimura
刘建文略译(http://blog.csdn.net/keminlau)

In the text and lectures, algorithms will often be expressed in pseudocode, a mixture of code and English (for specific not necessarily good examples of particular pseudocodes, see p. 17 of the course text, or the examples in the books The Design and Analysis of Computer Algorithms by Aho, Hopcroft, and Ullman, Addison-Wesley, 1974, Computer Algorithms: Introduction to Design and Analysis by Baase, 1978, and Fundamentals of Computer Algorithms by Horowitz and Sahni, Computer Science Press, 1984). While understanding pseudocode is usually not difficult, writing it can be a challenge.

伪代码是英语与代码的混合物,理解伪代码不难,但是编写伪代码则很具有挑战性。

Why use pseudocode at all? Pseudocode strikes a sometimes precarious balance between the understandability and informality of English and the precision of code. If we write an algorithm in English, the description may be at so high a level that it is difficult to analyze the algorithm and to transform it into code.

If instead we write the algorithm in code, we have invested a lot of time in determining the details of an algorithm we may not choose to implement (as we typically wish to analyze algorithms BEFORE deciding which one to implement). The goal of writing pseudocode, then, is to provide a high-level description of an algorithm which facilitates analysis and eventual coding (should it be deemed to be a “good” algorithm) but at the same time suppresses many of the details that vanish with asymptotic notation. Finding the right level in the tradeoff between readability and precision can be tricky……

为什么一定要使用伪代码?(因为)伪代码平衡了英语(自然语言)的易理解性和非形式所带来的模糊性与代码的精确性之的矛盾。如果我们使用英语(自然语言)编写算法,那么算法描述可能太过高层而很难对算法进行分析并转化成实际代码;如果我们用代码编写算法,我们得花大量的时间在一些我们可能最终不会实现的代码细节上(缘于我们一般在实现算法之前看对算法逻辑进行分析)。编写伪代码(以一个适当的表述高度描述算法)的目的是为了便于算法分析并最终实现编码,但同时抑制住在渐近记法(asymptotic notation)被抹去的大量细节。在可读性与精确性之间找到一个适当的平衡点是相当的困难(tricky:问题难以处理,需要莫大的心力)的……

Just as a proof is written with a type of reader in mind (hence proofs in undergraduate textbooks tend to have more details than those in journal papers), algorithms written for different audiences may be written at different levels of detail. In assignments and exams for the course, you need to demonstrate your knowledge without obscuring使变模糊 the big picture with unneeded detail. Here are a few general guidelines for checking your pseudocode:

好比一个(数学)证明有预定的读者类型一样,面对不同的读者,算法的编写详细程度也不同。以下是指导伪代码编写的参考原则:
1. Mimic模仿 good code and good English. Using aspects of both systems means adhering to the style rules of both to some degree. It is still important that variable names be mnemonic, comments be included where useful, and English phrases be comprehensible (full sentences are usually not necessary).

仿照好代码或好英文(的表述方式)。意思是说在某种程度上吸收二者在表述上的优点。比如,使用易记的变量名、适当的使用注释和使用好理解的英语短语等。 2. Ignore unnecessary details. If you are worrying about the placement of commas, you are using too much detail. It is a good idea to use some convention to group statements (begin/end, brackets, or whatever else is clear), but you shouldn't obsess about syntax.

忽略不必要的细节。如果你频繁地使用逗号,意味着你写得太细了。使用begin/end或括号给组合多条语句是不错的主意,不过不能被语法分心。
3. Don't belabour无必要的解释 the obvious. In many cases, the type of a variable is clear from context; unless it is critical that it is specified to be an integer or real, it is often unnecessary to make it explicit.

不要对很显然的东西作解释。很多时候,变量的类型在上下文中是很明显的,除非它的特定类型(比如是整数或实数)是至关重要,不然没必要显式说明它的类型。

4. Take advantage of programming shorthands. Using if-then-else or looping structures is more concise than writing out the equivalent in English; general constructs that are not peculiar to a small number of languages are good candidates for use in pseudocode. Using parameters in specifying procedures is concise, clear, and accurate, and hence should not be omitted from pseudocode.

使用编程的短记(shorthands)工具。使用if-then-else 或循环结构比用英语表达更简洁;一些通用的语言构造也可在伪代码中使用(FIXME)。给函数指定参数是简洁、明了和准确的,不应该在伪代码中去除。

5. Consider the context. If you are writing an algorithm for quicksort, the statement "use quicksort to sort the values" is hiding too much detail; if we have already studied quicksort in class and later use it as a subroutine in another algorithm, the statement would be appropriate to use.

考虑上下文。如果你正为一个快速排序写一个算法,那么语句“use quicksort to sort the value”就隐藏了太多的细节了;如果你已经学习过快速排序算法,而现在把它作为一个另一个算法的子过程,那么可以用那句语句来表述。

6. Don't lose sight of the underlying model. It should be possible to “see through” your pseudocode to the model below; if not (that is, you are not able to analyze the algorithm easily), it is written at too high a level.

不迷惑于算法底下的模型。看透你的伪代码底下的模型是可能的,如是不行,证明编写的太高层次了(不够详细),那样你很难分析算法。

7. Check for balance. If the pseudocode is hard for a person to read or difficult to translate into working code (or worse yet, both!), then something is wrong with the level of detail you have chosen to use.

检验(可读性与精确性)平衡性。如果伪代码很难读懂或很难翻译成源代码,那么你的伪代码编写的详细程度必定在什么地方出了问题了。

(author: Naomi Nishimura)

Kemin said:
b.弱智的人玩IDE,聪明的人玩编程语言,智慧的人玩伪代码,当然还有更高的级别,想知道?去问上帝吧。
Kemin said:
b. 看来伪代码是亲自然语言多一点,还是亲源代码多一点是没准的,也没必须太准,太受限,因为只要代码读者能花点时间进入状态,进入问题的上下文,那即便是很 “烦人”很magic的源代码也看得懂,不然自然语言并且有人讲解也听不懂看不明。所以伪代码的抽象level去到哪不是一成不变的,因人而异。
参考

* http://en.wikipedia.org/wiki/Pseudocode
* http://www.coderookie.com/2006/tutorial/the-pseudocode-programming-process/
* 伪代码的使用 http://www.comp.nus.edu.sg/~xujia/mirror/algorithm.myrice.com/algorithm/pseudocode.htm
* PSEUDOCODE STANDARD http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html
* 算法描述中的'Pseudocode Conventions' http://bigwhite.blogbus.com/logs/2443206.html

1/01/2009

ubuntu 连接windows远程桌面

sudo apt-get install rdesktop
rdesktop 192.168.0.1

-f 全屏
-a 16位色
默认端口是3389(linux 22 sh)
注意:windows 的服务中的 Terminal Servies 需要开启。我的电脑 右键 属性 远程中,勾选 允许远程用户链接到此计算机。另外,退出的时候选择注销,而不是关机!

更多参数:
-u xxxxxx 登录用户,可选
-p xxxxxx 登录密码,可选
-r clipboard:PRIMARYCLIPBOARD 重要,剪贴板可以与远程桌面交互
-a 16 颜色,可选,不过最高就是16位
-z 压缩,可选
-g 1024x768 分辨率,可选,缺省是一种比当前本地桌面低的分辨率
-P 缓冲,可选
-r disk:wj=/home/magicgod 映射虚拟盘,可选,会在远程机器的网上邻居里虚拟出一个映射盘,功能很强,甚至可以是软盘或光盘
-r sound:off 关闭声音,当然也可以把远程发的声音映射到本地来。