Archive for the ‘Linux’ Category

13 11 2010

利用Tomato Dualwan找回TPlink 402 路由器中保存的ADSL账号密码

bigCat Posted in Linux - 3 Comments

http://bbs.dualwan.cn/viewthread.php?tid=10862

因为有个朋友的adsl密码忘记了,要换路由器,但没密码,原来的TPlink已经设置好,...于是上网搜索...
终于发现有人利用ROS的PPP服务器可以看到真实的密码,所以想到我们的DUALWAN也有PPP功能啊,于是问z大...也就有了以下文章,与大家分享下

思路:tplink的wan口接到TT的lan口,让tplink自动拨号,从TT的日志中获取真实的ADSL账号密码

1. TT先启用PPPoE,然后telnet 进去
输入 vi /etc/pppoed/pppoe-server-options
我们会看到下图的内容

2.进入到上图环境时,输入插入命令i进入文本编辑模式
把第二行的require-chap改为require-pap
并且插入下面3行内容
debug
show-password
-chap

如下图

3.按键盘上的ESC退出编辑模式,按一下不管用就按两下,然后按键盘上的Shift+;,命令提示符下出现,在后面输入wq然后回车,如下图

4.拨号等提示密码错误或者拨号通过后,在刚才的telnet里执行下面的命令
cat /var/log/messages |grep password
即可看到拨号的账号密码,如下图

另外在系统状态-->日志信息里 也可以看到账号密码

目前测试通过的有 腾达的TEI 402(有时会在在账号或密码的前面后后面会多了一串字符),TP-LINK的402,windows自带的pppoe客户端均可以获取到ADSL的账号密码

13 11 2010

core files

bigCat Posted in Linux - 0 Comment

http://en.wikipedia.org/wiki/Core_dump

http://aplawrence.com/Linux/limit_core_files.html

http://www.network-theory.co.uk/articles/gccdebug.html

9 11 2010

iptables 端口转发

bigCat Posted in Linux - 0 Comment

Johnmy 10:03:02
把本机的8080端口转发到53端口规则怎么写啊?

-A PREROUTING -i eth1 -p tcp -m tcp -d 121.192.19.137 --dport 8080 -j DNAT --to-destination 192.168.0.20:80

29 10 2010

Apache遇到的问题:APR not found

bigCat Posted in Linux - 0 Comment

原文 http://52lamp.egao99.com/post/19

#./configure --prefix……检查编辑环境时出现:

checking for APR... no
configure: error: APR not found .  Please read the documentation.

可以用./configure –help | grep apr 查看帮助。
--with-included-apr     Use bundled copies of APR/APR-Util
--with-apr=PATH         prefix for installed APR or the full path to apr-config
--with-apr-util=PATH    prefix for installed APU or the full path to
安装APR(Apache Portable Runtime )
下载:http://apr.apache.org/download.cgi

#cd /tmp/52lamp/ //源码存放位置
#tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
#cd apr-1.4.2
#./configure
#make
#make install

再次检查编译环境出现

checking for APR-util... no
configure: error: APR-util not found .  Please read the documentation.

#./configure –help | grep apr-util
--with-apr-util=PATH    prefix for installed APU or the full path to

下载:http://download.chinaunix.net/download/0001000/472.shtml
#tar -zxvf apr-util-1.3.9.tar.gz
#cd apr-util-1.3.9
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install

./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

#./configure –help | grep pcre
--with-pcre=PATH        Use external PCRE library

下载:http://sourceforge.net/projects/pcre
#unzip -o pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install

继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了

注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

#echo $?
0

#make
#make install

复制Apache启动文件
#cp /usr/local/httpd/bin/apachectl /sbin/

启动Apache
#apachectl start

设置Apache开机自启动
#vi /etc/rc.d/rc.local
增加一行 /sbin/apachectl start

或者将httpd服务添加到ntsysv服务管理工具
#apachectl stop //关闭Apache以免不必要的麻烦
#cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
#vi /etc/rc.d/init.d/httpd
修改为
#!/bin/sh
#
#chkconfig: 345 85 15 //#不能省略,注意空格
#description: httpd for 52lamp 20101016 21:54 //任意字符串
#
......

第二行中345的含义:
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart

修改有关权限
#cd /etc/rc.d/init.d/
#chmod a+x httpd
#chkconfig --add httpd

#ntsysv
httpd已经在列表中,按F1可以看到刚才编写的服务描述httpd for 52lamp 20101016 21:54。

#apachectl start
#ps -e |grep httpd
23247 ?        00:00:00 httpd
23248 ?        00:00:00 httpd
23249 ?        00:00:00 httpd
23251 ?        00:00:00 httpd
23252 ?        00:00:00 httpd

在浏览器中输入127.0.0.1,看起来一切正常;但是局域网内其他电脑不能访问!

#service iptables stop

如果不想关闭防火墙,放开80端口即可。

#vi /etc/sysconfig/iptables
增加一行-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#service iptables restart //重启防火墙

现在一切OK

24 10 2010

.htaccess 判断域名跳转

bigCat Posted in Linux - 0 Comment
RewriteEngine on
RewriteCond %{HTTP_HOST} caitou.com$ [NC]
RewriteRule ^(.*)$ http://ooxx.me/$1 [L,R=301]
Host: (miao) | Word: Press | Code: bigCat | Valid: HTML5