nc 源代码分析(1)【nc用作聊天工具】
来源:互联网 发布:关口知宏 零 编辑:程序博客网 时间:2024/05/22 05:18
客户端:nc ip port
read stdin write fd
服务端: nc -l -p port
read fd write stdout
客户端和服务端都是用的nc.exe都要连接既doconnect
然后得到一个句柄netfd,
所不同的是服务端和客户端在执行readwrite的时候有所区别!
read fd write stdout
/* main :
now we pull it all together... */
main (argc, argv)
int argc;
char ** argv;
{
...
netfd = doconnect(themaddr, curport, ouraddr, ourport);
Debug (("netfd %d from port %d to port %d", netfd, ourport, curport))
if (netfd > 0)
if (o_zero && o_udpmode) /* if UDP scanning... */
netfd = udptest (netfd, themaddr);
if (netfd > 0) { /* Yow, are we OPEN YET?! */
x = 0; /* pre-exit status */
holler ("%s [%s] %d (%s) open",
whereto->name, whereto->addrs[0], curport, portpoop->name);
#ifdef GAPING_SECURITY_HOLE
if (pr00gie) /* exec is valid for outbound, too */
doexec (netfd);
#endif /* GAPING_SECURITY_HOLE */
if (! o_zero)
#ifdef WIN32
#ifdef GAPING_SECURITY_HOLE
if (!pr00gie) // doexec does the read/write for win32
#endif
#endif
x = readwrite (netfd); /* go shovel shit */
...
if (Single)
exit (x); /* give us status on one connection */
exit (0); /* otherwise, we're just done */
return(0);
} /* main */
- nc 源代码分析(1)【nc用作聊天工具】
- nc 源代码分析(2),流程分析
- nc
- nc
- NC
- NC
- nc
- nc
- nc
- NC(Net cat ) 使用详解(用作文件传输,端口转发,反弹Shell)
- NC工具的使用说明(1)
- NC 瑞士军刀使用 [1]
- nc-verilog 学习1
- NC教程(转)
- nc使用(转)
- Netcat使用手册(nc)
- linux nc 命令详解【扫描端口、聊天工具、传输文件】
- linux nc 命令详解【扫描端口、聊天工具、传输文件】
- object-c 第一周周报
- java nio与tomcat 6 中nio的使用
- hdu Robberies 概率DP
- Java操作excel
- 2012年图灵奖
- nc 源代码分析(1)【nc用作聊天工具】
- hdu 4035 Maze 概率DP+树形DP
- ExtJS 2.0官方实例目录
- Careers_in_Science_and_Engineering
- python 3 逻辑字段
- System.load 和 System.loadLibrary使用方法
- 二叉树求两个节点的最近的父节点
- python 3 operator函数包
- FreeMarker开发资料(一)