summaryrefslogtreecommitdiff
path: root/src/libexec/deddos.c
blob: 0af74146cc5cf5fa49b970bef1cd4763d7cd5b98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>

void ignore(int a) {}

int main(int argc,char *argv[]) {
 int i;
 struct sockaddr sa;
 signal(SIGALRM,exit);
 alarm(10);
 unsigned int sl=sizeof(sa);
 char host[256];
 char serv[256];
 char iface[256];
 char *name[16];
 getpeername(0,&sa,&sl);
 //this function is nifty as shit.
 getnameinfo(&sa,sl,host,256,serv,256,NI_NUMERICHOST);
 printf("connecting from: %s port %s\n",host,serv);
 fflush(stdout);
 printf("select interface:\n");
 fflush(stdout);
 system("/bin/cat /etc/interfaces | /usr/bin/tr '\n' ' ' | /usr/bin/fold");
 fflush(stdout);
 fgets(iface,sizeof(iface)-1,stdin);
 for(i=0;iface[i];i++) {
  if((iface[i] >= 'a' && iface[i] <= 'z') || (iface[i] >= '0' && iface[i] <= '9')) {

  } else {
   iface[i]=0;
  }
 }
 alarm(60);
 name[0]="/usr/sbin/tcpdump";
 name[1]="-c10";
 name[2]="-ni";
 name[3]=iface;
 name[4]="host";
 name[5]=host;
 name[6]="and";
 name[7]="proto";
 name[8]="UDP";
 name[9]=0;
 execv(name[0],name);
 return printf("shit fucked.\n");
}