adb登录上去,执行telnetd发现可以执行,说明android系统自带了telnetd
但从客户端连接发现每次界面一闪而过,无法成功登录,怀疑是android自带的telnetd有问题,于是改用busybox的telnetd,发现存在同样的问题。抓包也没看出什么异常错误提示,就是每次使用putty登录一闪而过就完了。
在网上搜索了一下,终于找到原因了:
因为android系统里面没有login程序,所以我们从客户端登录后系统找不到要启动的Shell,就直接退出了(telnetd默认执行/bin/login程序)。所以解决方法很简单:
在adb下执行:
telnetd -l /system/bin/sh <-开启telnet服务,加的参数是告诉系统收到telnet请求时直接启动shell>
这里顺便介绍一下telnetd的参数:
Usage: telnetd [OPTIONS]
Handle incoming telnet connections
-l LOGIN Exec LOGIN on connect
-f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue
-K Close connection as soon as login exits
(normally wait until all programs close slave pty)
-p PORT Port to listen on
-b ADDR[:PORT] Address to bind to
-F Run in foreground
-i Inetd mode
-w SEC Inetd 'wait' mode, linger time SEC
-S Log to syslog (implied by -i or without -F and -w)
原文地址:
http://hi.baidu.com/hf_zd/item/de7514c58710512746d5c095